diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ff08d4907..bc9011bc9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,6 +21,7 @@ jobs: checkgomod: uses: networkservicemesh/.github/.github/workflows/checkgomod.yaml@main + ### SINGLE CLUSTER kind: runs-on: ubuntu-latest strategy: @@ -52,7 +53,7 @@ jobs: path: ${{ github.workspace }}/src/github.com/${{ github.repository }} - uses: engineerd/setup-kind@v0.5.0 with: - config: src/github.com/${{ github.repository }}/${{matrix.image <= 'v1.19.11' && 'cluster-config-old.yaml' || 'cluster-config.yaml'}} + config: src/github.com/${{ github.repository }}/cluster-config.yaml version: v0.13.0 image: kindest/node:${{ matrix.image }} - name: Check kind cluster @@ -68,7 +69,7 @@ jobs: echo CLUSTER_CIDR="172.18.1.128/25" >> $GITHUB_ENV - name: Integration tests run: | - go test -count 1 -timeout 2h10m -race -v -run Single + go test -count 1 -timeout 2h10m -race -v ./tests_single env: ARTIFACTS_DIR: ${{ matrix.image }}-logs/${{ matrix.image }} working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} @@ -77,7 +78,59 @@ jobs: uses: actions/upload-artifact@v2 with: name: Single logs - path: ${{ github.workspace }}/src/github.com/${{ github.repository }}/${{ matrix.image }}-logs + path: ${{ github.workspace }}/src/github.com/${{ github.repository }}/tests_single/${{ matrix.image }}-logs + + ### SINGLE IPv6 CLUSTER + kind-ipv6: + runs-on: ubuntu-latest + env: + KUBERNETES_VERSION: "v1.25.0" + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.0 + with: + access_token: ${{ github.token }} + - uses: actions/setup-go@v1 + with: + go-version: 1.16 + github-token: ${{ github.token }} + - name: Set go env + run: | + echo GOPATH=$GITHUB_WORKSPACE >> $GITHUB_ENV + echo GO111MODULE=on >> $GITHUB_ENV + echo $GITHUB_WORKSPACE/bin >> $GITHUB_PATH + - uses: actions/checkout@v2 + with: + path: ${{ github.workspace }}/src/github.com/${{ github.repository }} + - uses: engineerd/setup-kind@v0.5.0 + with: + config: src/github.com/${{ github.repository }}/cluster-config-ipv6.yaml + version: v0.13.0 + image: kindest/node:${{ env.KUBERNETES_VERSION }} + - name: Check kind cluster + run: | + kubectl version + kubectl get pods -A -o wide + working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} + - name: Set loadbalancer CIDR + run: | + echo CLUSTER_CIDR="fc00:f853:ccd:e793:1::/80" >> $GITHUB_ENV + - name: Integration tests + run: | + go test -count 1 -timeout 2h10m -race -v \ + ./tests_single/basic_test.go \ + ./tests_single/memory_test.go + env: + ARTIFACTS_DIR: ipv6-logs/${{ env.KUBERNETES_VERSION }} + working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} + - name: Upload artifacts + if: ${{ success() || failure() || cancelled() }} + uses: actions/upload-artifact@v2 + with: + name: Single IPv6 logs + path: ${{ github.workspace }}/src/github.com/${{ github.repository }}/tests_single/ipv6-logs + + ### SINGLE CALICO CLUSTER calico-kind: runs-on: ubuntu-latest env: @@ -127,7 +180,13 @@ jobs: - name: Integration tests continue-on-error: true run: | - go test -count 1 -timeout 1h30m -race -v -run Calico + go test -count 1 -timeout 1h30m -race -v \ + ./tests_single/basic_test.go \ + ./tests_single/heal_test.go \ + ./tests_single/memory_test.go \ + ./tests_single/observability_test.go \ + ./tests_single/feature_test.go \ + -calico env: ARTIFACTS_DIR: calico-logs/${{ env.KUBERNETES_VERSION }} working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} @@ -136,7 +195,9 @@ jobs: uses: actions/upload-artifact@v2 with: name: Calico logs - path: ${{ github.workspace }}/src/github.com/${{ github.repository }}/calico-logs + path: ${{ github.workspace }}/src/github.com/${{ github.repository }}/tests_single/calico-logs + + ### INTERDOMAIN CLUSTER interdomain-kind: runs-on: ubuntu-latest env: @@ -175,7 +236,7 @@ jobs: working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} - name: Interdomain tests run: | - go test -count 1 -timeout 1h -race -v -run Interdomain + go test -count 1 -timeout 1h -race -v ./tests_interdomain env: ARTIFACTS_DIR: interdomain-logs working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} @@ -187,4 +248,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: Interdomain logs - path: ${{ github.workspace }}/src/github.com/${{ github.repository }}/interdomain-logs + path: ${{ github.workspace }}/src/github.com/${{ github.repository }}/tests_interdomain/interdomain-logs diff --git a/cluster-config-ipv6.yaml b/cluster-config-ipv6.yaml new file mode 100644 index 000000000..f832d10a1 --- /dev/null +++ b/cluster-config-ipv6.yaml @@ -0,0 +1,9 @@ +--- +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +networking: + ipFamily: ipv6 +nodes: + - role: control-plane + - role: worker + - role: worker diff --git a/cluster-config-old.yaml b/cluster-config-old.yaml deleted file mode 100644 index 63ffef3b2..000000000 --- a/cluster-config-old.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -kind: Cluster -apiVersion: kind.x-k8s.io/v1alpha4 -kubeadmConfigPatches: - - | - apiVersion: kubeadm.k8s.io/v1beta2 - kind: ClusterConfiguration - metadata: - name: config - apiServer: - extraArgs: - "service-account-issuer": "kubernetes.default.svc" - "service-account-signing-key-file": "/etc/kubernetes/pki/sa.key" -nodes: - - role: control-plane - - role: worker - - role: worker diff --git a/main_test.go b/main_test.go deleted file mode 100644 index fcb7e5b68..000000000 --- a/main_test.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2021-2022 Doc.ai and/or its affiliates. -// Copyright (c) 2022 Nordix and/or its affiliates. -// -// Copyright (c) 2022 Cisco and/or its affiliates. -// -// SPDX-License-Identifier: Apache-2.0 -// -// 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. - -package main - -import ( - "testing" - - "github.com/stretchr/testify/suite" - - "github.com/networkservicemesh/integration-tests/suites/basic" - "github.com/networkservicemesh/integration-tests/suites/features" - "github.com/networkservicemesh/integration-tests/suites/heal" - "github.com/networkservicemesh/integration-tests/suites/k8s_monolith" - "github.com/networkservicemesh/integration-tests/suites/memory" - "github.com/networkservicemesh/integration-tests/suites/observability" - "github.com/networkservicemesh/integration-tests/suites/remotevlan" -) - -func TestRunHealSuiteSingle(t *testing.T) { - suite.Run(t, new(heal.Suite)) -} - -func TestRunFeatureSuiteSingle(t *testing.T) { - suite.Run(t, new(features.Suite)) -} - -func TestRunBasicSuiteSingle(t *testing.T) { - suite.Run(t, new(basic.Suite)) -} - -func TestRunMemorySuiteSingle(t *testing.T) { - suite.Run(t, new(memory.Suite)) -} - -func TestRunRvlanSuiteSingle(t *testing.T) { - suite.Run(t, new(remotevlan.Suite)) -} - -func TestRunObservabilitySuiteSingle(t *testing.T) { - suite.Run(t, new(observability.Suite)) -} - -func TestK8sMonolithSuiteSingle(t *testing.T) { - suite.Run(t, new(k8s_monolith.Suite)) -} diff --git a/interdomain_test.go b/tests_interdomain/interdomain_test.go similarity index 98% rename from interdomain_test.go rename to tests_interdomain/interdomain_test.go index b2cd1a1cb..3013e7efe 100644 --- a/interdomain_test.go +++ b/tests_interdomain/interdomain_test.go @@ -16,7 +16,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package main +package interdomain import ( "testing" @@ -24,7 +24,6 @@ import ( "github.com/stretchr/testify/suite" "github.com/networkservicemesh/integration-tests/suites/floating_interdomain" - "github.com/networkservicemesh/integration-tests/suites/interdomain" ) diff --git a/tests_single/basic_test.go b/tests_single/basic_test.go new file mode 100644 index 000000000..473c81f02 --- /dev/null +++ b/tests_single/basic_test.go @@ -0,0 +1,29 @@ +// Copyright (c) 2022 Cisco and/or its affiliates. +// +// SPDX-License-Identifier: Apache-2.0 +// +// 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. + +package single + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/suites/basic" +) + +func TestRunBasicSuite(t *testing.T) { + suite.Run(t, new(basic.Suite)) +} diff --git a/calico_test.go b/tests_single/feature_test.go similarity index 63% rename from calico_test.go rename to tests_single/feature_test.go index 7eed3d3e3..938939611 100644 --- a/calico_test.go +++ b/tests_single/feature_test.go @@ -14,46 +14,29 @@ // See the License for the specific language governing permissions and // limitations under the License. -package main +package single import ( + "flag" "testing" "github.com/stretchr/testify/suite" - "github.com/networkservicemesh/integration-tests/suites/basic" "github.com/networkservicemesh/integration-tests/suites/features" - "github.com/networkservicemesh/integration-tests/suites/heal" - "github.com/networkservicemesh/integration-tests/suites/memory" - "github.com/networkservicemesh/integration-tests/suites/observability" ) -func TestRunHealSuiteCalico(t *testing.T) { - suite.Run(t, new(heal.Suite)) -} - -func TestRunBasicSuiteCalico(t *testing.T) { - suite.Run(t, new(basic.Suite)) -} - -func TestRunMemorySuiteCalico(t *testing.T) { - suite.Run(t, new(memory.Suite)) -} - -func TestRunObservabilitySuiteCalico(t *testing.T) { - suite.Run(t, new(observability.Suite)) -} +var calicoFlag = flag.Bool("calico", false, "selects calico tests") -// Disabled tests: +// Disabled tests for Calico-vpp: // TestMutually_aware_nses - https://github.com/networkservicemesh/integration-k8s-kind/issues/627 // TestNse_composition - https://github.com/networkservicemesh/integration-k8s-kind/issues/625 // TestVl3_basic - https://github.com/networkservicemesh/integration-k8s-kind/issues/633 // TestVl3_scale_from_zero - https://github.com/networkservicemesh/integration-k8s-kind/issues/633 -type featuresSuite struct { +type calicoFeatureSuite struct { features.Suite } -func (s *featuresSuite) BeforeTest(suiteName, testName string) { +func (s *calicoFeatureSuite) BeforeTest(suiteName, testName string) { switch testName { case "TestMutually_aware_nses", @@ -65,6 +48,10 @@ func (s *featuresSuite) BeforeTest(suiteName, testName string) { s.Suite.BeforeTest(suiteName, testName) } -func TestRunFeatureSuiteCalico(t *testing.T) { - suite.Run(t, new(featuresSuite)) +func TestRunFeatureSuite(t *testing.T) { + if *calicoFlag { + suite.Run(t, new(calicoFeatureSuite)) + } else { + suite.Run(t, new(features.Suite)) + } } diff --git a/tests_single/heal_test.go b/tests_single/heal_test.go new file mode 100644 index 000000000..58cf2fe06 --- /dev/null +++ b/tests_single/heal_test.go @@ -0,0 +1,29 @@ +// Copyright (c) 2022 Cisco and/or its affiliates. +// +// SPDX-License-Identifier: Apache-2.0 +// +// 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. + +package single + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/suites/heal" +) + +func TestRunHealSuite(t *testing.T) { + suite.Run(t, new(heal.Suite)) +} diff --git a/tests_single/k8s_monolith_test.go b/tests_single/k8s_monolith_test.go new file mode 100644 index 000000000..f9de34987 --- /dev/null +++ b/tests_single/k8s_monolith_test.go @@ -0,0 +1,29 @@ +// Copyright (c) 2022 Cisco and/or its affiliates. +// +// SPDX-License-Identifier: Apache-2.0 +// +// 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. + +package single + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/suites/k8s_monolith" +) + +func TestK8sMonolithSuite(t *testing.T) { + suite.Run(t, new(k8s_monolith.Suite)) +} diff --git a/tests_single/memory_test.go b/tests_single/memory_test.go new file mode 100644 index 000000000..966605b32 --- /dev/null +++ b/tests_single/memory_test.go @@ -0,0 +1,29 @@ +// Copyright (c) 2022 Cisco and/or its affiliates. +// +// SPDX-License-Identifier: Apache-2.0 +// +// 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. + +package single + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/suites/memory" +) + +func TestRunMemorySuite(t *testing.T) { + suite.Run(t, new(memory.Suite)) +} diff --git a/tests_single/observability_test.go b/tests_single/observability_test.go new file mode 100644 index 000000000..09e6967c1 --- /dev/null +++ b/tests_single/observability_test.go @@ -0,0 +1,29 @@ +// Copyright (c) 2022 Cisco and/or its affiliates. +// +// SPDX-License-Identifier: Apache-2.0 +// +// 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. + +package single + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/suites/observability" +) + +func TestRunObservabilitySuite(t *testing.T) { + suite.Run(t, new(observability.Suite)) +} diff --git a/tests_single/rvlan_test.go b/tests_single/rvlan_test.go new file mode 100644 index 000000000..5a3e5c970 --- /dev/null +++ b/tests_single/rvlan_test.go @@ -0,0 +1,29 @@ +// Copyright (c) 2022 Cisco and/or its affiliates. +// +// SPDX-License-Identifier: Apache-2.0 +// +// 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. + +package single + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/suites/remotevlan" +) + +func TestRunRvlanSuite(t *testing.T) { + suite.Run(t, new(remotevlan.Suite)) +}