zfs-localpv/tests/suite_test.go
Pawan 80e4d06860 fix(test): fixing resize flaky test case
We are comparing the desired size to the wrong field
because of that resize test is not executing correctly
and sometimes causing test case failure in travis.

The update call is failing sometimes while executing the zfs
property update test cases as for resize also the object
is getting modified. The test case will fail when object updation
happens between volume GET and UPDATE call while performing
zfs property update test case to set various properties on
ZFSVolume resource.

Signed-off-by: Pawan <pawan@mayadata.io>
2020-03-26 22:57:23 +05:30

84 lines
2.6 KiB
Go

/*
Copyright 2019 The OpenEBS Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package tests
import (
"github.com/Sirupsen/logrus"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openebs/zfs-localpv/pkg/builder/volbuilder"
"github.com/openebs/zfs-localpv/tests/deploy"
"github.com/openebs/zfs-localpv/tests/pod"
"github.com/openebs/zfs-localpv/tests/pvc"
"github.com/openebs/zfs-localpv/tests/sc"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
"os"
"testing"
// auth plugins
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
)
const (
// zfs pool name where volume provisioning will happen
POOLNAME = "zfspv-pool"
)
var (
ZFSClient *volbuilder.Kubeclient
SCClient *sc.Kubeclient
PVCClient *pvc.Kubeclient
DeployClient *deploy.Kubeclient
PodClient *pod.KubeClient
nsName = "zfspv-provision"
scName = "zfspv-sc"
ZFSProvisioner = "zfs.csi.openebs.io"
pvcName = "zfspv-pvc"
appName = "busybox-zfspv"
nsObj *corev1.Namespace
scObj *storagev1.StorageClass
deployObj *appsv1.Deployment
pvcObj *corev1.PersistentVolumeClaim
appPod *corev1.PodList
accessModes = []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}
capacity = "5368709120" // 5Gi
NewCapacity = "8Gi" // 8Gi, for testing resize
KubeConfigPath string
OpenEBSNamespace string
)
func init() {
KubeConfigPath = os.Getenv("KUBECONFIG")
OpenEBSNamespace = os.Getenv("OPENEBS_NAMESPACE")
if OpenEBSNamespace == "" {
logrus.Fatalf("OPENEBS_NAMESPACE environment variable not set")
}
SCClient = sc.NewKubeClient(sc.WithKubeConfigPath(KubeConfigPath))
PVCClient = pvc.NewKubeClient(pvc.WithKubeConfigPath(KubeConfigPath))
DeployClient = deploy.NewKubeClient(deploy.WithKubeConfigPath(KubeConfigPath))
PodClient = pod.NewKubeClient(pod.WithKubeConfigPath(KubeConfigPath))
ZFSClient = volbuilder.NewKubeclient(volbuilder.WithKubeConfigPath(KubeConfigPath))
}
func TestSource(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Test ZFSPV volume provisioning")
}