@@ -47,6 +47,53 @@ func (s *GatewayOpsTestSuite) TestQueryManagement() {
4747 }
4848
4949 s .Run ("PrimaryIndex" , func () {
50+ s .Run ("CreateAndDropWithUnsetName" , func () {
51+ creds := s .basicRpcCreds
52+
53+ // First let's attempt a drop in case the primary index exists already
54+ {
55+ resp , err := queryAdminClient .DropPrimaryIndex (context .Background (),
56+ & admin_query_v1.DropPrimaryIndexRequest {
57+ Name : nil ,
58+ BucketName : s .bucketName ,
59+ ScopeName : & s .scopeName ,
60+ CollectionName : & s .collectionName ,
61+ IgnoreIfMissing : & trueBool ,
62+ },
63+ grpc .PerRPCCredentials (creds ))
64+
65+ requireRpcSuccess (s .T (), resp , err )
66+ }
67+
68+ // Create the index
69+ {
70+ resp , err := queryAdminClient .CreatePrimaryIndex (context .Background (),
71+ & admin_query_v1.CreatePrimaryIndexRequest {
72+ BucketName : s .bucketName ,
73+ Name : nil ,
74+ ScopeName : & s .scopeName ,
75+ CollectionName : & s .collectionName ,
76+ },
77+ grpc .PerRPCCredentials (creds ))
78+
79+ requireRpcSuccess (s .T (), resp , err )
80+ }
81+
82+ // Drop it again, this time without IgnoreIfMissing, it must exist.
83+ {
84+ resp , err := queryAdminClient .DropPrimaryIndex (context .Background (),
85+ & admin_query_v1.DropPrimaryIndexRequest {
86+ Name : nil ,
87+ BucketName : s .bucketName ,
88+ ScopeName : & s .scopeName ,
89+ CollectionName : & s .collectionName ,
90+ },
91+ grpc .PerRPCCredentials (creds ))
92+
93+ requireRpcSuccess (s .T (), resp , err )
94+ }
95+ })
96+
5097 indexName := uuid .NewString ()
5198
5299 s .Run ("Create" , func () {
0 commit comments