func AfterEachCheck() error {
	var errorMsg = ""

	logf.Log.Info("AfterEachCheck")

	// Phase 1 to delete dangling resources
	pvcs, _ := gTestEnv.KubeInt.CoreV1().PersistentVolumeClaims("default").List(context.TODO(), metav1.ListOptions{})
	if len(pvcs.Items) != 0 {
		errorMsg += " found leftover PersistentVolumeClaims"
		logf.Log.Info("AfterEachCheck: found leftover PersistentVolumeClaims, test fails.")
	}

	pvs, _ := gTestEnv.KubeInt.CoreV1().PersistentVolumes().List(context.TODO(), metav1.ListOptions{})
	if len(pvs.Items) != 0 {
		errorMsg += " found leftover PersistentVolumes"
		logf.Log.Info("AfterEachCheck: found leftover PersistentVolumes, test fails.")
	}

	// Mayastor volumes
	msvGVR := schema.GroupVersionResource{
		Group:    "openebs.io",
		Version:  "v1alpha1",
		Resource: "mayastorvolumes",
	}
	msvs, _ := gTestEnv.DynamicClient.Resource(msvGVR).Namespace("mayastor").List(context.TODO(), metav1.ListOptions{})
	if len(msvs.Items) != 0 {
		errorMsg += " found leftover MayastorVolumes"
		logf.Log.Info("AfterEachCheck: found leftover MayastorVolumes, test fails.")
	}

	if len(errorMsg) != 0 {
		return errors.New(errorMsg)
	}
	return nil
}
// Check that no PVs, PVCs and MSVs are still extant.
// Returns an error if resources exists.
Check that no PVs, PVCs and MSVs are still extant.
Returns an error if resources exists.
// Check that no PVs PVCs and MSVs are still extant . // Returns an error if resources exists .
func AfterEachCheck() error {
	var errorMsg = ""
	logf.Log.Info("AfterEachCheck")
	pvcs, _ := gTestEnv.KubeInt.CoreV1().PersistentVolumeClaims("default").List(context.TODO(), metav1.ListOptions{})
	if len(pvcs.Items) != 0 {
		errorMsg += " found leftover PersistentVolumeClaims"
		logf.Log.Info("AfterEachCheck: found leftover PersistentVolumeClaims, test fails.")
	}
	pvs, _ := gTestEnv.KubeInt.CoreV1().PersistentVolumes().List(context.TODO(), metav1.ListOptions{})
	if len(pvs.Items) != 0 {
		errorMsg += " found leftover PersistentVolumes"
		logf.Log.Info("AfterEachCheck: found leftover PersistentVolumes, test fails.")
	}
	msvGVR := schema.GroupVersionResource{
		Group:    "openebs.io",
		Version:  "v1alpha1",
		Resource: "mayastorvolumes",
	}
	msvs, _ := gTestEnv.DynamicClient.Resource(msvGVR).Namespace("mayastor").List(context.TODO(), metav1.ListOptions{})
	if len(msvs.Items) != 0 {
		errorMsg += " found leftover MayastorVolumes"
		logf.Log.Info("AfterEachCheck: found leftover MayastorVolumes, test fails.")
	}
	if len(errorMsg) != 0 {
		return errors.New(errorMsg)
	}
	return nil
}
func AfterEachCheck ( ) error { var errorMsg = " " logf . Log . Info ( " " ) pvcs , _ := gTestEnv . KubeInt . CoreV1 ( ) . PersistentVolumeClaims ( " " ) . List ( context . TODO ( ) , metav1 . ListOptions { } ) if len ( pvcs . Items ) != 0 { errorMsg += " " logf . Log . Info ( " " ) } pvs , _ := gTestEnv . KubeInt . CoreV1 ( ) . PersistentVolumes ( ) . List ( context . TODO ( ) , metav1 . ListOptions { } ) if len ( pvs . Items ) != 0 { errorMsg += " " logf . Log . Info ( " " ) } msvGVR := schema . GroupVersionResource { Group : " " , Version : " " , Resource : " " , } msvs , _ := gTestEnv . DynamicClient . Resource ( msvGVR ) . Namespace ( " " ) . List ( context . TODO ( ) , metav1 . ListOptions { } ) if len ( msvs . Items ) != 0 { errorMsg += " " logf . Log . Info ( " " ) } if len ( errorMsg ) != 0 { return errors . New ( errorMsg ) } return nil }
Check that no PVs, PVCs and MSVs are still extant.
Check that no PVs PVCs and MSVs are still extant .
// Phase 1 to delete dangling resources // Mayastor volumes