From a0b1fc8f07827b85ffa86d84647618449fdeb8b4 Mon Sep 17 00:00:00 2001 From: Artem Glazychev Date: Fri, 1 Mar 2024 13:26:27 +0700 Subject: [PATCH] Add arm64 for release builds Signed-off-by: Artem Glazychev --- .github/workflows/ci.yaml | 69 ++++++++++++++++++++++++++--------- go.mod | 2 + go.sum | 4 +- scripts/setup-cluster.sh | 6 ++- tests_default/feature_test.go | 28 ++++++++++++++ tests_default/heal_test.go | 29 +++++++++++++++ tests_default/main_test.go | 35 +++++------------- tests_default/observ_test.go | 29 +++++++++++++++ tests_default/sriov_test.go | 34 +++++++++++++++++ 9 files changed, 189 insertions(+), 47 deletions(-) create mode 100644 tests_default/feature_test.go create mode 100644 tests_default/heal_test.go create mode 100644 tests_default/observ_test.go create mode 100644 tests_default/sriov_test.go diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6fb48cb..7f9a382 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,7 +4,7 @@ on: pull_request: push: branches: - - 'release/**' + - 'arm64' concurrency: group: '${{ github.ref_name }}' @@ -26,13 +26,35 @@ jobs: checkgomod: uses: networkservicemesh/.github/.github/workflows/checkgomod.yaml@main + make-matrix: + name: make a matrix + runs-on: ubuntu-latest + # Map a step output to a job output + outputs: + matrix: ${{ steps.make-matrix.outputs.matrix }} + steps: + - id: make-matrix + run: | + if ${{ startsWith(github.ref_name, 'arm64') }}; then + echo "matrix={\"config\":[ \ + {\"node_type\":\"n3.xlarge.x86\",\"CNI\":\"default\"}, \ + {\"node_type\":\"n3.xlarge.x86\",\"CNI\":\"calico-vpp\"}, \ + {\"node_type\":\"c3.large.arm64\",\"CNI\":\"default\"} \ + ]}" >> $GITHUB_OUTPUT + else + echo "matrix={\"config\":[ \ + {\"node_type\":\"n3.xlarge.x86\",\"CNI\":\"default\"}, \ + {\"node_type\":\"n3.xlarge.x86\",\"CNI\":\"calico-vpp\"} \ + ]}" >> $GITHUB_OUTPUT + fi + packet: - name: packet (CNI ${{ matrix.CNI }}) + name: ${{ matrix.config.node_type }} (CNI ${{ matrix.config.CNI }}) runs-on: ubuntu-latest + needs: make-matrix strategy: fail-fast: false - matrix: - CNI: ["default", "calico-vpp"] + matrix: ${{ fromJSON(needs.make-matrix.outputs.matrix) }} steps: - name: Set up /bin permissions run: | @@ -47,20 +69,31 @@ jobs: - name: Set envs run: | - id=${{ matrix.CNI }}-${{ github.run_number }} - if [[ "${{ matrix.CNI }}" == "calico-vpp" ]]; then - id=calico-${{ github.run_number }} + # Set SRIOV_ENABLED + echo SRIOV_ENABLED=true >> $GITHUB_ENV + if [[ "${{ matrix.config.node_type }}" != "n3.xlarge.x86" ]]; then + echo SRIOV_ENABLED=false >> $GITHUB_ENV + fi + + # Set CLUSTER_NAME and SSH_KEY + node_type=${{ matrix.config.node_type }} + id=${node_type:0:2}-${{ github.run_number }} + if [[ "${{ matrix.config.CNI }}" == "calico-vpp" ]]; then + id=c-${id} fi echo CLUSTER_NAME=nsm-ci-${id} >> $GITHUB_ENV echo SSH_KEY=nsm-ssh-${id} >> $GITHUB_ENV + # Checking server availability by metro and node_type - name: Find metro run: | metros_to_check=da,ny if [[ "${{ matrix.CNI }}" == "calico-vpp" ]]; then metros_to_check=at,ch + elif [[ "${{ matrix.config.node_type }}" == "c3.large.arm64" ]]; then + metros_to_check=dc,da fi - METRO=$(metal capacity check -m ${metros_to_check} -P n3.xlarge.x86 -q 2 -o json | jq -r '[.[] | select( .available == true ) | .metro][0]') + METRO=$(metal capacity check -m ${metros_to_check} -P "${{ matrix.config.node_type }}" -q 2 -o json | jq -r '[.[] | select( .available == true ) | .metro][0]') if [ ${METRO} == "null" ]; then exit 1; fi @@ -111,7 +144,7 @@ jobs: - name: Setup cluster uses: nick-fields/retry@v2.8.3 with: - timeout_minutes: 50 + timeout_minutes: 60 max_attempts: 3 command: | cd ${{ github.repository }} @@ -127,17 +160,19 @@ jobs: PROJECT_ID: 383890d0-f5d1-4de1-881a-4d1ede549d18 NODE_OS: ubuntu_20_04 KUBERNETES_VERSION: "v1.27.1" - CNI: ${{ matrix.CNI }} - CONTROLPLANE_NODE_TYPE: "n3.xlarge.x86" - WORKER_NODE_TYPE: "n3.xlarge.x86" + CNI: ${{ matrix.config.CNI }} + CONTROLPLANE_NODE_TYPE: ${{ matrix.config.node_type }} + WORKER_NODE_TYPE: ${{ matrix.config.node_type }} - name: Integration tests run: | export KUBECONFIG=$HOME/.kube/config_packet - if [[ "${{ matrix.CNI }}" == "calico-vpp" ]]; then - go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.CNI }} -parallel 4 || true + if [[ "${{ matrix.config.CNI }}" == "calico-vpp" ]]; then + go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.config.CNI }} -parallel 4 || true + elif [ "${SRIOV_ENABLED}" == true ]; then + go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.config.CNI }} -parallel 4 else - go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.CNI }} -parallel 4 + go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.config.CNI }}/main_test.go -parallel 4 fi env: ARTIFACTS_DIR: logs @@ -147,8 +182,8 @@ jobs: uses: actions/upload-artifact@v2 if: ${{ always() }} with: - name: ${{ matrix.CNI }}-logs - path: ${{ github.repository }}/tests_${{ matrix.CNI }}/logs + name: ${{ matrix.config.node_type }}-${{ matrix.config.CNI }}-logs + path: ${{ github.repository }}/tests_${{ matrix.config.node_type }}_${{ matrix.config.CNI }}/logs - name: Cleanup if: ${{ always() }} diff --git a/go.mod b/go.mod index dc55c1e..4b73dc9 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,8 @@ require ( github.com/stretchr/testify v1.8.4 ) +replace github.com/networkservicemesh/integration-tests => github.com/glazychev-art/integration-tests v0.0.0-20240307082408-d9e63fcedcb7 + require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/google/uuid v1.3.0 // indirect diff --git a/go.sum b/go.sum index b451ace..a9d6908 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/glazychev-art/integration-tests v0.0.0-20240307082408-d9e63fcedcb7 h1:nOnyuvidkvllUETkgg6kWZMXgSh2ueJN8wxTejjCB6w= +github.com/glazychev-art/integration-tests v0.0.0-20240307082408-d9e63fcedcb7/go.mod h1:WLpOEldvahZQkJSdU3kspIS4tB1x1hDnWP08B/nCTjM= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= @@ -14,8 +16,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/networkservicemesh/gotestmd v0.0.0-20220628095933-eabbdc09e0dc h1:1L/OisEFsOyhwaqeJpYmM1nlJ2dBusUMiszPDBlUip0= github.com/networkservicemesh/gotestmd v0.0.0-20220628095933-eabbdc09e0dc/go.mod h1:8EWnekTRNX+NxBdTFE24WqUoM7SgJHbiafDBrIIdOmQ= -github.com/networkservicemesh/integration-tests v0.0.0-20240214100638-cb08e79b30fb h1:1Z/rGrtqBRLhAqj8dhx71hChCdBPxRb0gzMgfUfgUP8= -github.com/networkservicemesh/integration-tests v0.0.0-20240214100638-cb08e79b30fb/go.mod h1:WLpOEldvahZQkJSdU3kspIS4tB1x1hDnWP08B/nCTjM= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/scripts/setup-cluster.sh b/scripts/setup-cluster.sh index a523b83..17ad4d0 100755 --- a/scripts/setup-cluster.sh +++ b/scripts/setup-cluster.sh @@ -57,7 +57,7 @@ done # Wait for packet servers to be ready sleep 30s -kubectl wait --timeout=30m --for=condition=Ready=true packetmachine -l cluster.x-k8s.io/cluster-name=${CLUSTER_NAME} +kubectl wait --timeout=50m --for=condition=Ready=true packetmachine -l cluster.x-k8s.io/cluster-name=${CLUSTER_NAME} result=$? if [ $result -ne 0 ]; then clusterctl describe cluster ${CLUSTER_NAME} --echo @@ -96,7 +96,9 @@ for i in {1..30}; do done ## Setup SR-IOV -/bin/bash scripts/sriov/setup-SRIOV.sh "${master_node}" "${master_ip}" "${worker_node}" "${worker_ip}" "${sriov_vlan}" "${enable8021q}" "${SSH_OPTS}" || exit 12 +if [ "$SRIOV_ENABLED" == true ]; then + /bin/bash scripts/sriov/setup-SRIOV.sh "${master_node}" "${master_ip}" "${worker_node}" "${worker_ip}" "${sriov_vlan}" "${enable8021q}" "${SSH_OPTS}" || exit 12 +fi ## Remove master label from the control-plane node to be able to use it as worker node # For some versions of kubernetes you need to use node-role.kubernetes.io/master- diff --git a/tests_default/feature_test.go b/tests_default/feature_test.go new file mode 100644 index 0000000..3804821 --- /dev/null +++ b/tests_default/feature_test.go @@ -0,0 +1,28 @@ +// Copyright (c) 2024 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_test + +import ( + "testing" + + "github.com/networkservicemesh/integration-tests/extensions/parallel" + "github.com/networkservicemesh/integration-tests/suites/features" +) + +func TestFeatureSuite(t *testing.T) { + parallel.Run(t, new(features.Suite), "TestVl3_basic", "TestVl3_dns", "TestVl3_lb", "TestVl3_scale_from_zero", "TestScale_from_zero", "TestSelect_forwarder") +} diff --git a/tests_default/heal_test.go b/tests_default/heal_test.go new file mode 100644 index 0000000..af2eaa6 --- /dev/null +++ b/tests_default/heal_test.go @@ -0,0 +1,29 @@ +// Copyright (c) 2024 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_test + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/suites/heal" +) + +func TestHeal(t *testing.T) { + suite.Run(t, new(heal.Suite)) +} diff --git a/tests_default/main_test.go b/tests_default/main_test.go index 7adce8c..3d34de8 100644 --- a/tests_default/main_test.go +++ b/tests_default/main_test.go @@ -1,6 +1,6 @@ // Copyright (c) 2020-2022 Doc.ai and/or its affiliates. // -// Copyright (c) 2023 Cisco and/or its affiliates. +// Copyright (c) 2023-2024 Cisco and/or its affiliates. // // SPDX-License-Identifier: Apache-2.0 // @@ -21,37 +21,20 @@ package main_test import ( "testing" - "github.com/stretchr/testify/suite" - "github.com/networkservicemesh/integration-tests/extensions/parallel" - "github.com/networkservicemesh/integration-tests/suites/features" - "github.com/networkservicemesh/integration-tests/suites/heal" + "github.com/networkservicemesh/integration-tests/suites/basic" + "github.com/networkservicemesh/integration-tests/suites/ipsec_mechanism" "github.com/networkservicemesh/integration-tests/suites/memory" - "github.com/networkservicemesh/integration-tests/suites/multiforwarder_vlantag" - "github.com/networkservicemesh/integration-tests/suites/observability" - "github.com/networkservicemesh/integration-tests/suites/sriov_vlantag" ) -func TestMemory(t *testing.T) { - parallel.Run(t, new(memory.Suite)) -} - -func TestSRIOV_VlanTag(t *testing.T) { - suite.Run(t, new(sriov_vlantag.Suite)) +func TestBasic(t *testing.T) { + parallel.Run(t, new(basic.Suite)) } -func TestMultiForwarder_VlanTag(t *testing.T) { - suite.Run(t, new(multiforwarder_vlantag.Suite)) -} - -func TestHeal(t *testing.T) { - suite.Run(t, new(heal.Suite)) -} - -func TestRunObservabilitySuite(t *testing.T) { - suite.Run(t, new(observability.Suite)) +func TestMemory(t *testing.T) { + parallel.Run(t, new(memory.Suite)) } -func TestFeatureSuite(t *testing.T) { - parallel.Run(t, new(features.Suite), "TestVl3_basic", "TestVl3_dns", "TestScale_from_zero", "TestVl3_scale_from_zero", "TestSelect_forwarder") +func TestIPSec(t *testing.T) { + parallel.Run(t, new(ipsec_mechanism.Suite)) } diff --git a/tests_default/observ_test.go b/tests_default/observ_test.go new file mode 100644 index 0000000..ec94386 --- /dev/null +++ b/tests_default/observ_test.go @@ -0,0 +1,29 @@ +// Copyright (c) 2024 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_test + +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_default/sriov_test.go b/tests_default/sriov_test.go new file mode 100644 index 0000000..72c345c --- /dev/null +++ b/tests_default/sriov_test.go @@ -0,0 +1,34 @@ +// Copyright (c) 2024 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_test + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/suites/multiforwarder_vlantag" + "github.com/networkservicemesh/integration-tests/suites/sriov_vlantag" +) + +func TestSRIOV_VlanTag(t *testing.T) { + suite.Run(t, new(sriov_vlantag.Suite)) +} + +func TestMultiForwarder_VlanTag(t *testing.T) { + suite.Run(t, new(multiforwarder_vlantag.Suite)) +}