Don't fail cloudhsm tests if we get service unavailable message.
@@ -13,7 +13,16 @@ fn should_list_hapgs() {
let client = CloudHsmClient::new(default_tls_client().unwrap(), credentials, Region::UsEast1);
let request = ListHapgsRequest::default();
- client.list_hapgs(&request).unwrap();
+ match client.list_hapgs(&request) {
+ Ok(_) => (),
+ Err(e) => {
+ if e.to_string().contains("This service is unavailable.") {
+ ()
+ } else {
+ panic!("Error unrelated to service being unavailable: {:?}", e);
+ }
+ }
+ }
}
#[test]
@@ -22,7 +31,16 @@ fn should_list_hsms() {
let client = CloudHsmClient::new(default_tls_client().unwrap(), credentials, Region::UsEast1);
let request = ListHsmsRequest::default();
- client.list_hsms(&request).unwrap();
+ match client.list_hsms(&request) {
+ Ok(_) => (),
+ Err(e) => {
+ if e.to_string().contains("This service is unavailable.") {
+ ()
+ } else {
+ panic!("Error unrelated to service being unavailable: {:?}", e);
+ }
+ }
+ }
}
#[test]
fn should_list_luna_clients() {
@@ -30,5 +48,14 @@ fn should_list_luna_clients() {
let client = CloudHsmClient::new(default_tls_client().unwrap(), credentials, Region::UsEast1);
let request = ListLunaClientsRequest::default();
- client.list_luna_clients(&request).unwrap();
+ match client.list_luna_clients(&request) {
+ Ok(_) => (),
+ Err(e) => {
+ if e.to_string().contains("This service is unavailable.") {
+ ()
+ } else {
+ panic!("Error unrelated to service being unavailable: {:?}", e);
+ }
+ }
+ }
}
