From ace7c3633d22f32165ea658c01d3b084b8c270b8 Mon Sep 17 00:00:00 2001 From: Yan Song Date: Thu, 2 Nov 2023 01:53:07 +0000 Subject: [PATCH] smoke: fix stable version for compatibility test And let's make stable version name as a env. Signed-off-by: Yan Song --- .github/workflows/smoke.yml | 10 ++++++---- smoke/Makefile | 8 +++++--- smoke/tests/compatibility_test.go | 10 +++++++--- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 8f017083311..5a0cf852060 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -16,6 +16,8 @@ env: CARGO_TERM_COLOR: always IMAGE: wordpress TAG: 6.1.1 + NYDUS_STABLE_VERSION: v2.2.3 + NYDUS_STABLE_VERSION_EXPORT: v2_2_3 jobs: contrib-build: @@ -149,8 +151,8 @@ jobs: - name: Prepare Older Binaries id: prepare-binaries run: | - versions=(v0.1.0 v2.2.3) - version_archs=(v0.1.0-x86_64 v2.2.3-linux-amd64) + versions=(v0.1.0 ${{env.NYDUS_STABLE_VERSION}}) + version_archs=(v0.1.0-x86_64 ${{env.NYDUS_STABLE_VERSION}}-linux-amd64) for i in ${!versions[@]}; do version=${versions[$i]} version_arch=${version_archs[$i]} @@ -175,8 +177,8 @@ jobs: sudo install -D -m 755 contrib/nydusify/cmd/nydusify /usr/bin/nydus-latest sudo install -D -m 755 target/release/nydusd target/release/nydus-image /usr/bin/nydus-latest - versions=(v0.1.0 v2.2.3 latest) - version_exports=(v0_1_0 v2_2_3 latest) + versions=(v0.1.0 ${{env.NYDUS_STABLE_VERSION}} latest) + version_exports=(v0_1_0 ${{env.NYDUS_STABLE_VERSION_EXPORT}} latest) for i in ${!version_exports[@]}; do version=${versions[$i]} version_export=${version_exports[$i]} diff --git a/smoke/Makefile b/smoke/Makefile index 96260e5c8d4..f8b12f531c7 100644 --- a/smoke/Makefile +++ b/smoke/Makefile @@ -18,15 +18,17 @@ test: build sudo -E ./smoke.test -test.v -test.timeout 10m -test.parallel=16 -test.run=$(TESTS) # WORK_DIR=/tmp \ +# NYDUS_STABLE_VERSION=v2.2.3 \ +# NYDUS_STABLE_VERSION_EXPORT=v2_2_3 \ # NYDUS_BUILDER=/path/to/latest/nydus-image \ # NYDUS_NYDUSD=/path/to/latest/nydusd \ # NYDUS_NYDUSIFY=/path/to/latest/nydusify \ # NYDUS_BUILDER_v0_1_0=/path/to/v0.1.0/nydus-image \ # NYDUS_NYDUSD_v0_1_0=/path/to/v0.1.0/nydusd \ # NYDUS_NYDUSIFY_v0_1_0=/path/to/v0.1.0/nydusify \ -# NYDUS_BUILDER_v2_1_4=/path/to/v2.1.4/nydus-image \ -# NYDUS_NYDUSD_v2_1_4=/path/to/v2.1.4/nydusd \ -# NYDUS_NYDUSIFY_v2_1_4=/path/to/v2.1.4/nydusify \ +# NYDUS_BUILDER_$NYDUS_STABLE_VERSION_EXPORT=/path/to/$NYDUS_STABLE_VERSION/nydus-image \ +# NYDUS_NYDUSD_$NYDUS_STABLE_VERSION_EXPORT=/path/to/$NYDUS_STABLE_VERSION/nydusd \ +# NYDUS_NYDUSIFY_$NYDUS_STABLE_VERSION_EXPORT=/path/to/$NYDUS_STABLE_VERSION/nydusify \ # make test TESTS=TestCompatibility test-compatibility: build make test TESTS=TestCompatibility diff --git a/smoke/tests/compatibility_test.go b/smoke/tests/compatibility_test.go index b2ca6817bb6..a757af9b528 100644 --- a/smoke/tests/compatibility_test.go +++ b/smoke/tests/compatibility_test.go @@ -5,10 +5,12 @@ package tests import ( + "os" "testing" "github.com/dragonflyoss/image-service/smoke/tests/tool" "github.com/dragonflyoss/image-service/smoke/tests/tool/test" + "github.com/stretchr/testify/require" ) const ( @@ -24,14 +26,16 @@ type CompatibilityTestSuite struct { } func (c *CompatibilityTestSuite) TestConvertImages() test.Generator { + stableVersion := os.Getenv("NYDUS_STABLE_VERSION") + require.NotEmpty(c.t, stableVersion, "please specify env `NYDUS_STABLE_VERSION` to run the compatibility test.") scenarios := tool.DescartesIterator{} scenarios. Dimension(paramImage, []interface{}{"nginx:latest"}). Dimension(paramFSVersion, []interface{}{"5", "6"}). - Dimension(paramNydusImageVersion, []interface{}{"v0.1.0", "v2.1.6", "latest"}). - Dimension(paramNydusifyVersion, []interface{}{"v0.1.0", "v2.1.6", "latest"}). - Dimension(paramNydusdVersion, []interface{}{"v0.1.0", "v2.1.6", "latest"}). + Dimension(paramNydusImageVersion, []interface{}{"v0.1.0", stableVersion, "latest"}). + Dimension(paramNydusifyVersion, []interface{}{"v0.1.0", stableVersion, "latest"}). + Dimension(paramNydusdVersion, []interface{}{"v0.1.0", stableVersion, "latest"}). Skip(func(param *tool.DescartesItem) bool { // Nydus-image 0.1.0 only works with nydus-nydusify 0.1.0, vice versa.