diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9c784eb4a5..5c4cb5b788 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -202,7 +202,16 @@ jobs: needs: build strategy: matrix: + k8s_version: [""] + focus: [""] bucket: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + include: + - k8s_version: v1.21.10 + focus: "Test traffic flowing from client to server with a Kubernetes Service for the Source: HTTP" + bucket: ".*" + - k8s_version: v1.22.7 + focus: "Test traffic flowing from client to server with a Kubernetes Service for the Source: HTTP" + bucket: ".*" env: CTR_TAG: ${{ github.sha }} CTR_REGISTRY: "localhost:5000" # unused for kind, but currently required in framework @@ -233,13 +242,21 @@ jobs: id: test env: K8S_NAMESPACE: "osm-system" - run: go test ./tests/e2e -test.v -ginkgo.v -ginkgo.progress -installType=KindCluster -test.timeout 0 -test.failfast -ginkgo.failFast -ginkgo.focus='\[Bucket ${{ matrix.bucket }}\]' + run: go test ./tests/e2e -test.v -ginkgo.v -ginkgo.progress -installType=KindCluster -kindClusterVersion='${{ matrix.k8s_version }}' -test.timeout 0 -test.failfast -ginkgo.failFast -ginkgo.focus='\[Bucket ${{ matrix.bucket }}\].*${{ matrix.focus }}' continue-on-error: true + - name: Set Logs name + if: ${{ steps.test.conclusion != 'skipped' }} + run: | + if [[ -n "${{ matrix.k8s_version }}" ]]; then + echo "ARTIFACT_NAME=test_logs_k8s_version_${{ matrix.k8s_version }}" >> $GITHUB_ENV + else + echo "ARTIFACT_NAME=test_logs_bucket_${{ matrix.bucket }}" >> $GITHUB_ENV + fi - name: Upload test logs if: ${{ steps.test.conclusion != 'skipped' }} uses: actions/upload-artifact@v2 with: - name: test_logs_bucket_${{ matrix.bucket }} + name: ${{ env.ARTIFACT_NAME }} path: /tmp/test**/* - name: Check continue tests if: ${{ steps.test.conclusion != 'skipped' && steps.test.outcome == 'failure'}} diff --git a/tests/e2e/e2e_k8s_version_test.go b/tests/e2e/e2e_k8s_version_test.go deleted file mode 100644 index 3c046a17d4..0000000000 --- a/tests/e2e/e2e_k8s_version_test.go +++ /dev/null @@ -1,122 +0,0 @@ -package e2e - -import ( - "fmt" - "time" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - . "github.com/openservicemesh/osm/tests/framework" -) - -// This test is meant to install k8s clusters of different versions and run -// a correctness test to ensure OSM works on these versions. -var _ = OSMDescribe("Test HTTP traffic for different k8s versions", - OSMDescribeInfo{ - Tier: 2, - Bucket: 6, - }, - func() { - Context("Version v1.22.8", func() { - testK8sVersion("v1.22.8") - }) - Context("Version v1.21.11", func() { - testK8sVersion("v1.21.11") - }) - }) - -func testK8sVersion(version string) { - const sourceName = "client" - const destName = "server" - var ns = []string{sourceName, destName} - - Td.ClusterVersion = version // set the cluster version to test - - It("Tests HTTP traffic for client pod -> server pod", func() { - if Td.InstType != KindCluster { - Skip("Test is only meant to be run when installing a Kind cluster") - } - - // Install OSM - Expect(Td.InstallOSM(Td.GetOSMInstallOpts())).To(Succeed()) - - // Create Test NS - for _, n := range ns { - Expect(Td.CreateNs(n, nil)).To(Succeed()) - Expect(Td.AddNsToMesh(true, n)).To(Succeed()) - } - - // Get simple pod definitions for the HTTP server - svcAccDef, podDef, svcDef, err := Td.SimplePodApp( - SimplePodAppDef{ - PodName: destName, - Namespace: destName, - Image: "kennethreitz/httpbin", - Ports: []int{80}, - OS: Td.ClusterOS, - }) - Expect(err).NotTo(HaveOccurred()) - - _, err = Td.CreateServiceAccount(destName, &svcAccDef) - Expect(err).NotTo(HaveOccurred()) - _, err = Td.CreatePod(destName, podDef) - Expect(err).NotTo(HaveOccurred()) - dstSvc, err := Td.CreateService(destName, svcDef) - Expect(err).NotTo(HaveOccurred()) - - // Expect it to be up and running in it's receiver namespace - Expect(Td.WaitForPodsRunningReady(destName, 90*time.Second, 1, nil)).To(Succeed()) - - srcPod := setupSource(sourceName, false /* no service for client */) - - By("Creating SMI policies") - // Deploy allow rule client->server - httpRG, trafficTarget := Td.CreateSimpleAllowPolicy( - SimpleAllowPolicy{ - RouteGroupName: "routes", - TrafficTargetName: "test-target", - - SourceNamespace: sourceName, - SourceSVCAccountName: srcPod.Spec.ServiceAccountName, - - DestinationNamespace: destName, - DestinationSvcAccountName: svcAccDef.Name, - }) - - // Configs have to be put into a monitored NS - _, err = Td.CreateHTTPRouteGroup(destName, httpRG) - Expect(err).NotTo(HaveOccurred()) - _, err = Td.CreateTrafficTarget(destName, trafficTarget) - Expect(err).NotTo(HaveOccurred()) - - // All ready. Expect client to reach server - clientToServer := HTTPRequestDef{ - SourceNs: sourceName, - SourcePod: srcPod.Name, - SourceContainer: srcPod.Name, - - Destination: fmt.Sprintf("%s.%s", dstSvc.Name, dstSvc.Namespace), - } - - srcToDestStr := fmt.Sprintf("%s -> %s", - fmt.Sprintf("%s/%s", sourceName, srcPod.Name), - clientToServer.Destination) - - cond := Td.WaitForRepeatedSuccess(func() bool { - result := Td.HTTPRequest(clientToServer) - - if result.Err != nil || result.StatusCode != 200 { - Td.T.Logf("> (%s) HTTP Req failed %d %v", - srcToDestStr, result.StatusCode, result.Err) - return false - } - Td.T.Logf("> (%s) HTTP Req succeeded: %d", srcToDestStr, result.StatusCode) - return true - }, 5, 90*time.Second) - - Expect(cond).To(BeTrue(), "Failed testing HTTP traffic for %s", srcToDestStr) - }) - - Td.ClusterVersion = "" // reset version so the default is used -}