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"
|
2020-01-16 14:22:48 +00:00
|
|
|
config "k8s.io/kubernetes/test/e2e/framework/config"
|
2019-05-31 09:34:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
deployTimeout int
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
log.SetOutput(GinkgoWriter)
|
|
|
|
|
|
|
|
flag.IntVar(&deployTimeout, "deploy-timeout", 10, "timeout to wait for created kubernetes resources")
|
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
|
|
|
var _ = BeforeSuite(func() {
|
2019-12-03 12:36:15 +00:00
|
|
|
|
2019-05-31 09:34:04 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
var _ = AfterSuite(func() {
|
2019-12-03 12:36:15 +00:00
|
|
|
|
2019-05-31 09:34:04 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
func TestE2E(t *testing.T) {
|
|
|
|
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()
|
|
|
|
}
|