From 6a174ab2eaff5544f6f0d9760d7d4e55220d87f0 Mon Sep 17 00:00:00 2001 From: ThreadDao Date: Tue, 9 Jul 2024 12:04:25 +0800 Subject: [PATCH 1/2] test: add dynamic case and upgrade gotestsum Signed-off-by: ThreadDao --- .github/workflows/nightly_ci.yml | 4 ++-- .github/workflows/test-ci.yaml | 4 ++-- test/testcases/collection_test.go | 31 +++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nightly_ci.yml b/.github/workflows/nightly_ci.yml index 110f43f9..d8bdf274 100644 --- a/.github/workflows/nightly_ci.yml +++ b/.github/workflows/nightly_ci.yml @@ -132,7 +132,7 @@ jobs: run: | nc -vz 127.0.0.1 19530 curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v1.8.2/gotestsum_1.8.2_linux_amd64.tar.gz" | sudo tar -xz -C /usr/local/bin gotestsum - gotestsum --format testname --hide-summary=output ./testcases/... --tags L0,L1,L2,L3 --addr=127.0.0.1:19530 -timeout=60m + gotestsum --format testname --hide-summary=output --rerun-fails=2 ./testcases/... --tags L0,L1,L2,L3 --addr=127.0.0.1:19530 -timeout=60m nightly-v2_2_x: name: Run Nightly CI(v2.2.x) @@ -191,5 +191,5 @@ jobs: working-directory: test/ run: | nc -vz 127.0.0.1 19530 - curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v1.8.2/gotestsum_1.8.2_linux_amd64.tar.gz" | sudo tar -xz -C /usr/local/bin gotestsum + curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v1.12.0/gotestsum_1.12.0_linux_amd64.tar.gz" | sudo tar -xz -C /usr/local/bin gotestsum gotestsum --format testname --hide-summary=output ./testcases/... --tags L0,L1,L2,L3 --addr=127.0.0.1:19530 -timeout=60m diff --git a/.github/workflows/test-ci.yaml b/.github/workflows/test-ci.yaml index cb841f9b..9d7da879 100644 --- a/.github/workflows/test-ci.yaml +++ b/.github/workflows/test-ci.yaml @@ -74,8 +74,8 @@ jobs: working-directory: test/ run: | nc -vz 127.0.0.1 19530 - curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v1.8.2/gotestsum_1.8.2_linux_amd64.tar.gz" | sudo tar -xz -C /usr/local/bin gotestsum - gotestsum --format testname --hide-summary=output ./testcases/... --tags L0 --addr=127.0.0.1:19530 -timeout=60m + curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v1.12.0/gotestsum_1.12.0_linux_amd64.tar.gz" | sudo tar -xz -C /usr/local/bin gotestsum + gotestsum --format testname --hide-summary=output --rerun-fails=2 ./testcases/... --tags L0 --addr=127.0.0.1:19530 -timeout=60m - name: Export logs if: ${{ !success() }} diff --git a/test/testcases/collection_test.go b/test/testcases/collection_test.go index 7111055c..f962836e 100644 --- a/test/testcases/collection_test.go +++ b/test/testcases/collection_test.go @@ -497,6 +497,37 @@ func TestCreateCollectionDynamicSchema(t *testing.T) { common.CheckErr(t, err, true) } +// test create collection enable dynamic field +func TestCreateCollectionDynamicSchemaOption(t *testing.T) { + ctx := createContext(t, time.Second*common.DefaultTimeout) + mc := createMilvusClient(ctx, t) + for _, enableDynamic := range [2]bool{true, false} { + collName := common.GenRandomString(6) + schema := entity.NewSchema().WithName(collName).WithDynamicFieldEnabled(enableDynamic) + for _, f := range common.GenDefaultFields(false) { + schema.WithField(f) + } + err := mc.CreateCollection(ctx, schema, common.DefaultShards, client.WithEnableDynamicSchema(!enableDynamic)) + common.CheckErr(t, err, true) + + // check describe collection + collection, _ := mc.DescribeCollection(ctx, collName) + common.CheckCollection(t, collection, collName, common.DefaultShards, schema, common.DefaultConsistencyLevel) + require.Truef(t, collection.Schema.EnableDynamicField, "Expected collection.Schema.EnableDynamicField is True") + + // check collName in ListCollections + collections, errListCollection := mc.ListCollections(ctx) + common.CheckErr(t, errListCollection, true) + common.CheckContainsCollection(t, collections, collName) + + // insert data + dp := DataParams{CollectionName: collName, PartitionName: "", CollectionFieldsType: Int64FloatVec, + start: 0, nb: common.DefaultNb, dim: common.DefaultDim, EnableDynamicField: true, WithRows: false} + _, err = insertData(ctx, t, mc, dp) + common.CheckErr(t, err, true) + } +} + // test create collection enable dynamic field by collection opt func TestCreateCollectionDynamic(t *testing.T) { ctx := createContext(t, time.Second*common.DefaultTimeout) From 88ecd22ef71752738d13087be6b4aa69547c9cae Mon Sep 17 00:00:00 2001 From: ThreadDao Date: Tue, 9 Jul 2024 17:09:21 +0800 Subject: [PATCH 2/2] fix: obtained an gpu tag Signed-off-by: ThreadDao --- .github/workflows/nightly_ci.yml | 15 ++++++++------- .github/workflows/test-ci.yaml | 7 +++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/nightly_ci.yml b/.github/workflows/nightly_ci.yml index d8bdf274..d0021fc1 100644 --- a/.github/workflows/nightly_ci.yml +++ b/.github/workflows/nightly_ci.yml @@ -37,9 +37,9 @@ jobs: working-directory: ci/scripts run: | url="https://registry.hub.docker.com/v2/repositories/$IMAGE_REPO/tags?page=1&name=$TAG_PREFIX" - echo "IMAGE_TAG=$(curl -s $url | jq -r '."results"[]["name"] | select(test("amd64$"))' | head -n 1)" >> $GITHUB_ENV + echo "IMAGE_TAG=$(curl -s $url | jq --arg TAG_PREFIX "$TAG_PREFIX" -r '."results"[] | select(.images[].architecture == "amd64" and (.name | contains("gpu") | not) and (.name | startswith($TAG_PREFIX))) | .name' | head -n 1)" >> $GITHUB_ENV # echo "IMAGE_TAG=$(./docker_image_find_tag.sh -n ${IMAGE_REPO} -t ${TAG_PREFIX}latest -f ${TAG_PREFIX} -F -L -q)" >> $GITHUB_ENV - # echo "::set-output name=tag::$(./docker_image_find_tag.sh -n ${IMAGE_REPO}/milvus-dev -t ${TAG_PREFIX}latest -f ${TAG_PREFIX} -F -L -q)" +# echo "::set-output name=tag::$(./docker_image_find_tag.sh -n ${IMAGE_REPO}/milvus-dev -t ${TAG_PREFIX}latest -f ${TAG_PREFIX} -F -L -q)" - name: Create cluster uses: helm/kind-action@v1.3.0 @@ -97,9 +97,10 @@ jobs: working-directory: ci/scripts run: | url="https://registry.hub.docker.com/v2/repositories/$IMAGE_REPO/tags?page=1&name=$TAG_PREFIX" - echo "IMAGE_TAG=$(curl -s $url | jq -r '."results"[]["name"] | select(test("amd64$"))' | head -n 1)" >> $GITHUB_ENV + echo "IMAGE_TAG=$(curl -s $url | jq --arg TAG_PREFIX "$TAG_PREFIX" -r '."results"[] | select(.images[].architecture == "amd64" and (.name | contains("gpu") | not) and (.name | startswith($TAG_PREFIX))) | .name' | head -n 1)" >> $GITHUB_ENV +# echo "IMAGE_TAG=$(curl -s $url | jq -r '."results"[]["name"] | select(test("amd64$"))' | head -n 1)" >> $GITHUB_ENV # echo "IMAGE_TAG=$(./docker_image_find_tag.sh -n ${IMAGE_REPO} -t ${TAG_PREFIX}latest -f ${TAG_PREFIX} -F -L -q)" >> $GITHUB_ENV - # echo "::set-output name=tag::$(./docker_image_find_tag.sh -n ${IMAGE_REPO}/milvus-dev -t ${TAG_PREFIX}latest -f ${TAG_PREFIX} -F -L -q)" +# echo "::set-output name=tag::$(./docker_image_find_tag.sh -n ${IMAGE_REPO}/milvus-dev -t ${TAG_PREFIX}latest -f ${TAG_PREFIX} -F -L -q)" - name: Create cluster uses: helm/kind-action@v1.3.0 @@ -132,7 +133,7 @@ jobs: run: | nc -vz 127.0.0.1 19530 curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v1.8.2/gotestsum_1.8.2_linux_amd64.tar.gz" | sudo tar -xz -C /usr/local/bin gotestsum - gotestsum --format testname --hide-summary=output --rerun-fails=2 ./testcases/... --tags L0,L1,L2,L3 --addr=127.0.0.1:19530 -timeout=60m + gotestsum --format testname --hide-summary=output ./testcases/... --tags L0,L1,L2,L3 --addr=127.0.0.1:19530 -timeout=60m nightly-v2_2_x: name: Run Nightly CI(v2.2.x) @@ -157,9 +158,9 @@ jobs: working-directory: ci/scripts run: | url="https://registry.hub.docker.com/v2/repositories/$IMAGE_REPO/tags?page=1&name=$TAG_PREFIX" - echo "IMAGE_TAG=$(curl -s $url | jq -r '."results"[]["name"] | select(test("amd64$"))' | head -n 1)" >> $GITHUB_ENV + echo "IMAGE_TAG=$(curl -s $url | jq --arg TAG_PREFIX "$TAG_PREFIX" -r '."results"[] | select(.images[].architecture == "amd64" and (.name | contains("gpu") | not) and (.name | startswith($TAG_PREFIX))) | .name' | head -n 1)" >> $GITHUB_ENV # echo "IMAGE_TAG=$(./docker_image_find_tag.sh -n ${IMAGE_REPO} -t ${TAG_PREFIX}latest -f ${TAG_PREFIX} -F -L -q)" >> $GITHUB_ENV - # echo "::set-output name=tag::$(./docker_image_find_tag.sh -n ${IMAGE_REPO}/milvus-dev -t ${TAG_PREFIX}latest -f ${TAG_PREFIX} -F -L -q)" +# echo "::set-output name=tag::$(./docker_image_find_tag.sh -n ${IMAGE_REPO}/milvus-dev -t ${TAG_PREFIX}latest -f ${TAG_PREFIX} -F -L -q)" - name: Create cluster uses: helm/kind-action@v1.3.0 diff --git a/.github/workflows/test-ci.yaml b/.github/workflows/test-ci.yaml index 9d7da879..4ae775d5 100644 --- a/.github/workflows/test-ci.yaml +++ b/.github/workflows/test-ci.yaml @@ -37,8 +37,7 @@ jobs: working-directory: ci/scripts run: | url="https://registry.hub.docker.com/v2/repositories/$IMAGE_REPO/tags?page=1&name=$TAG_PREFIX" - echo "IMAGE_TAG=$(curl -s $url | jq -r '."results"[]["name"]' | head -n 1)" >> $GITHUB_ENV -# echo "IMAGE_TAG=$(curl -s $url | jq -r '."results"[]["name"] | select(test("amd64$"))' | head -n 1)" >> $GITHUB_ENV + echo "IMAGE_TAG=$(curl -s $url | jq --arg TAG_PREFIX "$TAG_PREFIX" -r '."results"[] | select(.images[].architecture == "amd64" and (.name | contains("gpu") | not) and (.name | startswith($TAG_PREFIX))) | .name' | head -n 1)" >> $GITHUB_ENV # echo "IMAGE_TAG=$(./docker_image_find_tag.sh -n ${IMAGE_REPO} -t ${TAG_PREFIX}latest -f ${TAG_PREFIX} -F -L -q)" >> $GITHUB_ENV # export IMAGE_TAG=$IMAGE_TAG # export IMAGE_REPO=$IMAGE_REPO @@ -71,11 +70,11 @@ jobs: - name: Run Ci Test shell: bash - working-directory: test/ + working-directory: test/testcases run: | nc -vz 127.0.0.1 19530 curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v1.12.0/gotestsum_1.12.0_linux_amd64.tar.gz" | sudo tar -xz -C /usr/local/bin gotestsum - gotestsum --format testname --hide-summary=output --rerun-fails=2 ./testcases/... --tags L0 --addr=127.0.0.1:19530 -timeout=60m + gotestsum --format testname --hide-summary=output --rerun-fails=3 --packages=./testcases -- -tags L0 -addr=127.0.0.1:19530 -timeout=60m - name: Export logs if: ${{ !success() }}