Skip to content

Commit

Permalink
PR(TEST): Fix dropIndex testing setup
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzadlone committed Sep 25, 2024
1 parent 5fe45cf commit 0297e77
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions tests/integration/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -1764,21 +1764,38 @@ func dropIndex(
action DropIndex,
) {
var expectedErrorRaised bool
actionNodes := getNodes(action.NodeID, s.nodes)
for nodeID, collections := range getNodeCollections(action.NodeID, s.collections) {

if action.NodeID.HasValue() {
nodeID := action.NodeID.Value()
collections := s.collections[nodeID]

indexName := action.IndexName
if indexName == "" {
indexName = s.indexes[nodeID][action.CollectionID][action.IndexID].Name
}

err := withRetry(
actionNodes,
nodeID,
err := withRetryOnNode(
s.nodes[nodeID],
func() error {
return collections[action.CollectionID].DropIndex(s.ctx, indexName)
},
)
expectedErrorRaised = AssertError(s.t, s.testCase.Description, err, action.ExpectedError)
} else {
for nodeID, collections := range s.collections {
indexName := action.IndexName
if indexName == "" {
indexName = s.indexes[nodeID][action.CollectionID][action.IndexID].Name
}

err := withRetryOnNode(
s.nodes[nodeID],
func() error {
return collections[action.CollectionID].DropIndex(s.ctx, indexName)
},
)
expectedErrorRaised = AssertError(s.t, s.testCase.Description, err, action.ExpectedError)
}
}

assertExpectedErrorRaised(s.t, s.testCase.Description, action.ExpectedError, expectedErrorRaised)
Expand Down

0 comments on commit 0297e77

Please sign in to comment.