-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error cases for reaching a server that is not Solr
- Loading branch information
Showing
11 changed files
with
230 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# v0.6.0 | ||
* Breaking changes to error handling. Clearer error messages. | ||
|
||
# v0.5.0 | ||
|
||
* Add logging of solr requests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use crate::structures::ErrrorTestsSetup; | ||
use serial_test::serial; | ||
use solrstice::{AsyncSolrCloudClient, Error, SelectQuery}; | ||
|
||
#[tokio::test] | ||
#[serial] | ||
async fn sensible_error_message_if_not_solr_server() -> Result<(), Error> { | ||
let config = ErrrorTestsSetup::new().await; | ||
let client = AsyncSolrCloudClient::new(config.context); | ||
|
||
let result = client.select(SelectQuery::new(), "error_collection").await; | ||
assert!( | ||
result.is_err() | ||
&& result | ||
.unwrap_err() | ||
.to_string() | ||
.contains("500 Internal Server Error") | ||
); | ||
Ok(()) | ||
} | ||
|
||
#[tokio::test] | ||
#[serial] | ||
async fn sensible_error_message_if_non_existent_collection() -> Result<(), Error> { | ||
let config = ErrrorTestsSetup::new().await; | ||
let client = AsyncSolrCloudClient::new(config.context); | ||
|
||
let result = client | ||
.select(SelectQuery::new(), "notfound_collection") | ||
.await; | ||
assert!(result.is_err() && result.unwrap_err().to_string().contains("404 Not Found")); | ||
Ok(()) | ||
} | ||
|
||
#[tokio::test] | ||
#[serial] | ||
async fn sensible_error_message_if_200_but_not_solr() -> Result<(), Error> { | ||
let config = ErrrorTestsSetup::new().await; | ||
let client = AsyncSolrCloudClient::new(config.context); | ||
|
||
let result = client.select(SelectQuery::new(), "always_200").await; | ||
assert!(result.is_err() && result.unwrap_err().to_string().contains("200 OK")); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.