Skip to content

Commit

Permalink
# Testing invalid argument
Browse files Browse the repository at this point in the history
Signed-off-by: Theo Truong <[email protected]>
  • Loading branch information
nhtruong committed Dec 16, 2024
1 parent da8ee14 commit c958bf1
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,17 @@
client.indices.delete(index: 'movies')

# Execute delete index without providing index name
expect { client.indices.delete }.to raise_error(ArgumentError)
expect { client.indices.delete }.to raise_error 'Required argument \'index\' missing'

# Delete a non-existent index without ignoring 404
expect { client.indices.delete(index: 'movies') }.to raise_error(OpenSearch::Transport::Transport::Errors::NotFound)

# Delete a non-existent index ignoring 404
expect(client.indices.delete(index: 'movies', ignore: [404])).to be_falsey

# Using unsupported query parameter
expect { client.ping(invalid: 'invalid') }.to raise_error 'URL parameter \'invalid\' is not supported'

# Create, get, and delete an index with HTTP methods
client.http.put('books', body: { settings: { number_of_shards: 1, number_of_replicas: 0 } })
expect(client.http.get('books')['books']['settings']['index']['number_of_shards']).to eq '1'
Expand Down

0 comments on commit c958bf1

Please sign in to comment.