2019-05-31 09:34:04 +00:00
|
|
|
package e2e
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
2019-12-01 03:18:05 +00:00
|
|
|
"os"
|
|
|
|
"path/filepath"
|
2019-05-31 09:34:04 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
"k8s.io/kubernetes/test/e2e/framework"
|
2021-03-24 13:13:56 +00:00
|
|
|
"k8s.io/kubernetes/test/e2e/framework/config"
|
2019-05-31 09:34:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
log.SetOutput(GinkgoWriter)
|
|
|
|
|
|
|
|
flag.IntVar(&deployTimeout, "deploy-timeout", 10, "timeout to wait for created kubernetes resources")
|
2021-09-20 10:16:55 +00:00
|
|
|
flag.BoolVar(&deployCephFS, "deploy-cephfs", true, "deploy cephFS csi driver")
|
2020-02-25 08:00:23 +00:00
|
|
|
flag.BoolVar(&deployRBD, "deploy-rbd", true, "deploy rbd csi driver")
|
2021-09-20 10:16:55 +00:00
|
|
|
flag.BoolVar(&testCephFS, "test-cephfs", true, "test cephFS csi driver")
|
2020-07-08 11:46:31 +00:00
|
|
|
flag.BoolVar(&testRBD, "test-rbd", true, "test rbd csi driver")
|
2021-06-24 09:43:48 +00:00
|
|
|
flag.BoolVar(&helmTest, "helm-test", false, "tests running on deployment via helm")
|
2020-07-25 16:39:50 +00:00
|
|
|
flag.BoolVar(&upgradeTesting, "upgrade-testing", false, "perform upgrade testing")
|
2021-05-18 13:17:58 +00:00
|
|
|
flag.StringVar(&upgradeVersion, "upgrade-version", "v3.3.1", "target version for upgrade testing")
|
2020-02-25 11:45:54 +00:00
|
|
|
flag.StringVar(&cephCSINamespace, "cephcsi-namespace", defaultNs, "namespace in which cephcsi deployed")
|
|
|
|
flag.StringVar(&rookNamespace, "rook-namespace", "rook-ceph", "namespace in which rook is deployed")
|
2019-12-01 03:18:05 +00:00
|
|
|
setDefaultKubeconfig()
|
|
|
|
|
2019-05-31 09:34:04 +00:00
|
|
|
// Register framework flags, then handle flags
|
2020-01-16 09:26:51 +00:00
|
|
|
handleFlags()
|
2019-05-31 09:34:04 +00:00
|
|
|
framework.AfterReadingAllFlags(&framework.TestContext)
|
|
|
|
|
|
|
|
fmt.Println("timeout for deploytimeout ", deployTimeout)
|
|
|
|
}
|
|
|
|
|
2019-12-01 03:18:05 +00:00
|
|
|
func setDefaultKubeconfig() {
|
|
|
|
_, exists := os.LookupEnv("KUBECONFIG")
|
|
|
|
if !exists {
|
|
|
|
defaultKubeconfig := filepath.Join(os.Getenv("HOME"), ".kube", "config")
|
|
|
|
os.Setenv("KUBECONFIG", defaultKubeconfig)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-31 09:34:04 +00:00
|
|
|
func TestE2E(t *testing.T) {
|
2021-06-02 09:55:53 +00:00
|
|
|
t.Parallel()
|
2019-05-31 09:34:04 +00:00
|
|
|
RegisterFailHandler(Fail)
|
|
|
|
RunSpecs(t, "E2e Suite")
|
|
|
|
}
|
2020-01-16 14:22:48 +00:00
|
|
|
|
|
|
|
func handleFlags() {
|
|
|
|
config.CopyFlags(config.Flags, flag.CommandLine)
|
|
|
|
framework.RegisterCommonFlags(flag.CommandLine)
|
|
|
|
framework.RegisterClusterFlags(flag.CommandLine)
|
2020-02-19 08:37:11 +00:00
|
|
|
testing.Init()
|
2020-01-16 14:22:48 +00:00
|
|
|
flag.Parse()
|
2021-06-16 06:49:42 +00:00
|
|
|
initResources()
|
2020-01-16 14:22:48 +00:00
|
|
|
}
|