2021-12-21 14:23:26 +00:00
|
|
|
/*
|
|
|
|
Copyright 2021 The Ceph-CSI 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.
|
|
|
|
*/
|
|
|
|
|
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")
|
2022-04-11 09:51:12 +00:00
|
|
|
flag.StringVar(&upgradeVersion, "upgrade-version", "v3.5.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")
|
2022-04-07 15:42:48 +00:00
|
|
|
flag.BoolVar(&isOpenShift, "is-openshift", false, "disables certain checks on OpenShift")
|
2022-04-07 15:36:45 +00:00
|
|
|
flag.StringVar(&fileSystemName, "filesystem", "myfs", "CephFS filesystem to use")
|
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()
|
|
|
|
}
|