diff options
| author | Congrool <chpzhangyifei@zju.edu.cn> | 2022-06-30 18:38:44 +0800 |
|---|---|---|
| committer | Congrool <chpzhangyifei@zju.edu.cn> | 2022-07-12 19:12:43 +0800 |
| commit | 35f946cdb2b6d00bb600a75ed9fdaec2d4c2c008 (patch) | |
| tree | ad8d01de8bbae9803c61952b1d99ad337beea6e2 /tests | |
| parent | Merge pull request #4043 from fisherxu/rn-1.9.4 (diff) | |
| download | kubeedge-35f946cdb2b6d00bb600a75ed9fdaec2d4c2c008.tar.gz | |
bump ginkgo to v2
Signed-off-by: Congrool <chpzhangyifei@zju.edu.cn>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/e2e/deployment/deployment_test.go | 16 | ||||
| -rw-r--r-- | tests/e2e/deployment/device_crd_test.go | 22 | ||||
| -rw-r--r-- | tests/e2e/deployment/e2e_test.go | 2 | ||||
| -rw-r--r-- | tests/e2e/deployment/rule_crd_test.go | 10 | ||||
| -rw-r--r-- | tests/e2e/edgesite/edgesite_test.go | 16 | ||||
| -rw-r--r-- | tests/e2e/keadm/keadm_suite_test.go | 2 | ||||
| -rw-r--r-- | tests/e2e/keadm/keadm_test.go | 10 | ||||
| -rwxr-xr-x | tests/e2e/scripts/execute.sh | 25 | ||||
| -rw-r--r-- | tests/e2e/utils/common.go | 2 | ||||
| -rw-r--r-- | tests/e2e/utils/log.go | 9 |
10 files changed, 65 insertions, 49 deletions
diff --git a/tests/e2e/deployment/deployment_test.go b/tests/e2e/deployment/deployment_test.go index 722588727..b23c59fe2 100644 --- a/tests/e2e/deployment/deployment_test.go +++ b/tests/e2e/deployment/deployment_test.go @@ -20,7 +20,7 @@ import ( "net/http" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -36,13 +36,13 @@ var DeploymentTestTimerGroup *utils.TestTimerGroup = utils.NewTestTimerGroup() var _ = Describe("Application deployment test in E2E scenario", func() { var UID string var testTimer *utils.TestTimer - var testDescription GinkgoTestDescription + var testSpecReport SpecReport Context("Test application deployment and delete deployment using deployment spec", func() { BeforeEach(func() { - // Get current test description - testDescription = CurrentGinkgoTestDescription() + // Get current test SpecReport + testSpecReport = CurrentSpecReport() // Start test timer - testTimer = DeploymentTestTimerGroup.NewTestTimer(testDescription.TestText) + testTimer = DeploymentTestTimerGroup.NewTestTimer(testSpecReport.LeafNodeText) }) AfterEach(func() { // End test timer @@ -99,10 +99,10 @@ var _ = Describe("Application deployment test in E2E scenario", func() { }) Context("Test application deployment using Pod spec", func() { BeforeEach(func() { - // Get current test description - testDescription = CurrentGinkgoTestDescription() + // Get current test SpecReport + testSpecReport = CurrentSpecReport() // Start test timer - testTimer = DeploymentTestTimerGroup.NewTestTimer(testDescription.TestText) + testTimer = DeploymentTestTimerGroup.NewTestTimer(testSpecReport.LeafNodeText) }) AfterEach(func() { // End test timer diff --git a/tests/e2e/deployment/device_crd_test.go b/tests/e2e/deployment/device_crd_test.go index 1fb9afc28..fe2fc2a4f 100644 --- a/tests/e2e/deployment/device_crd_test.go +++ b/tests/e2e/deployment/device_crd_test.go @@ -21,7 +21,7 @@ import ( "net/http" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" @@ -42,7 +42,7 @@ var CRDTestTimerGroup *utils.TestTimerGroup = utils.NewTestTimerGroup() //Run Test cases var _ = Describe("Device Management test in E2E scenario", func() { var testTimer *utils.TestTimer - var testDescription GinkgoTestDescription + var testSpecReport SpecReport Context("Test Device Model Creation, Updation and deletion", func() { BeforeEach(func() { // Delete any pre-existing device models @@ -54,10 +54,10 @@ var _ = Describe("Device Management test in E2E scenario", func() { Expect(IsDeviceModelDeleted).Should(BeTrue()) Expect(statusCode).Should(Equal(http.StatusOK)) } - // Get current test description - testDescription = CurrentGinkgoTestDescription() + // Get current test SpecReport + testSpecReport = CurrentSpecReport() // Start test timer - testTimer = CRDTestTimerGroup.NewTestTimer(testDescription.TestText) + testTimer = CRDTestTimerGroup.NewTestTimer(testSpecReport.LeafNodeText) }) AfterEach(func() { // End test timer @@ -177,10 +177,10 @@ var _ = Describe("Device Management test in E2E scenario", func() { Expect(statusCode).Should(Equal(http.StatusOK)) } utils.TwinResult = utils.DeviceTwinResult{} - // Get current test description - testDescription = CurrentGinkgoTestDescription() + // Get current test SpecReport + testSpecReport = CurrentSpecReport() // Start test timer - testTimer = CRDTestTimerGroup.NewTestTimer(testDescription.TestText) + testTimer = CRDTestTimerGroup.NewTestTimer(testSpecReport.LeafNodeText) }) AfterEach(func() { // End test timer @@ -594,10 +594,10 @@ var _ = Describe("Device Management test in E2E scenario", func() { Expect(statusCode).Should(Equal(http.StatusOK)) } utils.TwinResult = utils.DeviceTwinResult{} - // Get current test description - testDescription = CurrentGinkgoTestDescription() + // Get current test SpecReport + testSpecReport = CurrentSpecReport() // Start test timer - testTimer = CRDTestTimerGroup.NewTestTimer(testDescription.TestText) + testTimer = CRDTestTimerGroup.NewTestTimer(testSpecReport.LeafNodeText) }) AfterEach(func() { // End test timer diff --git a/tests/e2e/deployment/e2e_test.go b/tests/e2e/deployment/e2e_test.go index fabd44276..24e346676 100644 --- a/tests/e2e/deployment/e2e_test.go +++ b/tests/e2e/deployment/e2e_test.go @@ -21,7 +21,7 @@ import ( "os" "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/pflag" diff --git a/tests/e2e/deployment/rule_crd_test.go b/tests/e2e/deployment/rule_crd_test.go index 8eb11eaf8..e5b5e6ca4 100644 --- a/tests/e2e/deployment/rule_crd_test.go +++ b/tests/e2e/deployment/rule_crd_test.go @@ -5,7 +5,7 @@ import ( "net/http" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" v1 "github.com/kubeedge/kubeedge/pkg/apis/rules/v1" @@ -19,7 +19,7 @@ const ( var _ = Describe("Rule Management test in E2E scenario", func() { var testTimer *utils.TestTimer - var testDescription GinkgoTestDescription + var testSpecReport SpecReport msg := "Hello World!" Context("Test rule and ruleendpoint Creation and deletion", func() { BeforeEach(func() { @@ -41,10 +41,10 @@ var _ = Describe("Rule Management test in E2E scenario", func() { Expect(IsReDeleted).Should(BeTrue()) Expect(statusCode).Should(Equal(http.StatusOK)) } - // Get current test description - testDescription = CurrentGinkgoTestDescription() + // Get current test SpecReport + testSpecReport = CurrentSpecReport() // Start test timer - testTimer = CRDTestTimerGroup.NewTestTimer(testDescription.TestText) + testTimer = CRDTestTimerGroup.NewTestTimer(testSpecReport.LeafNodeText) }) AfterEach(func() { // End test timer diff --git a/tests/e2e/edgesite/edgesite_test.go b/tests/e2e/edgesite/edgesite_test.go index 532a509e5..b57f2616a 100644 --- a/tests/e2e/edgesite/edgesite_test.go +++ b/tests/e2e/edgesite/edgesite_test.go @@ -20,7 +20,7 @@ import ( "net/http" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" v1 "k8s.io/api/apps/v1" metav1 "k8s.io/api/core/v1" @@ -36,13 +36,13 @@ var DeploymentTestTimerGroup *utils.TestTimerGroup = utils.NewTestTimerGroup() var _ = Describe("Application deployment test in E2E scenario using EdgeSite", func() { var UID string var testTimer *utils.TestTimer - var testDescription GinkgoTestDescription + var testSpecReport SpecReport Context("Test application deployment and delete deployment using deployment spec", func() { BeforeEach(func() { - // Get current test description - testDescription = CurrentGinkgoTestDescription() + // Get current test SpecReport + testSpecReport = CurrentSpecReport() // Start test timer - testTimer = DeploymentTestTimerGroup.NewTestTimer(testDescription.TestText) + testTimer = DeploymentTestTimerGroup.NewTestTimer(testSpecReport.LeafNodeText) }) AfterEach(func() { // End test timer @@ -99,10 +99,10 @@ var _ = Describe("Application deployment test in E2E scenario using EdgeSite", f }) Context("Test application deployment using Pod spec using EdgeSite", func() { BeforeEach(func() { - // Get current test description - testDescription = CurrentGinkgoTestDescription() + // Get current test SpecReport + testSpecReport = CurrentSpecReport() // Start test timer - testTimer = DeploymentTestTimerGroup.NewTestTimer(testDescription.TestText) + testTimer = DeploymentTestTimerGroup.NewTestTimer(testSpecReport.LeafNodeText) }) AfterEach(func() { // End test timer diff --git a/tests/e2e/keadm/keadm_suite_test.go b/tests/e2e/keadm/keadm_suite_test.go index e692e436b..bfab30e54 100644 --- a/tests/e2e/keadm/keadm_suite_test.go +++ b/tests/e2e/keadm/keadm_suite_test.go @@ -21,7 +21,7 @@ import ( "os" "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/pflag" diff --git a/tests/e2e/keadm/keadm_test.go b/tests/e2e/keadm/keadm_test.go index 09f934d11..726101408 100644 --- a/tests/e2e/keadm/keadm_test.go +++ b/tests/e2e/keadm/keadm_test.go @@ -19,7 +19,7 @@ package keadm import ( "net/http" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -34,13 +34,13 @@ var DeploymentTestTimerGroup *utils.TestTimerGroup = utils.NewTestTimerGroup() //Run Test cases var _ = Describe("Application deployment test in keadm E2E scenario", func() { var testTimer *utils.TestTimer - var testDescription GinkgoTestDescription + var testSpecReport SpecReport Context("Test application deployment using Pod spec", func() { BeforeEach(func() { - // Get current test description - testDescription = CurrentGinkgoTestDescription() + // Get current test SpecReport + testSpecReport = CurrentSpecReport() // Start test timer - testTimer = DeploymentTestTimerGroup.NewTestTimer(testDescription.TestText) + testTimer = DeploymentTestTimerGroup.NewTestTimer(testSpecReport.LeafNodeText) }) AfterEach(func() { // End test timer diff --git a/tests/e2e/scripts/execute.sh b/tests/e2e/scripts/execute.sh index 1938ab66d..ac6703ea2 100755 --- a/tests/e2e/scripts/execute.sh +++ b/tests/e2e/scripts/execute.sh @@ -22,15 +22,32 @@ cd $workdir curpath=$PWD echo $PWD -which ginkgo &> /dev/null || ( - go install github.com/onsi/ginkgo/ginkgo@latest - sudo cp $GOPATH/bin/ginkgo /usr/local/bin/ -) +check_ginkgo_v2() { + # check if ginkgo is installed + which ginkgo &> /dev/null || ( + echo "ginkgo is not found, install first" + go install github.com/onsi/ginkgo/v2/ginkgo@v2.1.4 + sudo cp $GOPATH/bin/ginkgo /usr/local/bin/ + return + ) + + # check if the ginkgo version is v2 + local -a ginkgo_version_output + read -ra ginkgo_version_output <<< $(ginkgo version) + # Assuming ginkgo version output format is: + # Ginkgo Version 2.1.4 + if [[ "${ginkgo_version_output[2]}" != "2.1.4" ]]; then + echo "ginkgo version is not v2.1.4, reinstall ginkgo v2.1.4" + go install github.com/onsi/ginkgo/v2/ginkgo@v2.1.4 + sudo cp $GOPATH/bin/ginkgo /usr/local/bin/ + fi +} cleanup() { bash ${curpath}/tests/e2e/scripts/cleanup.sh } +check_ginkgo_v2 cleanup E2E_DIR=${curpath}/tests/e2e diff --git a/tests/e2e/utils/common.go b/tests/e2e/utils/common.go index db06bdcc6..83ff22e20 100644 --- a/tests/e2e/utils/common.go +++ b/tests/e2e/utils/common.go @@ -30,7 +30,7 @@ import ( "time" MQTT "github.com/eclipse/paho.mqtt.golang" - "github.com/onsi/ginkgo" + "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" apps "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" diff --git a/tests/e2e/utils/log.go b/tests/e2e/utils/log.go index d79508c2b..7268fd2d9 100644 --- a/tests/e2e/utils/log.go +++ b/tests/e2e/utils/log.go @@ -19,7 +19,7 @@ import ( "fmt" "time" - "github.com/onsi/ginkgo" + "github.com/onsi/ginkgo/v2" ) //Function to get time in millisec @@ -53,13 +53,12 @@ func Infof(format string, args ...interface{}) { //Function to print the test case name and status of execution func PrintTestcaseNameandStatus() { - var testdesc ginkgo.GinkgoTestDescription var Status string - testdesc = ginkgo.CurrentGinkgoTestDescription() - if testdesc.Failed { + testSpecReport := ginkgo.CurrentSpecReport() + if testSpecReport.Failed() { Status = "FAILED" } else { Status = "PASSED" } - Infof("TestCase:%40s Status=%s", testdesc.TestText, Status) + Infof("TestCase:%40s Status=%s", testSpecReport.LeafNodeText, Status) } |
