ceph-csi/e2e/e2e_test.go
Madhu Rajanna 59fe8c1f2f Provide option to skip ceph-csi plugin deployment
To test helm charts in CI we need to skip the ceph-csi
deployment in E2E, This PR provides an option in E2E
to enable/disable cephcsi deployment.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-03-20 10:16:23 +00:00

67 lines
1.3 KiB
Go

package e2e
import (
"flag"
"fmt"
"log"
"os"
"path/filepath"
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"k8s.io/kubernetes/test/e2e/framework"
config "k8s.io/kubernetes/test/e2e/framework/config"
)
var (
deployTimeout int
deployCephFS bool
deployRBD bool
)
func init() {
log.SetOutput(GinkgoWriter)
flag.IntVar(&deployTimeout, "deploy-timeout", 10, "timeout to wait for created kubernetes resources")
flag.BoolVar(&deployCephFS, "deploy-cephfs", true, "deploy cephfs csi driver")
flag.BoolVar(&deployRBD, "deploy-rbd", true, "deploy rbd csi driver")
setDefaultKubeconfig()
// Register framework flags, then handle flags
handleFlags()
framework.AfterReadingAllFlags(&framework.TestContext)
fmt.Println("timeout for deploytimeout ", deployTimeout)
}
func setDefaultKubeconfig() {
_, exists := os.LookupEnv("KUBECONFIG")
if !exists {
defaultKubeconfig := filepath.Join(os.Getenv("HOME"), ".kube", "config")
os.Setenv("KUBECONFIG", defaultKubeconfig)
}
}
var _ = BeforeSuite(func() {
})
var _ = AfterSuite(func() {
})
func TestE2E(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "E2e Suite")
}
func handleFlags() {
config.CopyFlags(config.Flags, flag.CommandLine)
framework.RegisterCommonFlags(flag.CommandLine)
framework.RegisterClusterFlags(flag.CommandLine)
testing.Init()
flag.Parse()
}