summaryrefslogtreecommitdiff
path: root/tests/e2e
diff options
context:
space:
mode:
authorwackxu <xushiwei5@huawei.com>2022-11-14 20:35:46 +0800
committervincentgoat <linguohui1@huawei.com>2023-01-17 00:32:28 +0800
commitd07753b459cabb0a3aeeba26598661aff82ee301 (patch)
tree5c7734ed3747adafe1a10fef3539aea4ce5f647b /tests/e2e
parentadd e2e runner (diff)
downloadkubeedge-d07753b459cabb0a3aeeba26598661aff82ee301.tar.gz
add framework for conformance
Signed-off-by: wackxu <xushiwei5@huawei.com>
Diffstat (limited to 'tests/e2e')
-rw-r--r--tests/e2e/apps/deployment.go3
-rw-r--r--tests/e2e/device/device.go5
-rw-r--r--tests/e2e/e2e_test.go22
-rw-r--r--tests/e2e/rule/rule.go3
-rw-r--r--tests/e2e/utils/config.go21
5 files changed, 23 insertions, 31 deletions
diff --git a/tests/e2e/apps/deployment.go b/tests/e2e/apps/deployment.go
index 4209cd67f..a9e167b08 100644
--- a/tests/e2e/apps/deployment.go
+++ b/tests/e2e/apps/deployment.go
@@ -29,6 +29,7 @@ import (
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/wait"
clientset "k8s.io/client-go/kubernetes"
+ "k8s.io/kubernetes/test/e2e/framework"
"github.com/kubeedge/kubeedge/tests/e2e/constants"
"github.com/kubeedge/kubeedge/tests/e2e/testsuite"
@@ -46,7 +47,7 @@ var _ = GroupDescribe("Application deployment test in E2E scenario", func() {
var clientSet clientset.Interface
ginkgo.BeforeEach(func() {
- clientSet = utils.NewKubeClient(utils.LoadConfig().KubeConfigPath)
+ clientSet = utils.NewKubeClient(framework.TestContext.KubeConfig)
})
ginkgo.Context("Test application deployment and delete deployment using deployment spec", func() {
diff --git a/tests/e2e/device/device.go b/tests/e2e/device/device.go
index d2501d30f..1c161959f 100644
--- a/tests/e2e/device/device.go
+++ b/tests/e2e/device/device.go
@@ -26,6 +26,7 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clientset "k8s.io/client-go/kubernetes"
+ "k8s.io/kubernetes/test/e2e/framework"
edgeclientset "github.com/kubeedge/kubeedge/pkg/client/clientset/versioned"
"github.com/kubeedge/kubeedge/tests/e2e/constants"
@@ -44,8 +45,8 @@ var _ = GroupDescribe("Device Management test in E2E scenario", func() {
var edgeClientSet edgeclientset.Interface
ginkgo.BeforeEach(func() {
- clientSet = utils.NewKubeClient(utils.LoadConfig().KubeConfigPath)
- edgeClientSet = utils.NewKubeEdgeClient(utils.LoadConfig().KubeConfigPath)
+ clientSet = utils.NewKubeClient(framework.TestContext.KubeConfig)
+ edgeClientSet = utils.NewKubeEdgeClient(framework.TestContext.KubeConfig)
})
ginkgo.Context("Test Device Model Creation, Updation and deletion", func() {
diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go
index ca7a60166..9ec09d000 100644
--- a/tests/e2e/e2e_test.go
+++ b/tests/e2e/e2e_test.go
@@ -28,6 +28,7 @@ import (
"github.com/onsi/gomega"
"github.com/spf13/pflag"
"k8s.io/klog/v2"
+ "k8s.io/kubernetes/test/e2e/framework"
e2ereporters "k8s.io/kubernetes/test/e2e/reporters"
_ "github.com/kubeedge/kubeedge/tests/e2e/apps"
@@ -39,8 +40,11 @@ import (
func TestMain(m *testing.M) {
utils.CopyFlags(utils.Flags, flag.CommandLine)
utils.RegisterFlags(flag.CommandLine)
+ framework.RegisterCommonFlags(flag.CommandLine)
+ framework.RegisterClusterFlags(flag.CommandLine)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
pflag.Parse()
+ framework.AfterReadingAllFlags(&framework.TestContext)
os.Exit(m.Run())
}
@@ -50,8 +54,10 @@ func TestE2E(t *testing.T) {
var _ = ginkgo.BeforeSuite(func() {
utils.Infof("Before Suite Execution")
- err := utils.MqttConnect()
- gomega.Expect(err).To(gomega.BeNil())
+ if utils.LoadConfig().TestDevice {
+ err := utils.MqttConnect()
+ gomega.Expect(err).To(gomega.BeNil())
+ }
})
ginkgo.AfterSuite(func() {
@@ -60,21 +66,21 @@ func TestE2E(t *testing.T) {
// Run tests through the Ginkgo runner with output to console + JUnit for Jenkins
var r []ginkgo.Reporter
- if utils.LoadConfig().ReportDir != "" {
- if err := os.MkdirAll(utils.LoadConfig().ReportDir, 0755); err != nil {
+ if framework.TestContext.ReportDir != "" {
+ if err := os.MkdirAll(framework.TestContext.ReportDir, 0755); err != nil {
klog.Errorf("Failed creating report directory: %v", err)
} else {
- r = append(r, reporters.NewJUnitReporter(path.Join(utils.LoadConfig().ReportDir, fmt.Sprintf("junit_%v.xml", utils.LoadConfig().ReportPrefix))))
+ r = append(r, reporters.NewJUnitReporter(path.Join(framework.TestContext.ReportDir, fmt.Sprintf("junit_%v.xml", framework.TestContext.ReportPrefix))))
}
}
// Stream the progress to stdout and optionally a URL accepting progress updates.
- r = append(r, e2ereporters.NewProgressReporter(utils.LoadConfig().ProgressReportURL))
+ r = append(r, e2ereporters.NewProgressReporter(framework.TestContext.ProgressReportURL))
// The DetailsRepoerter will output details about every test (name, files, lines, etc) which helps
// when documenting our tests.
- if len(utils.LoadConfig().SpecSummaryOutput) > 0 {
- r = append(r, e2ereporters.NewDetailsReporterFile(utils.LoadConfig().SpecSummaryOutput))
+ if len(framework.TestContext.SpecSummaryOutput) > 0 {
+ r = append(r, e2ereporters.NewDetailsReporterFile(framework.TestContext.SpecSummaryOutput))
}
ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "kubeedge e2e suite", r)
diff --git a/tests/e2e/rule/rule.go b/tests/e2e/rule/rule.go
index 1883f178c..93e4b24f9 100644
--- a/tests/e2e/rule/rule.go
+++ b/tests/e2e/rule/rule.go
@@ -7,6 +7,7 @@ import (
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
+ "k8s.io/kubernetes/test/e2e/framework"
v1 "github.com/kubeedge/kubeedge/pkg/apis/rules/v1"
edgeclientset "github.com/kubeedge/kubeedge/pkg/client/clientset/versioned"
@@ -19,7 +20,7 @@ var _ = GroupDescribe("Rule Management test in E2E scenario", func() {
var edgeClientSet edgeclientset.Interface
ginkgo.BeforeEach(func() {
- edgeClientSet = utils.NewKubeEdgeClient(utils.LoadConfig().KubeConfigPath)
+ edgeClientSet = utils.NewKubeEdgeClient(framework.TestContext.KubeConfig)
})
msg := "Hello World!"
diff --git a/tests/e2e/utils/config.go b/tests/e2e/utils/config.go
index b2dcf804f..fe96fac96 100644
--- a/tests/e2e/utils/config.go
+++ b/tests/e2e/utils/config.go
@@ -18,10 +18,8 @@ package utils
import (
"flag"
"math/rand"
- "os"
"time"
- "k8s.io/client-go/tools/clientcmd"
cliflag "k8s.io/component-base/cli/flag"
)
@@ -35,16 +33,7 @@ type Config struct {
EdgeImageURL string `json:"edgeimageurl"`
ControllerStubPort int `json:"controllerstubport"`
Protocol string `json:"protocol"`
- KubeConfigPath string `json:"kubeconfigpath"`
-
- ReportDir string
- ReportPrefix string
- // SpecSummaryOutput is the file to write ginkgo.SpecSummary objects
- // to as tests complete. Useful for debugging and test introspection.
- SpecSummaryOutput string
- // ProgressReportURL is the URL which progress updates will be posted
- // to as tests complete. If empty, no updates are sent.
- ProgressReportURL string
+ TestDevice bool
}
// config struct
@@ -52,14 +41,8 @@ var config Config
var Flags = flag.NewFlagSet("", flag.ContinueOnError)
func RegisterFlags(flags *flag.FlagSet) {
- flags.StringVar(&config.KubeConfigPath, "kubeconfig", os.Getenv(clientcmd.RecommendedConfigPathEnvVar), "Path to kubeconfig containing embedded authinfo.")
flags.Var(cliflag.NewStringSlice(&config.AppImageURL), "image-url", "image url list for e2e")
- flags.StringVar(&config.K8SMasterForKubeEdge, "kube-master", "", "the kubernetes master address")
-
- flags.StringVar(&config.ReportPrefix, "report-prefix", "", "Optional prefix for JUnit XML reports. Default is empty, which doesn't prepend anything to the default name.")
- flags.StringVar(&config.ReportDir, "report-dir", "", "Path to the directory where the JUnit XML reports should be saved. Default is empty, which doesn't generate these reports.")
- flags.StringVar(&config.ProgressReportURL, "progress-report-url", "", "The URL to POST progress updates to as the suite runs to assist in aiding integrations. If empty, no messages sent.")
- flags.StringVar(&config.SpecSummaryOutput, "spec-dump", "", "The file to dump all ginkgo.SpecSummary to after tests run. If empty, no objects are saved/printed.")
+ flags.BoolVar(&config.TestDevice, "test-device", true, "whether test edge device")
}
func CopyFlags(source *flag.FlagSet, target *flag.FlagSet) {