INNER CODE UNIT · Go

PreCheckCeph

terraform-lxd/terraform-provider-lxd · internal/acctest/checks.go:168

func PreCheckCeph(t *testing.T) (clusterName string, cephfsName string, radosgwEndpoint string) {
	clusterName = os.Getenv("LXD_CEPH_CLUSTER")
	cephfsName = os.Getenv("LXD_CEPH_CEPHFS")
	radosgwEndpoint = os.Getenv("LXD_CEPH_CEPHOBJECT_RADOSGW")

	if clusterName == "" || cephfsName == "" || radosgwEndpoint == "" {
		t.Skipf("Test %q skipped. Ceph environment variables (LXD_CEPH_CLUSTER, LXD_CEPH_CEPHFS, LXD_CEPH_CEPHOBJECT_RADOSGW) are not set.", t.Name())
	}

	return clusterName, cephfsName, radosgwEndpoint
}

// PreCheckRoot skips the test if the user cannot escalate privileges without a password.
// Root is required for certain tests, such as creating a loopback device for storage.
// This ensures tests do not stop midway asking for password.
func PreCheckRoot(t *testing.T) {
	err := exec.Command("sudo", "-n", "true").Run()
	if err != nil {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…