Skip to content

Commit

Permalink
fixed UT,E2E and go_client
Browse files Browse the repository at this point in the history
Signed-off-by: Nischay <[email protected]>
  • Loading branch information
nish112022 committed Nov 3, 2024
1 parent 086c27c commit eae8474
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/rootcoord/drop_collection_task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func Test_dropCollectionTask_Execute(t *testing.T) {
},
}
err := task.Execute(context.Background())
assert.NoError(t, err)
assert.Equal(t, merr.ErrCollectionNotFound, err)
task.Req.CollectionName = collectionName + "_test"
err = task.Execute(context.Background())
assert.Error(t, err)
Expand Down
3 changes: 2 additions & 1 deletion internal/rootcoord/drop_partition_task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/milvus-io/milvus/internal/metastore/model"
mockrootcoord "github.com/milvus-io/milvus/internal/rootcoord/mocks"
"github.com/milvus-io/milvus/pkg/util/funcutil"
"github.com/milvus-io/milvus/pkg/util/merr"
)

func Test_dropPartitionTask_Prepare(t *testing.T) {
Expand Down Expand Up @@ -105,7 +106,7 @@ func Test_dropPartitionTask_Execute(t *testing.T) {
collMeta: coll.Clone(),
}
err := task.Execute(context.Background())
assert.NoError(t, err)
assert.Equal(t, merr.ErrPartitionNotFound, err)
})

t.Run("failed to expire cache", func(t *testing.T) {
Expand Down
5 changes: 4 additions & 1 deletion tests/go_client/testcases/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ func teardownTest(t *testing.T) func(t *testing.T) {
_ = mc.UsingDatabase(ctx, client.NewUsingDatabaseOption(db))
collections, _ := mc.ListCollections(ctx, client.NewListCollectionOption())
for _, coll := range collections {
_ = mc.DropCollection(ctx, client.NewDropCollectionOption(coll))
exists, err := mc.HasCollection(ctx, client.NewHasCollectionOption(coll))
if err == nil {
_ = mc.DropCollection(ctx, client.NewDropCollectionOption(coll))
}
}
_ = mc.DropDatabase(ctx, client.NewDropDatabaseOption(db))
}
Expand Down
4 changes: 2 additions & 2 deletions tests/go_client/testcases/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ func TestIndexNotExistName(t *testing.T) {

// drop index with not exist field name
errDrop := mc.DropIndex(ctx, client.NewDropIndexOption(schema.CollectionName, "aaa"))
common.CheckErr(t, errDrop, true)
common.CheckErr(t, errDrop, false, "index not found")
}

// test create float / binary / sparse vector index on non-vector field
Expand Down Expand Up @@ -1117,7 +1117,7 @@ func TestDropIndex(t *testing.T) {

// drop index with field name
errDrop := mc.DropIndex(ctx, client.NewDropIndexOption(schema.CollectionName, common.DefaultFloatVecFieldName))
common.CheckErr(t, errDrop, true)
common.CheckErr(t, errDrop, false, "index not found")
descIdx, err = mc.DescribeIndex(ctx, client.NewDescribeIndexOption(schema.CollectionName, idxName))
common.CheckErr(t, err, true)
common.CheckIndex(t, descIdx, index.NewGenericIndex(idxName, idx.Params()), common.TNewCheckIndexOpt(common.DefaultNb))
Expand Down
2 changes: 1 addition & 1 deletion tests/go_client/testcases/partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func TestDropPartitionInvalid(t *testing.T) {
common.CheckErr(t, errDrop, false, "collection not found")

errDrop1 := mc.DropPartition(ctx, client.NewDropPartitionOption(schema.CollectionName, "aaa"))
common.CheckErr(t, errDrop1, true)
common.CheckErr(t, errDrop, false, "partition not found")

err := mc.DropPartition(ctx, client.NewDropPartitionOption(schema.CollectionName, common.DefaultPartition))
common.CheckErr(t, err, false, "default partition cannot be deleted")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ def test_drop_collections_with_invalid_collection_name(self):
"collectionName": invalid_name,
}
rsp = client.collection_drop(payload)
assert rsp['code'] == 0
assert rsp['code'] == 100


@pytest.mark.L0
Expand Down

0 comments on commit eae8474

Please sign in to comment.