From dadeeb5dfabac24fb2c43d9cdbf7289f1124aa3b Mon Sep 17 00:00:00 2001 From: Sahib Yar Date: Sat, 25 Jan 2025 00:49:27 +0500 Subject: [PATCH] Comparison with errors using equality operators fails on wrapped errors (#581) Co-authored-by: Sahib Yar Co-authored-by: Kevin P. Fleming --- fastly/account_event_test.go | 3 +- fastly/acl_entry_test.go | 33 ++++++++++--------- fastly/acl_test.go | 27 +++++++-------- fastly/alerts_test.go | 7 ++-- fastly/backend_test.go | 27 +++++++-------- fastly/compute_package_test.go | 9 ++--- fastly/dictionary_info_test.go | 7 ++-- fastly/dictionary_item_test.go | 33 ++++++++++--------- fastly/dictionary_test.go | 27 +++++++-------- fastly/diff_test.go | 7 ++-- fastly/domain_test.go | 33 ++++++++++--------- fastly/health_check_test.go | 27 +++++++-------- fastly/load_balance_pool_test.go | 27 +++++++-------- fastly/load_balancer_director_backend_test.go | 25 +++++++------- fastly/load_balancer_director_test.go | 27 +++++++-------- fastly/load_balancer_server_test.go | 27 +++++++-------- fastly/logging_bigquery_test.go | 27 +++++++-------- fastly/logging_blobstorage_test.go | 27 +++++++-------- fastly/logging_cloudfiles_test.go | 27 +++++++-------- fastly/logging_datadog_test.go | 27 +++++++-------- fastly/logging_digitalocean_test.go | 27 +++++++-------- fastly/logging_elasticsearch_test.go | 27 +++++++-------- fastly/logging_ftp_test.go | 27 +++++++-------- fastly/logging_gcs_test.go | 27 +++++++-------- fastly/logging_grafanacloudlogs_test.go | 27 +++++++-------- fastly/logging_heroku_test.go | 27 +++++++-------- fastly/logging_honeycomb_test.go | 27 +++++++-------- fastly/logging_https_test.go | 25 +++++++------- fastly/logging_kafka_test.go | 27 +++++++-------- fastly/logging_kinesis_test.go | 27 +++++++-------- fastly/logging_logentries_test.go | 27 +++++++-------- fastly/logging_loggly_test.go | 27 +++++++-------- fastly/logging_logshuttle_test.go | 27 +++++++-------- fastly/logging_newrelic_test.go | 27 +++++++-------- fastly/logging_newrelicotlp_test.go | 27 +++++++-------- fastly/logging_openstack_test.go | 27 +++++++-------- fastly/logging_papertrail_test.go | 27 +++++++-------- fastly/logging_pubsub_test.go | 27 +++++++-------- fastly/logging_s3_test.go | 31 ++++++++--------- fastly/logging_scalyr_test.go | 27 +++++++-------- fastly/logging_sftp_test.go | 27 +++++++-------- fastly/logging_splunk_test.go | 27 +++++++-------- fastly/logging_sumologic_test.go | 27 +++++++-------- fastly/logging_syslog_test.go | 27 +++++++-------- fastly/managed_logging_test.go | 19 ++++++----- fastly/notifications_test.go | 11 ++++--- .../product_enablement_bot_management_test.go | 13 ++++---- ...duct_enablement_brotli_compression_test.go | 13 ++++---- ...roduct_enablement_domain_inspector_test.go | 13 ++++---- fastly/product_enablement_fanout_test.go | 13 ++++---- ...product_enablement_image_optimizer_test.go | 13 ++++---- ...t_enablement_log_explorer_insights_test.go | 13 ++++---- ...roduct_enablement_origin_inspector_test.go | 13 ++++---- fastly/product_enablement_websockets_test.go | 13 ++++---- fastly/resource_test.go | 27 +++++++-------- fastly/secret_store_test.go | 23 ++++++------- fastly/service_authorization_test.go | 13 ++++---- fastly/service_details_test.go | 7 ++-- fastly/service_version_test.go | 33 ++++++++++--------- fastly/stats_realtime_test.go | 3 +- fastly/tls_custom_activation_test.go | 13 ++++---- fastly/tls_custom_certificate_test.go | 11 ++++--- fastly/tls_custom_configuration_test.go | 7 ++-- fastly/tls_mutual_authentication_test.go | 11 ++++--- fastly/tls_subscription_test.go | 11 ++++--- fastly/user_test.go | 11 ++++--- fastly/vcl_cache_setting_test.go | 27 +++++++-------- fastly/vcl_condition_test.go | 27 +++++++-------- fastly/vcl_custom_test.go | 33 ++++++++++--------- fastly/vcl_gzip_test.go | 27 +++++++-------- fastly/vcl_header_test.go | 27 +++++++-------- fastly/vcl_http3_test.go | 13 ++++---- fastly/vcl_rate_limiter_test.go | 15 +++++---- fastly/vcl_request_setting_test.go | 27 +++++++-------- fastly/vcl_response_object_test.go | 27 +++++++-------- fastly/vcl_settings_test.go | 9 ++--- fastly/waf_active_rule_test.go | 23 ++++++------- fastly/waf_test.go | 25 +++++++------- fastly/waf_version_test.go | 29 ++++++++-------- 79 files changed, 899 insertions(+), 818 deletions(-) diff --git a/fastly/account_event_test.go b/fastly/account_event_test.go index 917e5d2c..d3933b68 100644 --- a/fastly/account_event_test.go +++ b/fastly/account_event_test.go @@ -2,6 +2,7 @@ package fastly import ( "bytes" + "errors" "io" "testing" ) @@ -43,7 +44,7 @@ func TestClient_GetAPIEvent_validation(t *testing.T) { _, err = TestClient.GetAPIEvent(&GetAPIEventInput{ EventID: "", }) - if err != ErrMissingEventID { + if !errors.Is(err, ErrMissingEventID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/acl_entry_test.go b/fastly/acl_entry_test.go index 28fdaa3e..a30af455 100644 --- a/fastly/acl_entry_test.go +++ b/fastly/acl_entry_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -171,14 +172,14 @@ func TestClient_ListACLEntries_validation(t *testing.T) { var err error _, err = TestClient.ListACLEntries(&ListACLEntriesInput{}) - if err != ErrMissingACLID { + if !errors.Is(err, ErrMissingACLID) { t.Errorf("bad ACL ID: %s", err) } _, err = TestClient.ListACLEntries(&ListACLEntriesInput{ ACLID: "123", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad Service ID: %s", err) } } @@ -187,14 +188,14 @@ func TestClient_CreateACLEntry_validation(t *testing.T) { var err error _, err = TestClient.CreateACLEntry(&CreateACLEntryInput{}) - if err != ErrMissingACLID { + if !errors.Is(err, ErrMissingACLID) { t.Errorf("bad error: %s", err) } _, err = TestClient.CreateACLEntry(&CreateACLEntryInput{ ACLID: "123", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -203,14 +204,14 @@ func TestClient_GetACLEntry_validation(t *testing.T) { var err error _, err = TestClient.GetACLEntry(&GetACLEntryInput{}) - if err != ErrMissingACLID { + if !errors.Is(err, ErrMissingACLID) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetACLEntry(&GetACLEntryInput{ ACLID: "123", }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } @@ -218,7 +219,7 @@ func TestClient_GetACLEntry_validation(t *testing.T) { ACLID: "123", EntryID: "456", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -227,14 +228,14 @@ func TestClient_UpdateACLEntry_validation(t *testing.T) { var err error _, err = TestClient.UpdateACLEntry(&UpdateACLEntryInput{}) - if err != ErrMissingACLID { + if !errors.Is(err, ErrMissingACLID) { t.Errorf("bad error: %s", err) } _, err = TestClient.UpdateACLEntry(&UpdateACLEntryInput{ ACLID: "123", }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } @@ -242,7 +243,7 @@ func TestClient_UpdateACLEntry_validation(t *testing.T) { ACLID: "123", EntryID: "456", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -251,14 +252,14 @@ func TestClient_DeleteACLEntry_validation(t *testing.T) { var err error err = TestClient.DeleteACLEntry(&DeleteACLEntryInput{}) - if err != ErrMissingACLID { + if !errors.Is(err, ErrMissingACLID) { t.Errorf("bad error: %s", err) } err = TestClient.DeleteACLEntry(&DeleteACLEntryInput{ ACLID: "123", }) - if err != ErrMissingEntryID { + if !errors.Is(err, ErrMissingEntryID) { t.Errorf("bad error: %s", err) } @@ -266,7 +267,7 @@ func TestClient_DeleteACLEntry_validation(t *testing.T) { ACLID: "123", EntryID: "456", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -275,14 +276,14 @@ func TestClient_BatchModifyACLEntries_validation(t *testing.T) { var err error err = TestClient.BatchModifyACLEntries(&BatchModifyACLEntriesInput{}) - if err != ErrMissingACLID { + if !errors.Is(err, ErrMissingACLID) { t.Errorf("bad error: %s", err) } err = TestClient.BatchModifyACLEntries(&BatchModifyACLEntriesInput{ ACLID: "123", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -292,7 +293,7 @@ func TestClient_BatchModifyACLEntries_validation(t *testing.T) { ServiceID: "456", Entries: oversizedACLEntries, }) - if err != ErrMaxExceededEntries { + if !errors.Is(err, ErrMaxExceededEntries) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/acl_test.go b/fastly/acl_test.go index 9d4b5f74..8d0062e1 100644 --- a/fastly/acl_test.go +++ b/fastly/acl_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -128,7 +129,7 @@ func TestClient_ListACLs_validation(t *testing.T) { _, err = TestClient.ListACLs(&ListACLsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -136,7 +137,7 @@ func TestClient_ListACLs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -146,7 +147,7 @@ func TestClient_CreateACL_validation(t *testing.T) { _, err = TestClient.CreateACL(&CreateACLInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -154,7 +155,7 @@ func TestClient_CreateACL_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -165,7 +166,7 @@ func TestClient_GetACL_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -173,7 +174,7 @@ func TestClient_GetACL_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -181,7 +182,7 @@ func TestClient_GetACL_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -193,7 +194,7 @@ func TestClient_UpdateACL_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -201,7 +202,7 @@ func TestClient_UpdateACL_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -209,7 +210,7 @@ func TestClient_UpdateACL_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -221,7 +222,7 @@ func TestClient_DeleteACL_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -229,7 +230,7 @@ func TestClient_DeleteACL_validation(t *testing.T) { Name: "test", ServiceVersion: 0, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -237,7 +238,7 @@ func TestClient_DeleteACL_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/alerts_test.go b/fastly/alerts_test.go index 6c17b0b0..6ba44189 100644 --- a/fastly/alerts_test.go +++ b/fastly/alerts_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" "github.com/google/go-cmp/cmp" @@ -238,7 +239,7 @@ func TestClient_GetAlertDefinition_validation(t *testing.T) { _, err = TestClient.GetAlertDefinition(&GetAlertDefinitionInput{ ID: nil, }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -248,7 +249,7 @@ func TestClient_UpdateAlertDefinition_validation(t *testing.T) { _, err = TestClient.UpdateAlertDefinition(&UpdateAlertDefinitionInput{ ID: nil, }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -257,7 +258,7 @@ func TestClient_DeleteAlertDefinition_validation(t *testing.T) { err := TestClient.DeleteAlertDefinition(&DeleteAlertDefinitionInput{ ID: nil, }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/backend_test.go b/fastly/backend_test.go index 5830bb72..6ada344b 100644 --- a/fastly/backend_test.go +++ b/fastly/backend_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -215,7 +216,7 @@ func TestClient_ListBackends_validation(t *testing.T) { _, err = TestClient.ListBackends(&ListBackendsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -223,7 +224,7 @@ func TestClient_ListBackends_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -233,7 +234,7 @@ func TestClient_CreateBackend_validation(t *testing.T) { _, err = TestClient.CreateBackend(&CreateBackendInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -241,7 +242,7 @@ func TestClient_CreateBackend_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -253,7 +254,7 @@ func TestClient_GetBackend_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -261,7 +262,7 @@ func TestClient_GetBackend_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -269,7 +270,7 @@ func TestClient_GetBackend_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -281,7 +282,7 @@ func TestClient_UpdateBackend_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -289,7 +290,7 @@ func TestClient_UpdateBackend_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -297,7 +298,7 @@ func TestClient_UpdateBackend_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -309,7 +310,7 @@ func TestClient_DeleteBackend_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -317,7 +318,7 @@ func TestClient_DeleteBackend_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -325,7 +326,7 @@ func TestClient_DeleteBackend_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/compute_package_test.go b/fastly/compute_package_test.go index 17ba5357..ba2d6e8c 100644 --- a/fastly/compute_package_test.go +++ b/fastly/compute_package_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "os" "testing" ) @@ -177,7 +178,7 @@ func TestClient_GetPackage_validation(t *testing.T) { _, err = TestClient.GetPackage(&GetPackageInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -185,7 +186,7 @@ func TestClient_GetPackage_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -195,7 +196,7 @@ func TestClient_UpdatePackage_validation(t *testing.T) { _, err = TestClient.UpdatePackage(&UpdatePackageInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -203,7 +204,7 @@ func TestClient_UpdatePackage_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/dictionary_info_test.go b/fastly/dictionary_info_test.go index 73454b26..d1f9da1d 100644 --- a/fastly/dictionary_info_test.go +++ b/fastly/dictionary_info_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -62,14 +63,14 @@ func TestClient_GetDictionaryInfo(t *testing.T) { func TestClient_GetDictionaryInfo_validation(t *testing.T) { var err error _, err = TestClient.GetDictionaryInfo(&GetDictionaryInfoInput{}) - if err != ErrMissingDictionaryID { + if !errors.Is(err, ErrMissingDictionaryID) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetDictionaryInfo(&GetDictionaryInfoInput{ DictionaryID: "123", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -78,7 +79,7 @@ func TestClient_GetDictionaryInfo_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/dictionary_item_test.go b/fastly/dictionary_item_test.go index 02f0d84e..18ae4570 100644 --- a/fastly/dictionary_item_test.go +++ b/fastly/dictionary_item_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -148,14 +149,14 @@ func TestClient_ListDictionaryItems_validation(t *testing.T) { var err error _, err = TestClient.ListDictionaryItems(&ListDictionaryItemsInput{}) - if err != ErrMissingDictionaryID { + if !errors.Is(err, ErrMissingDictionaryID) { t.Errorf("bad error: %s", err) } _, err = TestClient.ListDictionaryItems(&ListDictionaryItemsInput{ DictionaryID: "123", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -164,14 +165,14 @@ func TestClient_CreateDictionaryItem_validation(t *testing.T) { var err error _, err = TestClient.CreateDictionaryItem(&CreateDictionaryItemInput{}) - if err != ErrMissingDictionaryID { + if !errors.Is(err, ErrMissingDictionaryID) { t.Errorf("bad error: %s", err) } _, err = TestClient.CreateDictionaryItem(&CreateDictionaryItemInput{ DictionaryID: "123", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -180,14 +181,14 @@ func TestClient_GetDictionaryItem_validation(t *testing.T) { var err error _, err = TestClient.GetDictionaryItem(&GetDictionaryItemInput{}) - if err != ErrMissingDictionaryID { + if !errors.Is(err, ErrMissingDictionaryID) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetDictionaryItem(&GetDictionaryItemInput{ DictionaryID: "test", }) - if err != ErrMissingItemKey { + if !errors.Is(err, ErrMissingItemKey) { t.Errorf("bad error: %s", err) } @@ -195,7 +196,7 @@ func TestClient_GetDictionaryItem_validation(t *testing.T) { DictionaryID: "test", ItemKey: "123", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -204,14 +205,14 @@ func TestClient_UpdateDictionaryItem_validation(t *testing.T) { var err error _, err = TestClient.UpdateDictionaryItem(&UpdateDictionaryItemInput{}) - if err != ErrMissingDictionaryID { + if !errors.Is(err, ErrMissingDictionaryID) { t.Errorf("bad error: %s", err) } _, err = TestClient.UpdateDictionaryItem(&UpdateDictionaryItemInput{ DictionaryID: "test", }) - if err != ErrMissingItemKey { + if !errors.Is(err, ErrMissingItemKey) { t.Errorf("bad error: %s", err) } @@ -219,7 +220,7 @@ func TestClient_UpdateDictionaryItem_validation(t *testing.T) { DictionaryID: "test", ItemKey: "123", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -228,14 +229,14 @@ func TestClient_DeleteDictionaryItem_validation(t *testing.T) { var err error err = TestClient.DeleteDictionaryItem(&DeleteDictionaryItemInput{}) - if err != ErrMissingDictionaryID { + if !errors.Is(err, ErrMissingDictionaryID) { t.Errorf("bad error: %s", err) } err = TestClient.DeleteDictionaryItem(&DeleteDictionaryItemInput{ DictionaryID: "test", }) - if err != ErrMissingItemKey { + if !errors.Is(err, ErrMissingItemKey) { t.Errorf("bad error: %s", err) } @@ -243,7 +244,7 @@ func TestClient_DeleteDictionaryItem_validation(t *testing.T) { DictionaryID: "test", ItemKey: "123", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -252,7 +253,7 @@ func TestClient_BatchModifyDictionaryItem_validation(t *testing.T) { var err error err = TestClient.BatchModifyDictionaryItems(&BatchModifyDictionaryItemsInput{}) - if err != ErrMissingDictionaryID { + if !errors.Is(err, ErrMissingDictionaryID) { t.Errorf("bad error: %s", err) } @@ -261,7 +262,7 @@ func TestClient_BatchModifyDictionaryItem_validation(t *testing.T) { DictionaryID: "bar", Items: oversizedDictionaryItems, }) - if err != ErrMaxExceededItems { + if !errors.Is(err, ErrMaxExceededItems) { t.Errorf("bad error: %s", err) } @@ -270,7 +271,7 @@ func TestClient_BatchModifyDictionaryItem_validation(t *testing.T) { DictionaryID: "bar", Items: validDictionaryItems, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/dictionary_test.go b/fastly/dictionary_test.go index a0b427f1..37cac562 100644 --- a/fastly/dictionary_test.go +++ b/fastly/dictionary_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -112,7 +113,7 @@ func TestClient_ListDictionaries_validation(t *testing.T) { _, err = TestClient.ListDictionaries(&ListDictionariesInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -120,7 +121,7 @@ func TestClient_ListDictionaries_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -130,7 +131,7 @@ func TestClient_CreateDictionary_validation(t *testing.T) { _, err = TestClient.CreateDictionary(&CreateDictionaryInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -138,7 +139,7 @@ func TestClient_CreateDictionary_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -150,7 +151,7 @@ func TestClient_GetDictionary_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -158,7 +159,7 @@ func TestClient_GetDictionary_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -166,7 +167,7 @@ func TestClient_GetDictionary_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -178,7 +179,7 @@ func TestClient_UpdateDictionary_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -186,7 +187,7 @@ func TestClient_UpdateDictionary_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -194,7 +195,7 @@ func TestClient_UpdateDictionary_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -206,7 +207,7 @@ func TestClient_DeleteDictionary_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -214,7 +215,7 @@ func TestClient_DeleteDictionary_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -222,7 +223,7 @@ func TestClient_DeleteDictionary_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/diff_test.go b/fastly/diff_test.go index fcbec588..0c992147 100644 --- a/fastly/diff_test.go +++ b/fastly/diff_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -76,7 +77,7 @@ func TestClient_Diff_validation(t *testing.T) { _, err = TestClient.GetDiff(&GetDiffInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -84,7 +85,7 @@ func TestClient_Diff_validation(t *testing.T) { ServiceID: "foo", From: 0, }) - if err != ErrMissingFrom { + if !errors.Is(err, ErrMissingFrom) { t.Errorf("bad error: %s", err) } @@ -93,7 +94,7 @@ func TestClient_Diff_validation(t *testing.T) { From: 1, To: 0, }) - if err != ErrMissingTo { + if !errors.Is(err, ErrMissingTo) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/domain_test.go b/fastly/domain_test.go index 8cfc0d26..2e56f4a0 100644 --- a/fastly/domain_test.go +++ b/fastly/domain_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -178,7 +179,7 @@ func TestClient_ListDomains_validation(t *testing.T) { _, err = TestClient.ListDomains(&ListDomainsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -186,7 +187,7 @@ func TestClient_ListDomains_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -196,7 +197,7 @@ func TestClient_CreateDomain_validation(t *testing.T) { _, err = TestClient.CreateDomain(&CreateDomainInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -204,7 +205,7 @@ func TestClient_CreateDomain_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -216,7 +217,7 @@ func TestClient_GetDomain_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -224,7 +225,7 @@ func TestClient_GetDomain_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -232,7 +233,7 @@ func TestClient_GetDomain_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -244,7 +245,7 @@ func TestClient_UpdateDomain_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -252,7 +253,7 @@ func TestClient_UpdateDomain_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -260,7 +261,7 @@ func TestClient_UpdateDomain_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -272,7 +273,7 @@ func TestClient_DeleteDomain_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -280,7 +281,7 @@ func TestClient_DeleteDomain_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -288,7 +289,7 @@ func TestClient_DeleteDomain_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -300,7 +301,7 @@ func TestClient_ValidateDomain_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -308,7 +309,7 @@ func TestClient_ValidateDomain_validation(t *testing.T) { Name: "test", ServiceVersion: 0, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -316,7 +317,7 @@ func TestClient_ValidateDomain_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/health_check_test.go b/fastly/health_check_test.go index 06448259..f7aa053b 100644 --- a/fastly/health_check_test.go +++ b/fastly/health_check_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -200,7 +201,7 @@ func TestClient_ListHealthChecks_validation(t *testing.T) { _, err = TestClient.ListHealthChecks(&ListHealthChecksInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -208,7 +209,7 @@ func TestClient_ListHealthChecks_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -218,7 +219,7 @@ func TestClient_CreateHealthCheck_validation(t *testing.T) { _, err = TestClient.CreateHealthCheck(&CreateHealthCheckInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -226,7 +227,7 @@ func TestClient_CreateHealthCheck_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -238,7 +239,7 @@ func TestClient_GetHealthCheck_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -246,7 +247,7 @@ func TestClient_GetHealthCheck_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -254,7 +255,7 @@ func TestClient_GetHealthCheck_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -266,7 +267,7 @@ func TestClient_UpdateHealthCheck_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -274,7 +275,7 @@ func TestClient_UpdateHealthCheck_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -282,7 +283,7 @@ func TestClient_UpdateHealthCheck_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -294,7 +295,7 @@ func TestClient_DeleteHealthCheck_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -302,7 +303,7 @@ func TestClient_DeleteHealthCheck_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -310,7 +311,7 @@ func TestClient_DeleteHealthCheck_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/load_balance_pool_test.go b/fastly/load_balance_pool_test.go index 1fe82a88..9ecc6702 100644 --- a/fastly/load_balance_pool_test.go +++ b/fastly/load_balance_pool_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -141,7 +142,7 @@ func TestClient_ListPools_validation(t *testing.T) { _, err = TestClient.ListPools(&ListPoolsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -149,7 +150,7 @@ func TestClient_ListPools_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -161,7 +162,7 @@ func TestClient_CreatePool_validation(t *testing.T) { Name: ToPointer("test"), ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -169,7 +170,7 @@ func TestClient_CreatePool_validation(t *testing.T) { Name: ToPointer("test"), ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -181,7 +182,7 @@ func TestClient_GetPool_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -189,7 +190,7 @@ func TestClient_GetPool_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -197,7 +198,7 @@ func TestClient_GetPool_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -209,7 +210,7 @@ func TestClient_UpdatePool_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -217,7 +218,7 @@ func TestClient_UpdatePool_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -225,7 +226,7 @@ func TestClient_UpdatePool_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -237,7 +238,7 @@ func TestClient_DeletePool_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -245,7 +246,7 @@ func TestClient_DeletePool_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -253,7 +254,7 @@ func TestClient_DeletePool_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/load_balancer_director_backend_test.go b/fastly/load_balancer_director_backend_test.go index ee515f04..404010e5 100644 --- a/fastly/load_balancer_director_backend_test.go +++ b/fastly/load_balancer_director_backend_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -84,20 +85,20 @@ func TestClient_DirectorBackends(t *testing.T) { func TestClient_CreateDirectorBackend_validation(t *testing.T) { var err error _, err = TestClient.CreateDirectorBackend(&CreateDirectorBackendInput{}) - if err != ErrMissingBackend { + if !errors.Is(err, ErrMissingBackend) { t.Errorf("bad error: %s", err) } _, err = TestClient.CreateDirectorBackend(&CreateDirectorBackendInput{ Backend: "foo", }) - if err != ErrMissingDirector { + if !errors.Is(err, ErrMissingDirector) { t.Errorf("bad error: %s", err) } _, err = TestClient.CreateDirectorBackend(&CreateDirectorBackendInput{ Backend: "foo", Director: "bar", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.CreateDirectorBackend(&CreateDirectorBackendInput{ @@ -105,7 +106,7 @@ func TestClient_CreateDirectorBackend_validation(t *testing.T) { Director: "bar", ServiceID: "baz", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -113,20 +114,20 @@ func TestClient_CreateDirectorBackend_validation(t *testing.T) { func TestClient_GetDirectorBackend_validation(t *testing.T) { var err error _, err = TestClient.GetDirectorBackend(&GetDirectorBackendInput{}) - if err != ErrMissingBackend { + if !errors.Is(err, ErrMissingBackend) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetDirectorBackend(&GetDirectorBackendInput{ Backend: "foo", }) - if err != ErrMissingDirector { + if !errors.Is(err, ErrMissingDirector) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetDirectorBackend(&GetDirectorBackendInput{ Backend: "foo", Director: "bar", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetDirectorBackend(&GetDirectorBackendInput{ @@ -134,7 +135,7 @@ func TestClient_GetDirectorBackend_validation(t *testing.T) { Director: "bar", ServiceID: "baz", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -142,20 +143,20 @@ func TestClient_GetDirectorBackend_validation(t *testing.T) { func TestClient_DeleteDirectorBackend_validation(t *testing.T) { var err error err = TestClient.DeleteDirectorBackend(&DeleteDirectorBackendInput{}) - if err != ErrMissingBackend { + if !errors.Is(err, ErrMissingBackend) { t.Errorf("bad error: %s", err) } err = TestClient.DeleteDirectorBackend(&DeleteDirectorBackendInput{ Backend: "foo", }) - if err != ErrMissingDirector { + if !errors.Is(err, ErrMissingDirector) { t.Errorf("bad error: %s", err) } err = TestClient.DeleteDirectorBackend(&DeleteDirectorBackendInput{ Backend: "foo", Director: "bar", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } err = TestClient.DeleteDirectorBackend(&DeleteDirectorBackendInput{ @@ -163,7 +164,7 @@ func TestClient_DeleteDirectorBackend_validation(t *testing.T) { Director: "bar", ServiceID: "baz", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/load_balancer_director_test.go b/fastly/load_balancer_director_test.go index cbce1d94..fe0c4670 100644 --- a/fastly/load_balancer_director_test.go +++ b/fastly/load_balancer_director_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -181,7 +182,7 @@ func TestClient_ListDirectors_validation(t *testing.T) { _, err = TestClient.ListDirectors(&ListDirectorsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -189,7 +190,7 @@ func TestClient_ListDirectors_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -199,7 +200,7 @@ func TestClient_CreateDirector_validation(t *testing.T) { _, err = TestClient.CreateDirector(&CreateDirectorInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -207,7 +208,7 @@ func TestClient_CreateDirector_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -219,7 +220,7 @@ func TestClient_GetDirector_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -227,7 +228,7 @@ func TestClient_GetDirector_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -235,7 +236,7 @@ func TestClient_GetDirector_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -247,7 +248,7 @@ func TestClient_UpdateDirector_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -255,7 +256,7 @@ func TestClient_UpdateDirector_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -263,7 +264,7 @@ func TestClient_UpdateDirector_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -275,7 +276,7 @@ func TestClient_DeleteDirector_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -283,7 +284,7 @@ func TestClient_DeleteDirector_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -291,7 +292,7 @@ func TestClient_DeleteDirector_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/load_balancer_server_test.go b/fastly/load_balancer_server_test.go index c87482c1..ead3cddf 100644 --- a/fastly/load_balancer_server_test.go +++ b/fastly/load_balancer_server_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -142,14 +143,14 @@ func TestClient_ListServers_validation(t *testing.T) { _, err = TestClient.ListServers(&ListServersInput{ ServiceID: "foo", }) - if err != ErrMissingPoolID { + if !errors.Is(err, ErrMissingPoolID) { t.Errorf("bad error: %q", err) } _, err = TestClient.ListServers(&ListServersInput{ PoolID: "123", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -160,14 +161,14 @@ func TestClient_CreateServer_validation(t *testing.T) { _, err = TestClient.CreateServer(&CreateServerInput{ ServiceID: "foo", }) - if err != ErrMissingPoolID { + if !errors.Is(err, ErrMissingPoolID) { t.Errorf("bad error: %q", err) } _, err = TestClient.CreateServer(&CreateServerInput{ PoolID: "123", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -179,7 +180,7 @@ func TestClient_GetServer_validation(t *testing.T) { Server: "test", ServiceID: "foo", }) - if err != ErrMissingPoolID { + if !errors.Is(err, ErrMissingPoolID) { t.Errorf("bad error: %q", err) } @@ -187,7 +188,7 @@ func TestClient_GetServer_validation(t *testing.T) { PoolID: "bar", ServiceID: "foo", }) - if err != ErrMissingServer { + if !errors.Is(err, ErrMissingServer) { t.Errorf("bad error: %q", err) } @@ -195,7 +196,7 @@ func TestClient_GetServer_validation(t *testing.T) { PoolID: "bar", Server: "test", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -207,7 +208,7 @@ func TestClient_UpdateServer_validation(t *testing.T) { Server: "test", ServiceID: "foo", }) - if err != ErrMissingPoolID { + if !errors.Is(err, ErrMissingPoolID) { t.Errorf("bad error: %q", err) } @@ -215,7 +216,7 @@ func TestClient_UpdateServer_validation(t *testing.T) { PoolID: "bar", ServiceID: "foo", }) - if err != ErrMissingServer { + if !errors.Is(err, ErrMissingServer) { t.Errorf("bad error: %q", err) } @@ -223,7 +224,7 @@ func TestClient_UpdateServer_validation(t *testing.T) { PoolID: "bar", Server: "test", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -235,7 +236,7 @@ func TestClient_DeleteServer_validation(t *testing.T) { Server: "test", ServiceID: "foo", }) - if err != ErrMissingPoolID { + if !errors.Is(err, ErrMissingPoolID) { t.Errorf("bad error: %q", err) } @@ -243,7 +244,7 @@ func TestClient_DeleteServer_validation(t *testing.T) { PoolID: "bar", ServiceID: "foo", }) - if err != ErrMissingServer { + if !errors.Is(err, ErrMissingServer) { t.Errorf("bad error: %q", err) } @@ -251,7 +252,7 @@ func TestClient_DeleteServer_validation(t *testing.T) { PoolID: "bar", Server: "test", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_bigquery_test.go b/fastly/logging_bigquery_test.go index faabf85b..c0c9e855 100644 --- a/fastly/logging_bigquery_test.go +++ b/fastly/logging_bigquery_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "strings" "testing" ) @@ -189,7 +190,7 @@ func TestClient_ListBigQueries_validation(t *testing.T) { _, err = TestClient.ListBigQueries(&ListBigQueriesInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -197,7 +198,7 @@ func TestClient_ListBigQueries_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -207,7 +208,7 @@ func TestClient_CreateBigQuery_validation(t *testing.T) { _, err = TestClient.CreateBigQuery(&CreateBigQueryInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -215,7 +216,7 @@ func TestClient_CreateBigQuery_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -227,7 +228,7 @@ func TestClient_GetBigQuery_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -235,7 +236,7 @@ func TestClient_GetBigQuery_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -243,7 +244,7 @@ func TestClient_GetBigQuery_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -255,7 +256,7 @@ func TestClient_UpdateBigQuery_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -263,7 +264,7 @@ func TestClient_UpdateBigQuery_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -271,7 +272,7 @@ func TestClient_UpdateBigQuery_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -283,7 +284,7 @@ func TestClient_DeleteBigQuery_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -291,7 +292,7 @@ func TestClient_DeleteBigQuery_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -299,7 +300,7 @@ func TestClient_DeleteBigQuery_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_blobstorage_test.go b/fastly/logging_blobstorage_test.go index 900fffa9..6639ddaf 100644 --- a/fastly/logging_blobstorage_test.go +++ b/fastly/logging_blobstorage_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -365,7 +366,7 @@ func TestClient_ListBlobStorages_validation(t *testing.T) { _, err = TestClient.ListBlobStorages(&ListBlobStoragesInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -373,7 +374,7 @@ func TestClient_ListBlobStorages_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -384,7 +385,7 @@ func TestClient_CreateBlobStorage_validation(t *testing.T) { _, err = TestClient.CreateBlobStorage(&CreateBlobStorageInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -392,7 +393,7 @@ func TestClient_CreateBlobStorage_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -404,7 +405,7 @@ func TestClient_GetBlobStorage_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -412,7 +413,7 @@ func TestClient_GetBlobStorage_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -420,7 +421,7 @@ func TestClient_GetBlobStorage_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -432,7 +433,7 @@ func TestClient_UpdateBlobStorage_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -440,7 +441,7 @@ func TestClient_UpdateBlobStorage_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -448,7 +449,7 @@ func TestClient_UpdateBlobStorage_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -460,7 +461,7 @@ func TestClient_DeleteBlobStorage_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -468,7 +469,7 @@ func TestClient_DeleteBlobStorage_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -476,7 +477,7 @@ func TestClient_DeleteBlobStorage_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_cloudfiles_test.go b/fastly/logging_cloudfiles_test.go index e099d712..a8cdcaaa 100644 --- a/fastly/logging_cloudfiles_test.go +++ b/fastly/logging_cloudfiles_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -365,7 +366,7 @@ func TestClient_ListCloudfiles_validation(t *testing.T) { _, err = TestClient.ListCloudfiles(&ListCloudfilesInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -373,7 +374,7 @@ func TestClient_ListCloudfiles_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -383,7 +384,7 @@ func TestClient_CreateCloudfiles_validation(t *testing.T) { _, err = TestClient.CreateCloudfiles(&CreateCloudfilesInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -391,7 +392,7 @@ func TestClient_CreateCloudfiles_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -403,7 +404,7 @@ func TestClient_GetCloudfiles_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -411,7 +412,7 @@ func TestClient_GetCloudfiles_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -419,7 +420,7 @@ func TestClient_GetCloudfiles_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -431,7 +432,7 @@ func TestClient_UpdateCloudfiles_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -439,7 +440,7 @@ func TestClient_UpdateCloudfiles_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -447,7 +448,7 @@ func TestClient_UpdateCloudfiles_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -459,7 +460,7 @@ func TestClient_DeleteCloudfiles_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -467,7 +468,7 @@ func TestClient_DeleteCloudfiles_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -475,7 +476,7 @@ func TestClient_DeleteCloudfiles_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_datadog_test.go b/fastly/logging_datadog_test.go index 17b2f99a..75370c05 100644 --- a/fastly/logging_datadog_test.go +++ b/fastly/logging_datadog_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -153,7 +154,7 @@ func TestClient_ListDatadog_validation(t *testing.T) { _, err = TestClient.ListDatadog(&ListDatadogInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -161,7 +162,7 @@ func TestClient_ListDatadog_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -172,7 +173,7 @@ func TestClient_CreateDatadog_validation(t *testing.T) { _, err = TestClient.CreateDatadog(&CreateDatadogInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -180,7 +181,7 @@ func TestClient_CreateDatadog_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -192,7 +193,7 @@ func TestClient_GetDatadog_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -200,7 +201,7 @@ func TestClient_GetDatadog_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -208,7 +209,7 @@ func TestClient_GetDatadog_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -220,7 +221,7 @@ func TestClient_UpdateDatadog_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -228,7 +229,7 @@ func TestClient_UpdateDatadog_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -236,7 +237,7 @@ func TestClient_UpdateDatadog_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -248,7 +249,7 @@ func TestClient_DeleteDatadog_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -256,7 +257,7 @@ func TestClient_DeleteDatadog_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -264,7 +265,7 @@ func TestClient_DeleteDatadog_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_digitalocean_test.go b/fastly/logging_digitalocean_test.go index 3b2148e1..89c378ff 100644 --- a/fastly/logging_digitalocean_test.go +++ b/fastly/logging_digitalocean_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -351,7 +352,7 @@ func TestClient_ListDigitalOceans_validation(t *testing.T) { _, err = TestClient.ListDigitalOceans(&ListDigitalOceansInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -359,7 +360,7 @@ func TestClient_ListDigitalOceans_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -369,7 +370,7 @@ func TestClient_CreateDigitalOcean_validation(t *testing.T) { _, err = TestClient.CreateDigitalOcean(&CreateDigitalOceanInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -377,7 +378,7 @@ func TestClient_CreateDigitalOcean_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -389,7 +390,7 @@ func TestClient_GetDigitalOcean_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -397,7 +398,7 @@ func TestClient_GetDigitalOcean_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -405,7 +406,7 @@ func TestClient_GetDigitalOcean_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -417,7 +418,7 @@ func TestClient_UpdateDigitalOcean_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -425,7 +426,7 @@ func TestClient_UpdateDigitalOcean_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -433,7 +434,7 @@ func TestClient_UpdateDigitalOcean_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -445,7 +446,7 @@ func TestClient_DeleteDigitalOcean_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -453,7 +454,7 @@ func TestClient_DeleteDigitalOcean_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -461,7 +462,7 @@ func TestClient_DeleteDigitalOcean_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_elasticsearch_test.go b/fastly/logging_elasticsearch_test.go index d8da7050..1187dad2 100644 --- a/fastly/logging_elasticsearch_test.go +++ b/fastly/logging_elasticsearch_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "strings" "testing" ) @@ -237,7 +238,7 @@ func TestClient_ListElasticsearch_validation(t *testing.T) { _, err = TestClient.ListElasticsearch(&ListElasticsearchInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -245,7 +246,7 @@ func TestClient_ListElasticsearch_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -255,7 +256,7 @@ func TestClient_CreateElasticsearch_validation(t *testing.T) { _, err = TestClient.CreateElasticsearch(&CreateElasticsearchInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -263,7 +264,7 @@ func TestClient_CreateElasticsearch_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -275,7 +276,7 @@ func TestClient_GetElasticsearch_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -283,7 +284,7 @@ func TestClient_GetElasticsearch_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -291,7 +292,7 @@ func TestClient_GetElasticsearch_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -303,7 +304,7 @@ func TestClient_UpdateElasticsearch_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -311,7 +312,7 @@ func TestClient_UpdateElasticsearch_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -319,7 +320,7 @@ func TestClient_UpdateElasticsearch_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -331,7 +332,7 @@ func TestClient_DeleteElasticsearch_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -339,7 +340,7 @@ func TestClient_DeleteElasticsearch_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -347,7 +348,7 @@ func TestClient_DeleteElasticsearch_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_ftp_test.go b/fastly/logging_ftp_test.go index 0906bfa2..8dc36d74 100644 --- a/fastly/logging_ftp_test.go +++ b/fastly/logging_ftp_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -353,7 +354,7 @@ func TestClient_ListFTPs_validation(t *testing.T) { _, err = TestClient.ListFTPs(&ListFTPsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -361,7 +362,7 @@ func TestClient_ListFTPs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -372,7 +373,7 @@ func TestClient_CreateFTP_validation(t *testing.T) { _, err = TestClient.CreateFTP(&CreateFTPInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -380,7 +381,7 @@ func TestClient_CreateFTP_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -392,7 +393,7 @@ func TestClient_GetFTP_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -400,7 +401,7 @@ func TestClient_GetFTP_validation(t *testing.T) { ServiceVersion: 1, Name: "test", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -408,7 +409,7 @@ func TestClient_GetFTP_validation(t *testing.T) { ServiceID: "foo", Name: "test", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -420,7 +421,7 @@ func TestClient_UpdateFTP_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -428,7 +429,7 @@ func TestClient_UpdateFTP_validation(t *testing.T) { ServiceVersion: 1, Name: "test", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -436,7 +437,7 @@ func TestClient_UpdateFTP_validation(t *testing.T) { ServiceID: "foo", Name: "test", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -448,7 +449,7 @@ func TestClient_DeleteFTP_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -456,7 +457,7 @@ func TestClient_DeleteFTP_validation(t *testing.T) { ServiceVersion: 1, Name: "test", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -464,7 +465,7 @@ func TestClient_DeleteFTP_validation(t *testing.T) { ServiceID: "foo", Name: "test", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_gcs_test.go b/fastly/logging_gcs_test.go index 9529d931..bc275b6f 100644 --- a/fastly/logging_gcs_test.go +++ b/fastly/logging_gcs_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -352,7 +353,7 @@ func TestClient_ListGCSs_validation(t *testing.T) { _, err = TestClient.ListGCSs(&ListGCSsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -360,7 +361,7 @@ func TestClient_ListGCSs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -371,7 +372,7 @@ func TestClient_CreateGCS_validation(t *testing.T) { _, err = TestClient.CreateGCS(&CreateGCSInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -379,7 +380,7 @@ func TestClient_CreateGCS_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -391,7 +392,7 @@ func TestClient_GetGCS_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -399,7 +400,7 @@ func TestClient_GetGCS_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -407,7 +408,7 @@ func TestClient_GetGCS_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -419,7 +420,7 @@ func TestClient_UpdateGCS_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -427,7 +428,7 @@ func TestClient_UpdateGCS_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -435,7 +436,7 @@ func TestClient_UpdateGCS_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -447,7 +448,7 @@ func TestClient_DeleteGCS_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -455,7 +456,7 @@ func TestClient_DeleteGCS_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -463,7 +464,7 @@ func TestClient_DeleteGCS_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_grafanacloudlogs_test.go b/fastly/logging_grafanacloudlogs_test.go index c11a24f9..06b6796c 100644 --- a/fastly/logging_grafanacloudlogs_test.go +++ b/fastly/logging_grafanacloudlogs_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -164,7 +165,7 @@ func TestClient_ListGrafanaCloudLogs_validation(t *testing.T) { _, err = TestClient.ListGrafanaCloudLogs(&ListGrafanaCloudLogsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -172,7 +173,7 @@ func TestClient_ListGrafanaCloudLogs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -183,7 +184,7 @@ func TestClient_CreateGrafanaCloudLogs_validation(t *testing.T) { _, err = TestClient.CreateGrafanaCloudLogs(&CreateGrafanaCloudLogsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -191,7 +192,7 @@ func TestClient_CreateGrafanaCloudLogs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -203,7 +204,7 @@ func TestClient_GetGrafanaCloudLogs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -211,7 +212,7 @@ func TestClient_GetGrafanaCloudLogs_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -219,7 +220,7 @@ func TestClient_GetGrafanaCloudLogs_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -231,7 +232,7 @@ func TestClient_UpdateGrafanaCloudLogs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -239,7 +240,7 @@ func TestClient_UpdateGrafanaCloudLogs_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -247,7 +248,7 @@ func TestClient_UpdateGrafanaCloudLogs_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -259,7 +260,7 @@ func TestClient_DeleteGrafanaCloudLogs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -267,7 +268,7 @@ func TestClient_DeleteGrafanaCloudLogs_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -275,7 +276,7 @@ func TestClient_DeleteGrafanaCloudLogs_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_heroku_test.go b/fastly/logging_heroku_test.go index 562c3a30..1a2f069c 100644 --- a/fastly/logging_heroku_test.go +++ b/fastly/logging_heroku_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -152,7 +153,7 @@ func TestClient_ListHerokus_validation(t *testing.T) { _, err = TestClient.ListHerokus(&ListHerokusInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -160,7 +161,7 @@ func TestClient_ListHerokus_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -170,7 +171,7 @@ func TestClient_CreateHeroku_validation(t *testing.T) { _, err = TestClient.CreateHeroku(&CreateHerokuInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -178,7 +179,7 @@ func TestClient_CreateHeroku_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -190,7 +191,7 @@ func TestClient_GetHeroku_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -198,7 +199,7 @@ func TestClient_GetHeroku_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -206,7 +207,7 @@ func TestClient_GetHeroku_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -218,7 +219,7 @@ func TestClient_UpdateHeroku_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -226,7 +227,7 @@ func TestClient_UpdateHeroku_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -234,7 +235,7 @@ func TestClient_UpdateHeroku_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -246,7 +247,7 @@ func TestClient_DeleteHeroku_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -254,7 +255,7 @@ func TestClient_DeleteHeroku_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -262,7 +263,7 @@ func TestClient_DeleteHeroku_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_honeycomb_test.go b/fastly/logging_honeycomb_test.go index cee89fe6..6ba2939d 100644 --- a/fastly/logging_honeycomb_test.go +++ b/fastly/logging_honeycomb_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -156,7 +157,7 @@ func TestClient_ListHoneycombs_validation(t *testing.T) { _, err = TestClient.ListHoneycombs(&ListHoneycombsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -164,7 +165,7 @@ func TestClient_ListHoneycombs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -174,7 +175,7 @@ func TestClient_CreateHoneycomb_validation(t *testing.T) { _, err = TestClient.CreateHoneycomb(&CreateHoneycombInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -182,7 +183,7 @@ func TestClient_CreateHoneycomb_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -194,7 +195,7 @@ func TestClient_GetHoneycomb_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -202,7 +203,7 @@ func TestClient_GetHoneycomb_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -210,7 +211,7 @@ func TestClient_GetHoneycomb_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -222,7 +223,7 @@ func TestClient_UpdateHoneycomb_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -230,7 +231,7 @@ func TestClient_UpdateHoneycomb_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -238,7 +239,7 @@ func TestClient_UpdateHoneycomb_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -250,7 +251,7 @@ func TestClient_DeleteHoneycomb_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -258,7 +259,7 @@ func TestClient_DeleteHoneycomb_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -266,7 +267,7 @@ func TestClient_DeleteHoneycomb_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_https_test.go b/fastly/logging_https_test.go index 3a91c822..4c05aa20 100644 --- a/fastly/logging_https_test.go +++ b/fastly/logging_https_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "strings" "testing" ) @@ -251,7 +252,7 @@ func TestClient_ListHTTPS_validation(t *testing.T) { _, err = TestClient.ListHTTPS(&ListHTTPSInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -261,7 +262,7 @@ func TestClient_CreateHTTPS_validation(t *testing.T) { _, err = TestClient.CreateHTTPS(&CreateHTTPSInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -269,7 +270,7 @@ func TestClient_CreateHTTPS_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -281,7 +282,7 @@ func TestClient_GetHTTPS_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -289,7 +290,7 @@ func TestClient_GetHTTPS_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -297,7 +298,7 @@ func TestClient_GetHTTPS_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -309,7 +310,7 @@ func TestClient_UpdateHTTPS_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -317,7 +318,7 @@ func TestClient_UpdateHTTPS_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -325,7 +326,7 @@ func TestClient_UpdateHTTPS_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -337,7 +338,7 @@ func TestClient_DeleteHTTPS_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -345,7 +346,7 @@ func TestClient_DeleteHTTPS_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -353,7 +354,7 @@ func TestClient_DeleteHTTPS_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_kafka_test.go b/fastly/logging_kafka_test.go index 8662839b..45d1a64c 100644 --- a/fastly/logging_kafka_test.go +++ b/fastly/logging_kafka_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "strings" "testing" ) @@ -243,7 +244,7 @@ func TestClient_ListKafkas_validation(t *testing.T) { _, err = TestClient.ListKafkas(&ListKafkasInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -251,7 +252,7 @@ func TestClient_ListKafkas_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -261,7 +262,7 @@ func TestClient_CreateKafka_validation(t *testing.T) { _, err = TestClient.CreateKafka(&CreateKafkaInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -269,7 +270,7 @@ func TestClient_CreateKafka_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -281,7 +282,7 @@ func TestClient_GetKafka_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -289,7 +290,7 @@ func TestClient_GetKafka_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -297,7 +298,7 @@ func TestClient_GetKafka_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -309,7 +310,7 @@ func TestClient_UpdateKafka_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -317,7 +318,7 @@ func TestClient_UpdateKafka_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -325,7 +326,7 @@ func TestClient_UpdateKafka_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -337,7 +338,7 @@ func TestClient_DeleteKafka_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -345,7 +346,7 @@ func TestClient_DeleteKafka_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -353,7 +354,7 @@ func TestClient_DeleteKafka_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_kinesis_test.go b/fastly/logging_kinesis_test.go index 6d81f723..985d3f9b 100644 --- a/fastly/logging_kinesis_test.go +++ b/fastly/logging_kinesis_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -338,7 +339,7 @@ func TestClient_ListKinesis_validation(t *testing.T) { _, err = TestClient.ListKinesis(&ListKinesisInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -346,7 +347,7 @@ func TestClient_ListKinesis_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -356,7 +357,7 @@ func TestClient_CreateKinesis_validation(t *testing.T) { _, err = TestClient.CreateKinesis(&CreateKinesisInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -364,7 +365,7 @@ func TestClient_CreateKinesis_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -376,7 +377,7 @@ func TestClient_GetKinesis_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -384,7 +385,7 @@ func TestClient_GetKinesis_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -392,7 +393,7 @@ func TestClient_GetKinesis_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -404,7 +405,7 @@ func TestClient_UpdateKinesis_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -412,7 +413,7 @@ func TestClient_UpdateKinesis_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -420,7 +421,7 @@ func TestClient_UpdateKinesis_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -432,7 +433,7 @@ func TestClient_DeleteKinesis_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -440,7 +441,7 @@ func TestClient_DeleteKinesis_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -448,7 +449,7 @@ func TestClient_DeleteKinesis_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_logentries_test.go b/fastly/logging_logentries_test.go index 9e7e9933..e1a6a3b4 100644 --- a/fastly/logging_logentries_test.go +++ b/fastly/logging_logentries_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -166,7 +167,7 @@ func TestClient_ListLogentries_validation(t *testing.T) { _, err = TestClient.ListLogentries(&ListLogentriesInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -174,7 +175,7 @@ func TestClient_ListLogentries_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -184,7 +185,7 @@ func TestClient_CreateLogentries_validation(t *testing.T) { _, err = TestClient.CreateLogentries(&CreateLogentriesInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -192,7 +193,7 @@ func TestClient_CreateLogentries_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -204,7 +205,7 @@ func TestClient_GetLogentries_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -212,7 +213,7 @@ func TestClient_GetLogentries_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -220,7 +221,7 @@ func TestClient_GetLogentries_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -232,7 +233,7 @@ func TestClient_UpdateLogentries_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -240,7 +241,7 @@ func TestClient_UpdateLogentries_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -248,7 +249,7 @@ func TestClient_UpdateLogentries_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -260,7 +261,7 @@ func TestClient_DeleteLogentries_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -268,7 +269,7 @@ func TestClient_DeleteLogentries_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -276,7 +277,7 @@ func TestClient_DeleteLogentries_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_loggly_test.go b/fastly/logging_loggly_test.go index 4596bb78..8d11bd87 100644 --- a/fastly/logging_loggly_test.go +++ b/fastly/logging_loggly_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -144,7 +145,7 @@ func TestClient_ListLoggly_validation(t *testing.T) { _, err = TestClient.ListLoggly(&ListLogglyInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -152,7 +153,7 @@ func TestClient_ListLoggly_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -162,7 +163,7 @@ func TestClient_CreateLoggly_validation(t *testing.T) { _, err = TestClient.CreateLoggly(&CreateLogglyInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -170,7 +171,7 @@ func TestClient_CreateLoggly_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -182,7 +183,7 @@ func TestClient_GetLoggly_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -190,7 +191,7 @@ func TestClient_GetLoggly_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -198,7 +199,7 @@ func TestClient_GetLoggly_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -210,7 +211,7 @@ func TestClient_UpdateLoggly_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -218,7 +219,7 @@ func TestClient_UpdateLoggly_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -226,7 +227,7 @@ func TestClient_UpdateLoggly_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -238,7 +239,7 @@ func TestClient_DeleteLoggly_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -246,7 +247,7 @@ func TestClient_DeleteLoggly_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -254,7 +255,7 @@ func TestClient_DeleteLoggly_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_logshuttle_test.go b/fastly/logging_logshuttle_test.go index d9d2da91..0cffce6b 100644 --- a/fastly/logging_logshuttle_test.go +++ b/fastly/logging_logshuttle_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -157,7 +158,7 @@ func TestClient_ListLogshuttles_validation(t *testing.T) { _, err = TestClient.ListLogshuttles(&ListLogshuttlesInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -165,7 +166,7 @@ func TestClient_ListLogshuttles_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -176,7 +177,7 @@ func TestClient_CreateLogshuttle_validation(t *testing.T) { _, err = TestClient.CreateLogshuttle(&CreateLogshuttleInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -184,7 +185,7 @@ func TestClient_CreateLogshuttle_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -196,7 +197,7 @@ func TestClient_GetLogshuttle_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -204,7 +205,7 @@ func TestClient_GetLogshuttle_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -212,7 +213,7 @@ func TestClient_GetLogshuttle_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -224,7 +225,7 @@ func TestClient_UpdateLogshuttle_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -232,7 +233,7 @@ func TestClient_UpdateLogshuttle_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -240,7 +241,7 @@ func TestClient_UpdateLogshuttle_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -252,7 +253,7 @@ func TestClient_DeleteLogshuttle_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -260,7 +261,7 @@ func TestClient_DeleteLogshuttle_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -268,7 +269,7 @@ func TestClient_DeleteLogshuttle_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_newrelic_test.go b/fastly/logging_newrelic_test.go index 3f263271..82c33db5 100644 --- a/fastly/logging_newrelic_test.go +++ b/fastly/logging_newrelic_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -255,7 +256,7 @@ func TestClient_ListNewRelic_validation(t *testing.T) { _, err = TestClient.ListNewRelic(&ListNewRelicInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -263,7 +264,7 @@ func TestClient_ListNewRelic_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -274,7 +275,7 @@ func TestClient_CreateNewRelic_validation(t *testing.T) { _, err = TestClient.CreateNewRelic(&CreateNewRelicInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -282,7 +283,7 @@ func TestClient_CreateNewRelic_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -294,7 +295,7 @@ func TestClient_GetNewRelic_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -302,7 +303,7 @@ func TestClient_GetNewRelic_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -310,7 +311,7 @@ func TestClient_GetNewRelic_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -322,7 +323,7 @@ func TestClient_UpdateNewRelic_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -330,7 +331,7 @@ func TestClient_UpdateNewRelic_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -338,7 +339,7 @@ func TestClient_UpdateNewRelic_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -350,7 +351,7 @@ func TestClient_DeleteNewRelic_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -358,7 +359,7 @@ func TestClient_DeleteNewRelic_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -366,7 +367,7 @@ func TestClient_DeleteNewRelic_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_newrelicotlp_test.go b/fastly/logging_newrelicotlp_test.go index 8192f5c0..7a320836 100644 --- a/fastly/logging_newrelicotlp_test.go +++ b/fastly/logging_newrelicotlp_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -151,7 +152,7 @@ func TestClient_ListNewRelicOTLP_validation(t *testing.T) { _, err = TestClient.ListNewRelicOTLP(&ListNewRelicOTLPInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -159,7 +160,7 @@ func TestClient_ListNewRelicOTLP_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -169,7 +170,7 @@ func TestClient_CreateNewRelicOTLP_validation(t *testing.T) { _, err = TestClient.CreateNewRelicOTLP(&CreateNewRelicOTLPInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -177,7 +178,7 @@ func TestClient_CreateNewRelicOTLP_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -187,7 +188,7 @@ func TestClient_GetNewRelicOTLP_validation(t *testing.T) { _, err = TestClient.GetNewRelicOTLP(&GetNewRelicOTLPInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -195,7 +196,7 @@ func TestClient_GetNewRelicOTLP_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } @@ -204,7 +205,7 @@ func TestClient_GetNewRelicOTLP_validation(t *testing.T) { ServiceVersion: 1, Name: "", }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } } @@ -214,7 +215,7 @@ func TestClient_UpdateNewRelicOTLP_validation(t *testing.T) { _, err = TestClient.UpdateNewRelicOTLP(&UpdateNewRelicOTLPInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -222,7 +223,7 @@ func TestClient_UpdateNewRelicOTLP_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } @@ -231,7 +232,7 @@ func TestClient_UpdateNewRelicOTLP_validation(t *testing.T) { ServiceVersion: 1, Name: "", }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } } @@ -241,7 +242,7 @@ func TestClient_DeleteNewRelicOTLP_validation(t *testing.T) { err = TestClient.DeleteNewRelicOTLP(&DeleteNewRelicOTLPInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -249,7 +250,7 @@ func TestClient_DeleteNewRelicOTLP_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } @@ -258,7 +259,7 @@ func TestClient_DeleteNewRelicOTLP_validation(t *testing.T) { ServiceVersion: 1, Name: "", }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_openstack_test.go b/fastly/logging_openstack_test.go index c09bbe06..e9ac26e9 100644 --- a/fastly/logging_openstack_test.go +++ b/fastly/logging_openstack_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -357,7 +358,7 @@ func TestClient_ListOpenstack_validation(t *testing.T) { _, err = TestClient.ListOpenstack(&ListOpenstackInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -365,7 +366,7 @@ func TestClient_ListOpenstack_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -375,7 +376,7 @@ func TestClient_CreateOpenstack_validation(t *testing.T) { _, err = TestClient.CreateOpenstack(&CreateOpenstackInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -383,7 +384,7 @@ func TestClient_CreateOpenstack_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -395,7 +396,7 @@ func TestClient_GetOpenstack_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -403,7 +404,7 @@ func TestClient_GetOpenstack_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -411,7 +412,7 @@ func TestClient_GetOpenstack_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -423,7 +424,7 @@ func TestClient_UpdateOpenstack_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -431,7 +432,7 @@ func TestClient_UpdateOpenstack_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -439,7 +440,7 @@ func TestClient_UpdateOpenstack_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -451,7 +452,7 @@ func TestClient_DeleteOpenstack_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -459,7 +460,7 @@ func TestClient_DeleteOpenstack_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -467,7 +468,7 @@ func TestClient_DeleteOpenstack_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_papertrail_test.go b/fastly/logging_papertrail_test.go index e0e2916d..3cc73750 100644 --- a/fastly/logging_papertrail_test.go +++ b/fastly/logging_papertrail_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -149,7 +150,7 @@ func TestClient_ListPapertrails_validation(t *testing.T) { _, err = TestClient.ListPapertrails(&ListPapertrailsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -157,7 +158,7 @@ func TestClient_ListPapertrails_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -168,7 +169,7 @@ func TestClient_CreatePapertrail_validation(t *testing.T) { _, err = TestClient.CreatePapertrail(&CreatePapertrailInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -176,7 +177,7 @@ func TestClient_CreatePapertrail_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -188,7 +189,7 @@ func TestClient_GetPapertrail_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -196,7 +197,7 @@ func TestClient_GetPapertrail_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -204,7 +205,7 @@ func TestClient_GetPapertrail_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -216,7 +217,7 @@ func TestClient_UpdatePapertrail_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -224,7 +225,7 @@ func TestClient_UpdatePapertrail_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -232,7 +233,7 @@ func TestClient_UpdatePapertrail_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -244,7 +245,7 @@ func TestClient_DeletePapertrail_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -252,7 +253,7 @@ func TestClient_DeletePapertrail_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -260,7 +261,7 @@ func TestClient_DeletePapertrail_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_pubsub_test.go b/fastly/logging_pubsub_test.go index 48f4802d..f6dbd014 100644 --- a/fastly/logging_pubsub_test.go +++ b/fastly/logging_pubsub_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "strings" "testing" ) @@ -198,7 +199,7 @@ func TestClient_ListPubsubs_validation(t *testing.T) { _, err = TestClient.ListPubsubs(&ListPubsubsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -206,7 +207,7 @@ func TestClient_ListPubsubs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -216,7 +217,7 @@ func TestClient_CreatePubsub_validation(t *testing.T) { _, err = TestClient.CreatePubsub(&CreatePubsubInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -224,7 +225,7 @@ func TestClient_CreatePubsub_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -236,7 +237,7 @@ func TestClient_GetPubsub_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -244,7 +245,7 @@ func TestClient_GetPubsub_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -252,7 +253,7 @@ func TestClient_GetPubsub_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -264,7 +265,7 @@ func TestClient_UpdatePubsub_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -272,7 +273,7 @@ func TestClient_UpdatePubsub_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -280,7 +281,7 @@ func TestClient_UpdatePubsub_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -292,7 +293,7 @@ func TestClient_DeletePubsub_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -300,7 +301,7 @@ func TestClient_DeletePubsub_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -308,7 +309,7 @@ func TestClient_DeletePubsub_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_s3_test.go b/fastly/logging_s3_test.go index 6d3c36ff..cb774dc2 100644 --- a/fastly/logging_s3_test.go +++ b/fastly/logging_s3_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -619,7 +620,7 @@ func TestClient_ListS3s_validation(t *testing.T) { _, err = TestClient.ListS3s(&ListS3sInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -627,7 +628,7 @@ func TestClient_ListS3s_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -641,7 +642,7 @@ func TestClient_CreateS3_validation(t *testing.T) { ServerSideEncryptionKMSKeyID: ToPointer("1234"), ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -651,7 +652,7 @@ func TestClient_CreateS3_validation(t *testing.T) { ServerSideEncryptionKMSKeyID: ToPointer("1234"), ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } @@ -662,7 +663,7 @@ func TestClient_CreateS3_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingServerSideEncryptionKMSKeyID { + if !errors.Is(err, ErrMissingServerSideEncryptionKMSKeyID) { t.Errorf("bad error: %s", err) } } @@ -674,7 +675,7 @@ func TestClient_GetS3_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -682,7 +683,7 @@ func TestClient_GetS3_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -690,7 +691,7 @@ func TestClient_GetS3_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -702,7 +703,7 @@ func TestClient_UpdateS3_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -710,7 +711,7 @@ func TestClient_UpdateS3_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -718,7 +719,7 @@ func TestClient_UpdateS3_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } @@ -729,7 +730,7 @@ func TestClient_UpdateS3_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingServerSideEncryptionKMSKeyID { + if !errors.Is(err, ErrMissingServerSideEncryptionKMSKeyID) { t.Errorf("bad error: %s", err) } } @@ -741,7 +742,7 @@ func TestClient_DeleteS3_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -749,7 +750,7 @@ func TestClient_DeleteS3_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -757,7 +758,7 @@ func TestClient_DeleteS3_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_scalyr_test.go b/fastly/logging_scalyr_test.go index da655ba8..389ff96a 100644 --- a/fastly/logging_scalyr_test.go +++ b/fastly/logging_scalyr_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -167,7 +168,7 @@ func TestClient_ListScalyrs_validation(t *testing.T) { _, err = TestClient.ListScalyrs(&ListScalyrsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -175,7 +176,7 @@ func TestClient_ListScalyrs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -185,7 +186,7 @@ func TestClient_CreateScalyr_validation(t *testing.T) { _, err = TestClient.CreateScalyr(&CreateScalyrInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -193,7 +194,7 @@ func TestClient_CreateScalyr_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -205,7 +206,7 @@ func TestClient_GetScalyr_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -213,7 +214,7 @@ func TestClient_GetScalyr_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -221,7 +222,7 @@ func TestClient_GetScalyr_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -233,7 +234,7 @@ func TestClient_UpdateScalyr_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -241,7 +242,7 @@ func TestClient_UpdateScalyr_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -249,7 +250,7 @@ func TestClient_UpdateScalyr_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -261,7 +262,7 @@ func TestClient_DeleteScalyr_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -269,7 +270,7 @@ func TestClient_DeleteScalyr_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -277,7 +278,7 @@ func TestClient_DeleteScalyr_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_sftp_test.go b/fastly/logging_sftp_test.go index a02f4d1e..22e9f3e6 100644 --- a/fastly/logging_sftp_test.go +++ b/fastly/logging_sftp_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "strings" "testing" ) @@ -381,7 +382,7 @@ func TestClient_ListSFTPs_validation(t *testing.T) { _, err = TestClient.ListSFTPs(&ListSFTPsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -389,7 +390,7 @@ func TestClient_ListSFTPs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -400,7 +401,7 @@ func TestClient_CreateSFTP_validation(t *testing.T) { _, err = TestClient.CreateSFTP(&CreateSFTPInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -408,7 +409,7 @@ func TestClient_CreateSFTP_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -420,7 +421,7 @@ func TestClient_GetSFTP_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -428,7 +429,7 @@ func TestClient_GetSFTP_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -436,7 +437,7 @@ func TestClient_GetSFTP_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -448,7 +449,7 @@ func TestClient_UpdateSFTP_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -456,7 +457,7 @@ func TestClient_UpdateSFTP_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -464,7 +465,7 @@ func TestClient_UpdateSFTP_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -476,7 +477,7 @@ func TestClient_DeleteSFTP_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -484,7 +485,7 @@ func TestClient_DeleteSFTP_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -492,7 +493,7 @@ func TestClient_DeleteSFTP_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_splunk_test.go b/fastly/logging_splunk_test.go index 473afa7f..e92d9d67 100644 --- a/fastly/logging_splunk_test.go +++ b/fastly/logging_splunk_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "strings" "testing" ) @@ -218,7 +219,7 @@ func TestClient_ListSplunks_validation(t *testing.T) { _, err = TestClient.ListSplunks(&ListSplunksInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -226,7 +227,7 @@ func TestClient_ListSplunks_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -236,7 +237,7 @@ func TestClient_CreateSplunk_validation(t *testing.T) { _, err = TestClient.CreateSplunk(&CreateSplunkInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -244,7 +245,7 @@ func TestClient_CreateSplunk_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -256,7 +257,7 @@ func TestClient_GetSplunk_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -264,7 +265,7 @@ func TestClient_GetSplunk_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -272,7 +273,7 @@ func TestClient_GetSplunk_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -284,7 +285,7 @@ func TestClient_UpdateSplunk_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -292,7 +293,7 @@ func TestClient_UpdateSplunk_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -300,7 +301,7 @@ func TestClient_UpdateSplunk_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -312,7 +313,7 @@ func TestClient_DeleteSplunk_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -320,7 +321,7 @@ func TestClient_DeleteSplunk_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -328,7 +329,7 @@ func TestClient_DeleteSplunk_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_sumologic_test.go b/fastly/logging_sumologic_test.go index 9a9c3c48..ccff1998 100644 --- a/fastly/logging_sumologic_test.go +++ b/fastly/logging_sumologic_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -148,7 +149,7 @@ func TestClient_ListSumologics_validation(t *testing.T) { _, err = TestClient.ListSumologics(&ListSumologicsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -156,7 +157,7 @@ func TestClient_ListSumologics_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -166,7 +167,7 @@ func TestClient_CreateSumologic_validation(t *testing.T) { _, err = TestClient.CreateSumologic(&CreateSumologicInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -174,7 +175,7 @@ func TestClient_CreateSumologic_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -186,7 +187,7 @@ func TestClient_GetSumologic_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -194,7 +195,7 @@ func TestClient_GetSumologic_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -202,7 +203,7 @@ func TestClient_GetSumologic_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -214,7 +215,7 @@ func TestClient_UpdateSumologic_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -222,7 +223,7 @@ func TestClient_UpdateSumologic_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -230,7 +231,7 @@ func TestClient_UpdateSumologic_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -242,7 +243,7 @@ func TestClient_DeleteSumologic_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -250,7 +251,7 @@ func TestClient_DeleteSumologic_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -258,7 +259,7 @@ func TestClient_DeleteSumologic_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/logging_syslog_test.go b/fastly/logging_syslog_test.go index 68dc0222..309f1c2c 100644 --- a/fastly/logging_syslog_test.go +++ b/fastly/logging_syslog_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "strings" "testing" ) @@ -230,7 +231,7 @@ func TestClient_ListSyslogs_validation(t *testing.T) { _, err = TestClient.ListSyslogs(&ListSyslogsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -238,7 +239,7 @@ func TestClient_ListSyslogs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -248,7 +249,7 @@ func TestClient_CreateSyslog_validation(t *testing.T) { _, err = TestClient.CreateSyslog(&CreateSyslogInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -256,7 +257,7 @@ func TestClient_CreateSyslog_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -268,7 +269,7 @@ func TestClient_GetSyslog_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -276,7 +277,7 @@ func TestClient_GetSyslog_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -284,7 +285,7 @@ func TestClient_GetSyslog_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -296,7 +297,7 @@ func TestClient_UpdateSyslog_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -304,7 +305,7 @@ func TestClient_UpdateSyslog_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -312,7 +313,7 @@ func TestClient_UpdateSyslog_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -324,7 +325,7 @@ func TestClient_DeleteSyslog_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -332,7 +333,7 @@ func TestClient_DeleteSyslog_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -340,7 +341,7 @@ func TestClient_DeleteSyslog_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/managed_logging_test.go b/fastly/managed_logging_test.go index d2298e87..64a5073a 100644 --- a/fastly/managed_logging_test.go +++ b/fastly/managed_logging_test.go @@ -1,6 +1,9 @@ package fastly -import "testing" +import ( + "errors" + "testing" +) func TestClient_ManagedLogging(t *testing.T) { t.Parallel() @@ -26,7 +29,7 @@ func TestClient_ManagedLogging(t *testing.T) { Kind: ManagedLoggingInstanceOutput, }) }) - if err != ErrManagedLoggingEnabled { + if !errors.Is(err, ErrManagedLoggingEnabled) { t.Errorf("unexpected error: %s", err) } @@ -47,14 +50,14 @@ func TestClient_CreateManagedLogging_validation(t *testing.T) { ServiceID: "", Kind: ManagedLoggingInstanceOutput, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("unexpected error: %s", err) } _, err = TestClient.CreateManagedLogging(&CreateManagedLoggingInput{ ServiceID: TestDeliveryServiceID, }) - if err != ErrMissingKind { + if !errors.Is(err, ErrMissingKind) { t.Errorf("unexpected error: %s", err) } @@ -62,7 +65,7 @@ func TestClient_CreateManagedLogging_validation(t *testing.T) { ServiceID: TestDeliveryServiceID, Kind: 999, }) - if err != ErrNotImplemented { + if !errors.Is(err, ErrNotImplemented) { t.Errorf("unexpected error: %s", err) } } @@ -72,14 +75,14 @@ func TestClient_DeleteManagedLogging_validation(t *testing.T) { ServiceID: "", Kind: ManagedLoggingInstanceOutput, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("unexpected error: %s", err) } err = TestClient.DeleteManagedLogging(&DeleteManagedLoggingInput{ ServiceID: TestDeliveryServiceID, }) - if err != ErrMissingKind { + if !errors.Is(err, ErrMissingKind) { t.Errorf("unexpected error: %s", err) } @@ -87,7 +90,7 @@ func TestClient_DeleteManagedLogging_validation(t *testing.T) { ServiceID: TestDeliveryServiceID, Kind: 999, }) - if err != ErrNotImplemented { + if !errors.Is(err, ErrNotImplemented) { t.Errorf("unexpected error: %s", err) } } diff --git a/fastly/notifications_test.go b/fastly/notifications_test.go index 0d29df6c..0f49bf97 100644 --- a/fastly/notifications_test.go +++ b/fastly/notifications_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -171,35 +172,35 @@ func TestClient_Notifications(t *testing.T) { func TestClient_GetIntegration_validation(t *testing.T) { _, err := TestClient.GetIntegration(&GetIntegrationInput{}) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } func TestClient_UpdateIntegration_validation(t *testing.T) { err := TestClient.UpdateIntegration(&UpdateIntegrationInput{}) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } func TestClient_DeleteIntegration_validation(t *testing.T) { err := TestClient.DeleteIntegration(&DeleteIntegrationInput{}) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } func TestClient_GetWebhookSigningKey_validation(t *testing.T) { _, err := TestClient.GetWebhookSigningKey(&GetWebhookSigningKeyInput{}) - if err != ErrMissingIntegrationID { + if !errors.Is(err, ErrMissingIntegrationID) { t.Errorf("bad error: %s", err) } } func TestClient_RotateWebhookSigningKey_validation(t *testing.T) { _, err := TestClient.RotateWebhookSigningKey(&RotateWebhookSigningKeyInput{}) - if err != ErrMissingIntegrationID { + if !errors.Is(err, ErrMissingIntegrationID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/product_enablement_bot_management_test.go b/fastly/product_enablement_bot_management_test.go index 420c7439..f9322361 100644 --- a/fastly/product_enablement_bot_management_test.go +++ b/fastly/product_enablement_bot_management_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -73,14 +74,14 @@ func TestClient_GetProduct_validation_bot_management(t *testing.T) { _, err = TestClient.GetProduct(&ProductEnablementInput{ ProductID: ProductBotManagement, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -90,14 +91,14 @@ func TestClient_EnableProduct_validation_bot_management(t *testing.T) { _, err = TestClient.EnableProduct(&ProductEnablementInput{ ProductID: ProductBotManagement, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.EnableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -108,14 +109,14 @@ func TestClient_DisableProduct_validation_bot_management(t *testing.T) { err = TestClient.DisableProduct(&ProductEnablementInput{ ProductID: ProductBotManagement, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } err = TestClient.DisableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/product_enablement_brotli_compression_test.go b/fastly/product_enablement_brotli_compression_test.go index 7a041de6..2014a4bc 100644 --- a/fastly/product_enablement_brotli_compression_test.go +++ b/fastly/product_enablement_brotli_compression_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -73,14 +74,14 @@ func TestClient_GetProduct_validation_brotli_compression(t *testing.T) { _, err = TestClient.GetProduct(&ProductEnablementInput{ ProductID: ProductBrotliCompression, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -90,14 +91,14 @@ func TestClient_EnableProduct_validation_brotli_compression(t *testing.T) { _, err = TestClient.EnableProduct(&ProductEnablementInput{ ProductID: ProductBrotliCompression, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.EnableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -108,14 +109,14 @@ func TestClient_DisableProduct_validation_brotli_compression(t *testing.T) { err = TestClient.DisableProduct(&ProductEnablementInput{ ProductID: ProductBrotliCompression, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } err = TestClient.DisableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/product_enablement_domain_inspector_test.go b/fastly/product_enablement_domain_inspector_test.go index d2cd025f..2a283862 100644 --- a/fastly/product_enablement_domain_inspector_test.go +++ b/fastly/product_enablement_domain_inspector_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -73,14 +74,14 @@ func TestClient_GetProduct_validation_domain_inspector(t *testing.T) { _, err = TestClient.GetProduct(&ProductEnablementInput{ ProductID: ProductDomainInspector, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -90,14 +91,14 @@ func TestClient_EnableProduct_validation_domain_inspector(t *testing.T) { _, err = TestClient.EnableProduct(&ProductEnablementInput{ ProductID: ProductDomainInspector, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.EnableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -108,14 +109,14 @@ func TestClient_DisableProduct_validation_domain_inspector(t *testing.T) { err = TestClient.DisableProduct(&ProductEnablementInput{ ProductID: ProductDomainInspector, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } err = TestClient.DisableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/product_enablement_fanout_test.go b/fastly/product_enablement_fanout_test.go index c080b635..8d950a34 100644 --- a/fastly/product_enablement_fanout_test.go +++ b/fastly/product_enablement_fanout_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -73,14 +74,14 @@ func TestClient_GetProduct_validation_fanout(t *testing.T) { _, err = TestClient.GetProduct(&ProductEnablementInput{ ProductID: ProductFanout, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -90,14 +91,14 @@ func TestClient_EnableProduct_validation_fanout(t *testing.T) { _, err = TestClient.EnableProduct(&ProductEnablementInput{ ProductID: ProductFanout, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.EnableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -108,14 +109,14 @@ func TestClient_DisableProduct_validation_fanout(t *testing.T) { err = TestClient.DisableProduct(&ProductEnablementInput{ ProductID: ProductFanout, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } err = TestClient.DisableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/product_enablement_image_optimizer_test.go b/fastly/product_enablement_image_optimizer_test.go index 4cb7fc00..7c1317ad 100644 --- a/fastly/product_enablement_image_optimizer_test.go +++ b/fastly/product_enablement_image_optimizer_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -73,14 +74,14 @@ func TestClient_GetProduct_validation_image_optimizer(t *testing.T) { _, err = TestClient.GetProduct(&ProductEnablementInput{ ProductID: ProductImageOptimizer, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -90,14 +91,14 @@ func TestClient_EnableProduct_validation_image_optimizer(t *testing.T) { _, err = TestClient.EnableProduct(&ProductEnablementInput{ ProductID: ProductImageOptimizer, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.EnableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -108,14 +109,14 @@ func TestClient_DisableProduct_validation_image_optimizer(t *testing.T) { err = TestClient.DisableProduct(&ProductEnablementInput{ ProductID: ProductImageOptimizer, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } err = TestClient.DisableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/product_enablement_log_explorer_insights_test.go b/fastly/product_enablement_log_explorer_insights_test.go index 985ee20e..2469a2f2 100644 --- a/fastly/product_enablement_log_explorer_insights_test.go +++ b/fastly/product_enablement_log_explorer_insights_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -73,14 +74,14 @@ func TestClient_GetProduct_validation_log_explorer_insights(t *testing.T) { _, err = TestClient.GetProduct(&ProductEnablementInput{ ProductID: ProductLogExplorerInsights, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -90,14 +91,14 @@ func TestClient_EnableProduct_validation_log_explorer_insights(t *testing.T) { _, err = TestClient.EnableProduct(&ProductEnablementInput{ ProductID: ProductLogExplorerInsights, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.EnableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -108,14 +109,14 @@ func TestClient_DisableProduct_validation_log_explorer_insights(t *testing.T) { err = TestClient.DisableProduct(&ProductEnablementInput{ ProductID: ProductLogExplorerInsights, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } err = TestClient.DisableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/product_enablement_origin_inspector_test.go b/fastly/product_enablement_origin_inspector_test.go index f46d4504..72be66eb 100644 --- a/fastly/product_enablement_origin_inspector_test.go +++ b/fastly/product_enablement_origin_inspector_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -73,14 +74,14 @@ func TestClient_GetProduct_validation_origin_inspector(t *testing.T) { _, err = TestClient.GetProduct(&ProductEnablementInput{ ProductID: ProductOriginInspector, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -90,14 +91,14 @@ func TestClient_EnableProduct_validation_origin_inspector(t *testing.T) { _, err = TestClient.EnableProduct(&ProductEnablementInput{ ProductID: ProductOriginInspector, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.EnableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -108,14 +109,14 @@ func TestClient_DisableProduct_validation_origin_inspector(t *testing.T) { err = TestClient.DisableProduct(&ProductEnablementInput{ ProductID: ProductOriginInspector, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } err = TestClient.DisableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/product_enablement_websockets_test.go b/fastly/product_enablement_websockets_test.go index d87d3841..d3d8a817 100644 --- a/fastly/product_enablement_websockets_test.go +++ b/fastly/product_enablement_websockets_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -73,14 +74,14 @@ func TestClient_GetProduct_validation_websockets(t *testing.T) { _, err = TestClient.GetProduct(&ProductEnablementInput{ ProductID: ProductWebSockets, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -90,14 +91,14 @@ func TestClient_EnableProduct_validation_websockets(t *testing.T) { _, err = TestClient.EnableProduct(&ProductEnablementInput{ ProductID: ProductWebSockets, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.EnableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } @@ -108,14 +109,14 @@ func TestClient_DisableProduct_validation_websockets(t *testing.T) { err = TestClient.DisableProduct(&ProductEnablementInput{ ProductID: ProductWebSockets, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } err = TestClient.DisableProduct(&ProductEnablementInput{ ServiceID: "foo", }) - if err != ErrMissingProductID { + if !errors.Is(err, ErrMissingProductID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/resource_test.go b/fastly/resource_test.go index b142f073..e5771ba7 100644 --- a/fastly/resource_test.go +++ b/fastly/resource_test.go @@ -3,6 +3,7 @@ package fastly import ( "bytes" "encoding/json" + "errors" "testing" "time" ) @@ -136,7 +137,7 @@ func TestClient_ListResources_validation(t *testing.T) { _, err = TestClient.ListResources(&ListResourcesInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -144,7 +145,7 @@ func TestClient_ListResources_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -154,7 +155,7 @@ func TestClient_CreateResource_validation(t *testing.T) { _, err = TestClient.CreateResource(&CreateResourceInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -162,7 +163,7 @@ func TestClient_CreateResource_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -174,7 +175,7 @@ func TestClient_GetResource_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingResourceID { + if !errors.Is(err, ErrMissingResourceID) { t.Errorf("bad error: %s", err) } @@ -182,7 +183,7 @@ func TestClient_GetResource_validation(t *testing.T) { ResourceID: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -190,7 +191,7 @@ func TestClient_GetResource_validation(t *testing.T) { ResourceID: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -202,7 +203,7 @@ func TestClient_UpdateResource_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingResourceID { + if !errors.Is(err, ErrMissingResourceID) { t.Errorf("bad error: %s", err) } @@ -210,7 +211,7 @@ func TestClient_UpdateResource_validation(t *testing.T) { ResourceID: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -218,7 +219,7 @@ func TestClient_UpdateResource_validation(t *testing.T) { ResourceID: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -230,7 +231,7 @@ func TestClient_DeleteResource_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingResourceID { + if !errors.Is(err, ErrMissingResourceID) { t.Errorf("bad error: %s", err) } @@ -238,7 +239,7 @@ func TestClient_DeleteResource_validation(t *testing.T) { ResourceID: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -246,7 +247,7 @@ func TestClient_DeleteResource_validation(t *testing.T) { ResourceID: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/secret_store_test.go b/fastly/secret_store_test.go index 1406d66e..f5d08449 100644 --- a/fastly/secret_store_test.go +++ b/fastly/secret_store_test.go @@ -3,6 +3,7 @@ package fastly import ( "bytes" "crypto/ed25519" + "errors" "fmt" "net/http" "sort" @@ -473,21 +474,21 @@ func TestClient_SecretStore_validation(t *testing.T) { _, err = TestClient.CreateSecretStore(&CreateSecretStoreInput{ Name: "", }) - if want := ErrMissingName; err != want { + if want := ErrMissingName; !errors.Is(want, err) { t.Errorf("CreateSecretStore: got error %v, want %v", err, want) } _, err = TestClient.GetSecretStore(&GetSecretStoreInput{ StoreID: "", }) - if want := ErrMissingStoreID; err != want { + if want := ErrMissingStoreID; !errors.Is(want, err) { t.Errorf("GetSecretStore: got error %v, want %v", err, want) } err = TestClient.DeleteSecretStore(&DeleteSecretStoreInput{ StoreID: "", }) - if want := ErrMissingStoreID; err != want { + if want := ErrMissingStoreID; !errors.Is(want, err) { t.Errorf("DeleteSecretStore: got error %v, want %v", err, want) } @@ -496,7 +497,7 @@ func TestClient_SecretStore_validation(t *testing.T) { Name: "name", Secret: []byte("secret"), }) - if want := ErrMissingStoreID; err != want { + if want := ErrMissingStoreID; !errors.Is(want, err) { t.Errorf("CreateSecret: got error %v, want %v", err, want) } _, err = TestClient.CreateSecret(&CreateSecretInput{ @@ -504,7 +505,7 @@ func TestClient_SecretStore_validation(t *testing.T) { Name: "", Secret: []byte("secret"), }) - if want := ErrMissingName; err != want { + if want := ErrMissingName; !errors.Is(want, err) { t.Errorf("CreateSecret: got error %v, want %v", err, want) } _, err = TestClient.CreateSecret(&CreateSecretInput{ @@ -512,14 +513,14 @@ func TestClient_SecretStore_validation(t *testing.T) { Name: "name", Secret: []byte(nil), }) - if want := ErrMissingSecret; err != want { + if want := ErrMissingSecret; !errors.Is(want, err) { t.Errorf("CreateSecret: got error %v, want %v", err, want) } _, err = TestClient.ListSecrets(&ListSecretsInput{ StoreID: "", }) - if want := ErrMissingStoreID; err != want { + if want := ErrMissingStoreID; !errors.Is(want, err) { t.Errorf("ListSecrets: got error %v, want %v", err, want) } @@ -527,14 +528,14 @@ func TestClient_SecretStore_validation(t *testing.T) { StoreID: "", Name: "name", }) - if want := ErrMissingStoreID; err != want { + if want := ErrMissingStoreID; !errors.Is(want, err) { t.Errorf("GetSecret: got error %v, want %v", err, want) } _, err = TestClient.GetSecret(&GetSecretInput{ StoreID: "id", Name: "", }) - if want := ErrMissingName; err != want { + if want := ErrMissingName; !errors.Is(want, err) { t.Errorf("GetSecret: got error %v, want %v", err, want) } @@ -542,14 +543,14 @@ func TestClient_SecretStore_validation(t *testing.T) { StoreID: "", Name: "name", }) - if want := ErrMissingStoreID; err != want { + if want := ErrMissingStoreID; !errors.Is(want, err) { t.Errorf("DeleteSecret: got error %v, want %v", err, want) } err = TestClient.DeleteSecret(&DeleteSecretInput{ StoreID: "id", Name: "", }) - if want := ErrMissingName; err != want { + if want := ErrMissingName; !errors.Is(want, err) { t.Errorf("DeleteSecret: got error %v, want %v", err, want) } } diff --git a/fastly/service_authorization_test.go b/fastly/service_authorization_test.go index 6349f52d..68645047 100644 --- a/fastly/service_authorization_test.go +++ b/fastly/service_authorization_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "reflect" "testing" ) @@ -109,7 +110,7 @@ func TestClient_GetServiceAuthorization_validation(t *testing.T) { _, err = TestClient.GetServiceAuthorization(&GetServiceAuthorizationInput{ ID: "", }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -120,7 +121,7 @@ func TestClient_CreateServiceAuthorization_validation(t *testing.T) { Service: &SAService{ID: ""}, User: &SAUser{ID: ""}, }) - if err != ErrMissingServiceAuthorizationsService { + if !errors.Is(err, ErrMissingServiceAuthorizationsService) { t.Errorf("bad error: %s", err) } @@ -128,7 +129,7 @@ func TestClient_CreateServiceAuthorization_validation(t *testing.T) { Service: &SAService{ID: "my-service-id"}, User: &SAUser{ID: ""}, }) - if err != ErrMissingServiceAuthorizationsUser { + if !errors.Is(err, ErrMissingServiceAuthorizationsUser) { t.Errorf("bad error: %s", err) } } @@ -139,7 +140,7 @@ func TestClient_UpdateServiceAuthorization_validation(t *testing.T) { ID: "", Permission: "", }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } @@ -147,7 +148,7 @@ func TestClient_UpdateServiceAuthorization_validation(t *testing.T) { ID: "my-service-authorization-id", Permission: "", }) - if err != ErrMissingPermission { + if !errors.Is(err, ErrMissingPermission) { t.Errorf("bad error: %s", err) } } @@ -156,7 +157,7 @@ func TestClient_DeleteServiceAuthorization_validation(t *testing.T) { err := TestClient.DeleteServiceAuthorization(&DeleteServiceAuthorizationInput{ ID: "", }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/service_details_test.go b/fastly/service_details_test.go index b379b9de..b86a6f2e 100644 --- a/fastly/service_details_test.go +++ b/fastly/service_details_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -188,21 +189,21 @@ func TestClient_Services(t *testing.T) { func TestClient_GetService_validation(t *testing.T) { _, err := TestClient.GetService(&GetServiceInput{}) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } func TestClient_UpdateService_validation(t *testing.T) { _, err := TestClient.UpdateService(&UpdateServiceInput{}) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } func TestClient_DeleteService_validation(t *testing.T) { err := TestClient.DeleteService(&DeleteServiceInput{}) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/service_version_test.go b/fastly/service_version_test.go index 05c1db73..fa511fb2 100644 --- a/fastly/service_version_test.go +++ b/fastly/service_version_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -120,7 +121,7 @@ func TestClient_ListVersions_validation(t *testing.T) { _, err = TestClient.ListVersions(&ListVersionsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -130,7 +131,7 @@ func TestClient_CreateVersion_validation(t *testing.T) { _, err = TestClient.CreateVersion(&CreateVersionInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } @@ -140,7 +141,7 @@ func TestClient_GetVersion_validation(t *testing.T) { _, err = TestClient.GetVersion(&GetVersionInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -148,7 +149,7 @@ func TestClient_GetVersion_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -158,7 +159,7 @@ func TestClient_UpdateVersion_validation(t *testing.T) { _, err = TestClient.UpdateVersion(&UpdateVersionInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -166,7 +167,7 @@ func TestClient_UpdateVersion_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -176,7 +177,7 @@ func TestClient_ActivateVersion_validation(t *testing.T) { _, err = TestClient.ActivateVersion(&ActivateVersionInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -184,7 +185,7 @@ func TestClient_ActivateVersion_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -194,7 +195,7 @@ func TestClient_DeactivateVersion_validation(t *testing.T) { _, err = TestClient.DeactivateVersion(&DeactivateVersionInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -202,7 +203,7 @@ func TestClient_DeactivateVersion_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -212,7 +213,7 @@ func TestClient_CloneVersion_validation(t *testing.T) { _, err = TestClient.CloneVersion(&CloneVersionInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -220,7 +221,7 @@ func TestClient_CloneVersion_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -230,7 +231,7 @@ func TestClient_ValidateVersion_validation(t *testing.T) { _, _, err = TestClient.ValidateVersion(&ValidateVersionInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -238,7 +239,7 @@ func TestClient_ValidateVersion_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -248,7 +249,7 @@ func TestClient_LockVersion_validation(t *testing.T) { _, err = TestClient.LockVersion(&LockVersionInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -256,7 +257,7 @@ func TestClient_LockVersion_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/stats_realtime_test.go b/fastly/stats_realtime_test.go index d75d9fd8..a627c4a2 100644 --- a/fastly/stats_realtime_test.go +++ b/fastly/stats_realtime_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -9,7 +10,7 @@ func TestClient_GetRealtimeStats_validation(t *testing.T) { _, err = TestStatsClient.GetRealtimeStats(&GetRealtimeStatsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/tls_custom_activation_test.go b/fastly/tls_custom_activation_test.go index 88b839be..740972de 100644 --- a/fastly/tls_custom_activation_test.go +++ b/fastly/tls_custom_activation_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -121,7 +122,7 @@ func TestClient_CreateTLSActivation_validation(t *testing.T) { Configuration: &TLSConfiguration{ID: "CONFIGURATION_ID"}, Domain: &TLSDomain{ID: "DOMAIN_NAME"}, }) - if err != ErrMissingTLSCertificate { + if !errors.Is(err, ErrMissingTLSCertificate) { t.Errorf("bad error: %s", err) } @@ -129,7 +130,7 @@ func TestClient_CreateTLSActivation_validation(t *testing.T) { Certificate: &CustomTLSCertificate{ID: "CERTIFICATE_ID"}, Configuration: &TLSConfiguration{ID: "CONFIGURATION_ID"}, }) - if err != ErrMissingTLSDomain { + if !errors.Is(err, ErrMissingTLSDomain) { t.Errorf("bad error: %s", err) } } @@ -148,7 +149,7 @@ func TestClient_DeleteTLSActivation_validation(t *testing.T) { } err = TestClient.DeleteTLSActivation(&DeleteTLSActivationInput{}) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -179,7 +180,7 @@ func TestClient_GetTLSActivation_validation(t *testing.T) { } _, err = TestClient.GetTLSActivation(&GetTLSActivationInput{}) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -201,14 +202,14 @@ func TestClient_UpdateTLSActivation_validation(t *testing.T) { _, err = TestClient.UpdateTLSActivation(&UpdateTLSActivationInput{ ID: "ACTIVATION_ID", }) - if err != ErrMissingCertificateMTLS { + if !errors.Is(err, ErrMissingCertificateMTLS) { t.Errorf("bad error: %s", err) } _, err = TestClient.UpdateTLSActivation(&UpdateTLSActivationInput{ Certificate: &CustomTLSCertificate{ID: "CERTIFICATE_ID"}, }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/tls_custom_certificate_test.go b/fastly/tls_custom_certificate_test.go index ff7c75bb..4cb5040f 100644 --- a/fastly/tls_custom_certificate_test.go +++ b/fastly/tls_custom_certificate_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -142,7 +143,7 @@ func TestClient_CreateCustomTLSCertificate_validation(t *testing.T) { _, err = TestClient.CreateCustomTLSCertificate(&CreateCustomTLSCertificateInput{ Name: "My certificate", }) - if err != ErrMissingCertBlob { + if !errors.Is(err, ErrMissingCertBlob) { t.Errorf("bad error: %s", err) } } @@ -151,7 +152,7 @@ func TestClient_DeleteCustomTLSCertificate_validation(t *testing.T) { t.Parallel() err := TestClient.DeleteCustomTLSCertificate(&DeleteCustomTLSCertificateInput{}) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -175,7 +176,7 @@ func TestClient_GetCustomTLSCertificate_validation(t *testing.T) { var err error _, err = TestClient.GetCustomTLSCertificate(&GetCustomTLSCertificateInput{}) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -188,7 +189,7 @@ func TestClient_UpdateCustomTLSCertificate_validation(t *testing.T) { CertBlob: "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n", Name: "My certificate", }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } @@ -196,7 +197,7 @@ func TestClient_UpdateCustomTLSCertificate_validation(t *testing.T) { ID: "CERTIFICATE_ID", Name: "My certificate", }) - if err != ErrMissingCertBlob { + if !errors.Is(err, ErrMissingCertBlob) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/tls_custom_configuration_test.go b/fastly/tls_custom_configuration_test.go index 3c4eb52b..d6e745fa 100644 --- a/fastly/tls_custom_configuration_test.go +++ b/fastly/tls_custom_configuration_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -84,7 +85,7 @@ func TestClient_GetCustomTLSConfiguration_validation(t *testing.T) { } _, err = TestClient.GetCustomTLSConfiguration(&GetCustomTLSConfigurationInput{}) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -106,14 +107,14 @@ func TestClient_UpdateCustomTLSConfiguration_validation(t *testing.T) { _, err = TestClient.UpdateCustomTLSConfiguration(&UpdateCustomTLSConfigurationInput{ Name: "My configuration v2", }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } _, err = TestClient.UpdateCustomTLSConfiguration(&UpdateCustomTLSConfigurationInput{ ID: "CONFIGURATION_ID", }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/tls_mutual_authentication_test.go b/fastly/tls_mutual_authentication_test.go index e4356468..5863602c 100644 --- a/fastly/tls_mutual_authentication_test.go +++ b/fastly/tls_mutual_authentication_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -154,7 +155,7 @@ func TestClient_CreateTLSMutualAuthentication_validation(t *testing.T) { _, err = TestClient.CreateTLSMutualAuthentication(&CreateTLSMutualAuthenticationInput{ Name: "My certificate", }) - if err != ErrMissingCertBundle { + if !errors.Is(err, ErrMissingCertBundle) { t.Errorf("bad error: %s", err) } } @@ -163,7 +164,7 @@ func TestClient_DeleteTLSMutualAuthentication_validation(t *testing.T) { t.Parallel() err := TestClient.DeleteTLSMutualAuthentication(&DeleteTLSMutualAuthenticationInput{}) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -185,7 +186,7 @@ func TestClient_GetTLSMutualAuthentication_validation(t *testing.T) { var err error _, err = TestClient.GetCustomTLSCertificate(&GetCustomTLSCertificateInput{}) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -198,7 +199,7 @@ func TestClient_UpdateTLSMutualAuthentication_validation(t *testing.T) { ID: "example", Name: "My certificate", }) - if err != ErrMissingCertBundle { + if !errors.Is(err, ErrMissingCertBundle) { t.Errorf("bad error: %s", err) } @@ -206,7 +207,7 @@ func TestClient_UpdateTLSMutualAuthentication_validation(t *testing.T) { CertBundle: "example", Name: "My certificate", }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/tls_subscription_test.go b/fastly/tls_subscription_test.go index ca0c1000..c807335d 100644 --- a/fastly/tls_subscription_test.go +++ b/fastly/tls_subscription_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -207,7 +208,7 @@ func TestClient_CreateTLSSubscription_validation(t *testing.T) { } _, err = TestClient.CreateTLSSubscription(&CreateTLSSubscriptionInput{}) - if err != ErrMissingTLSDomain { + if !errors.Is(err, ErrMissingTLSDomain) { t.Errorf("bad error: %s", err) } @@ -218,7 +219,7 @@ func TestClient_CreateTLSSubscription_validation(t *testing.T) { }, CommonName: &TLSDomain{ID: "DN3"}, }) - if err != ErrCommonNameNotInDomains { + if !errors.Is(err, ErrCommonNameNotInDomains) { t.Errorf("bad error: %s", err) } } @@ -227,7 +228,7 @@ func TestClient_GetTLSSubscription_validation(t *testing.T) { t.Parallel() _, err := TestClient.GetTLSSubscription(&GetTLSSubscriptionInput{}) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -236,7 +237,7 @@ func TestClient_UpdateTLSSubscription_validation(t *testing.T) { t.Parallel() _, err := TestClient.UpdateTLSSubscription(&UpdateTLSSubscriptionInput{}) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -245,7 +246,7 @@ func TestClient_DeleteTLSSubscription_validation(t *testing.T) { t.Parallel() err := TestClient.DeleteTLSSubscription(&DeleteTLSSubscriptionInput{}) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/user_test.go b/fastly/user_test.go index 687d692b..12bbd9d7 100644 --- a/fastly/user_test.go +++ b/fastly/user_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -137,7 +138,7 @@ func TestClient_ListCustomerUsers_validation(t *testing.T) { _, err = TestClient.ListCustomerUsers(&ListCustomerUsersInput{ CustomerID: "", }) - if err != ErrMissingCustomerID { + if !errors.Is(err, ErrMissingCustomerID) { t.Errorf("bad error: %s", err) } } @@ -147,7 +148,7 @@ func TestClient_GetUser_validation(t *testing.T) { _, err = TestClient.GetUser(&GetUserInput{ UserID: "", }) - if err != ErrMissingUserID { + if !errors.Is(err, ErrMissingUserID) { t.Errorf("bad error: %s", err) } } @@ -157,7 +158,7 @@ func TestClient_UpdateUser_validation(t *testing.T) { _, err = TestClient.UpdateUser(&UpdateUserInput{ UserID: "", }) - if err != ErrMissingUserID { + if !errors.Is(err, ErrMissingUserID) { t.Errorf("bad error: %s", err) } } @@ -166,7 +167,7 @@ func TestClient_DeleteUser_validation(t *testing.T) { err := TestClient.DeleteUser(&DeleteUserInput{ UserID: "", }) - if err != ErrMissingUserID { + if !errors.Is(err, ErrMissingUserID) { t.Errorf("bad error: %s", err) } } @@ -175,7 +176,7 @@ func TestClient_ResetUser_validation(t *testing.T) { err := TestClient.ResetUserPassword(&ResetUserPasswordInput{ Login: "", }) - if err != ErrMissingLogin { + if !errors.Is(err, ErrMissingLogin) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/vcl_cache_setting_test.go b/fastly/vcl_cache_setting_test.go index 0a8e62c9..63459644 100644 --- a/fastly/vcl_cache_setting_test.go +++ b/fastly/vcl_cache_setting_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -134,7 +135,7 @@ func TestClient_ListCacheSettings_validation(t *testing.T) { _, err = TestClient.ListCacheSettings(&ListCacheSettingsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -142,7 +143,7 @@ func TestClient_ListCacheSettings_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -152,7 +153,7 @@ func TestClient_CreateCacheSetting_validation(t *testing.T) { _, err = TestClient.CreateCacheSetting(&CreateCacheSettingInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -160,7 +161,7 @@ func TestClient_CreateCacheSetting_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -172,7 +173,7 @@ func TestClient_GetCacheSetting_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -180,7 +181,7 @@ func TestClient_GetCacheSetting_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -188,7 +189,7 @@ func TestClient_GetCacheSetting_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -200,7 +201,7 @@ func TestClient_UpdateCacheSetting_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -208,7 +209,7 @@ func TestClient_UpdateCacheSetting_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -216,7 +217,7 @@ func TestClient_UpdateCacheSetting_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -228,7 +229,7 @@ func TestClient_DeleteCacheSetting_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -236,7 +237,7 @@ func TestClient_DeleteCacheSetting_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -244,7 +245,7 @@ func TestClient_DeleteCacheSetting_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/vcl_condition_test.go b/fastly/vcl_condition_test.go index e34bca4c..ae747bbf 100644 --- a/fastly/vcl_condition_test.go +++ b/fastly/vcl_condition_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -128,7 +129,7 @@ func TestClient_ListConditions_validation(t *testing.T) { _, err = TestClient.ListConditions(&ListConditionsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -136,7 +137,7 @@ func TestClient_ListConditions_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -146,7 +147,7 @@ func TestClient_CreateCondition_validation(t *testing.T) { _, err = TestClient.CreateCondition(&CreateConditionInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -154,7 +155,7 @@ func TestClient_CreateCondition_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -166,7 +167,7 @@ func TestClient_GetCondition_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -174,7 +175,7 @@ func TestClient_GetCondition_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -182,7 +183,7 @@ func TestClient_GetCondition_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -194,7 +195,7 @@ func TestClient_UpdateCondition_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -202,7 +203,7 @@ func TestClient_UpdateCondition_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -210,7 +211,7 @@ func TestClient_UpdateCondition_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -222,7 +223,7 @@ func TestClient_DeleteCondition_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -230,7 +231,7 @@ func TestClient_DeleteCondition_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -238,7 +239,7 @@ func TestClient_DeleteCondition_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/vcl_custom_test.go b/fastly/vcl_custom_test.go index ede62b5a..2f0dbe72 100644 --- a/fastly/vcl_custom_test.go +++ b/fastly/vcl_custom_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -157,7 +158,7 @@ func TestClient_ListVCLs_validation(t *testing.T) { _, err = TestClient.ListVCLs(&ListVCLsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -165,7 +166,7 @@ func TestClient_ListVCLs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -175,7 +176,7 @@ func TestClient_CreateVCL_validation(t *testing.T) { _, err = TestClient.CreateVCL(&CreateVCLInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -183,7 +184,7 @@ func TestClient_CreateVCL_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -195,7 +196,7 @@ func TestClient_GetVCL_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -203,7 +204,7 @@ func TestClient_GetVCL_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -211,7 +212,7 @@ func TestClient_GetVCL_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -223,7 +224,7 @@ func TestClient_UpdateVCL_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -231,7 +232,7 @@ func TestClient_UpdateVCL_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -239,7 +240,7 @@ func TestClient_UpdateVCL_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -251,7 +252,7 @@ func TestClient_ActivateVCL_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -259,7 +260,7 @@ func TestClient_ActivateVCL_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -267,7 +268,7 @@ func TestClient_ActivateVCL_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -279,7 +280,7 @@ func TestClient_DeleteVCL_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -287,7 +288,7 @@ func TestClient_DeleteVCL_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -295,7 +296,7 @@ func TestClient_DeleteVCL_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/vcl_gzip_test.go b/fastly/vcl_gzip_test.go index 584f2df6..7f63158c 100644 --- a/fastly/vcl_gzip_test.go +++ b/fastly/vcl_gzip_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -154,7 +155,7 @@ func TestClient_ListGzips_validation(t *testing.T) { _, err = TestClient.ListGzips(&ListGzipsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -162,7 +163,7 @@ func TestClient_ListGzips_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -173,7 +174,7 @@ func TestClient_CreateGzip_validation(t *testing.T) { _, err = TestClient.CreateGzip(&CreateGzipInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -181,7 +182,7 @@ func TestClient_CreateGzip_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -193,7 +194,7 @@ func TestClient_GetGzip_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -201,7 +202,7 @@ func TestClient_GetGzip_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -209,7 +210,7 @@ func TestClient_GetGzip_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -221,7 +222,7 @@ func TestClient_UpdateGzip_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -229,7 +230,7 @@ func TestClient_UpdateGzip_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -237,7 +238,7 @@ func TestClient_UpdateGzip_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -249,7 +250,7 @@ func TestClient_DeleteGzip_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -257,7 +258,7 @@ func TestClient_DeleteGzip_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -265,7 +266,7 @@ func TestClient_DeleteGzip_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/vcl_header_test.go b/fastly/vcl_header_test.go index 283b1d91..acf8082e 100644 --- a/fastly/vcl_header_test.go +++ b/fastly/vcl_header_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -171,7 +172,7 @@ func TestClient_ListHeaders_validation(t *testing.T) { _, err = TestClient.ListHeaders(&ListHeadersInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -179,7 +180,7 @@ func TestClient_ListHeaders_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -189,7 +190,7 @@ func TestClient_CreateHeader_validation(t *testing.T) { _, err = TestClient.CreateHeader(&CreateHeaderInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -197,7 +198,7 @@ func TestClient_CreateHeader_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -209,7 +210,7 @@ func TestClient_GetHeader_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -217,7 +218,7 @@ func TestClient_GetHeader_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -225,7 +226,7 @@ func TestClient_GetHeader_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -237,7 +238,7 @@ func TestClient_UpdateHeader_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -245,7 +246,7 @@ func TestClient_UpdateHeader_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -253,7 +254,7 @@ func TestClient_UpdateHeader_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -265,7 +266,7 @@ func TestClient_DeleteHeader_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -273,7 +274,7 @@ func TestClient_DeleteHeader_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -281,7 +282,7 @@ func TestClient_DeleteHeader_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/vcl_http3_test.go b/fastly/vcl_http3_test.go index e19d3cdf..98122ef1 100644 --- a/fastly/vcl_http3_test.go +++ b/fastly/vcl_http3_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -78,14 +79,14 @@ func TestClient_GetHTTP3_validation(t *testing.T) { _, err = TestClient.GetHTTP3(&GetHTTP3Input{ ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } _, err = TestClient.GetHTTP3(&GetHTTP3Input{ ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -95,7 +96,7 @@ func TestClient_CreateHTTP3_validation(t *testing.T) { _, err = TestClient.EnableHTTP3(&EnableHTTP3Input{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -103,7 +104,7 @@ func TestClient_CreateHTTP3_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -114,14 +115,14 @@ func TestClient_DeleteHTTP3_validation(t *testing.T) { err = TestClient.DisableHTTP3(&DisableHTTP3Input{ ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } err = TestClient.DisableHTTP3(&DisableHTTP3Input{ ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/vcl_rate_limiter_test.go b/fastly/vcl_rate_limiter_test.go index 6584729f..43548164 100644 --- a/fastly/vcl_rate_limiter_test.go +++ b/fastly/vcl_rate_limiter_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "net/http" "testing" ) @@ -174,7 +175,7 @@ func TestClient_ListERLs_validation(t *testing.T) { _, err = TestClient.ListERLs(&ListERLsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("error: %s", err) } @@ -182,7 +183,7 @@ func TestClient_ListERLs_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("error: %s", err) } } @@ -192,7 +193,7 @@ func TestClient_CreateERL_validation(t *testing.T) { _, err = TestClient.CreateERL(&CreateERLInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("error: %s", err) } @@ -200,7 +201,7 @@ func TestClient_CreateERL_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("error: %s", err) } } @@ -209,7 +210,7 @@ func TestClient_GetERL_validation(t *testing.T) { _, err := TestClient.GetERL(&GetERLInput{ ERLID: "", }) - if err != ErrMissingERLID { + if !errors.Is(err, ErrMissingERLID) { t.Errorf("error: %s", err) } } @@ -218,7 +219,7 @@ func TestClient_UpdateERL_validation(t *testing.T) { _, err := TestClient.UpdateERL(&UpdateERLInput{ ERLID: "", }) - if err != ErrMissingERLID { + if !errors.Is(err, ErrMissingERLID) { t.Errorf("error: %s", err) } } @@ -227,7 +228,7 @@ func TestClient_DeleteERL_validation(t *testing.T) { err := TestClient.DeleteERL(&DeleteERLInput{ ERLID: "", }) - if err != ErrMissingERLID { + if !errors.Is(err, ErrMissingERLID) { t.Errorf("error: %s", err) } } diff --git a/fastly/vcl_request_setting_test.go b/fastly/vcl_request_setting_test.go index 6f667ee7..62543e7b 100644 --- a/fastly/vcl_request_setting_test.go +++ b/fastly/vcl_request_setting_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -221,7 +222,7 @@ func TestClient_ListRequestSettings_validation(t *testing.T) { _, err = TestClient.ListRequestSettings(&ListRequestSettingsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -229,7 +230,7 @@ func TestClient_ListRequestSettings_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -239,7 +240,7 @@ func TestClient_CreateRequestSetting_validation(t *testing.T) { _, err = TestClient.CreateRequestSetting(&CreateRequestSettingInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -247,7 +248,7 @@ func TestClient_CreateRequestSetting_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -259,7 +260,7 @@ func TestClient_GetRequestSetting_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -267,7 +268,7 @@ func TestClient_GetRequestSetting_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -275,7 +276,7 @@ func TestClient_GetRequestSetting_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -287,7 +288,7 @@ func TestClient_UpdateRequestSetting_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -295,7 +296,7 @@ func TestClient_UpdateRequestSetting_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -303,7 +304,7 @@ func TestClient_UpdateRequestSetting_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -315,7 +316,7 @@ func TestClient_DeleteRequestSetting_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -323,7 +324,7 @@ func TestClient_DeleteRequestSetting_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -331,7 +332,7 @@ func TestClient_DeleteRequestSetting_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/vcl_response_object_test.go b/fastly/vcl_response_object_test.go index d95bb23f..bd07c967 100644 --- a/fastly/vcl_response_object_test.go +++ b/fastly/vcl_response_object_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -141,7 +142,7 @@ func TestClient_ListResponseObjects_validation(t *testing.T) { _, err = TestClient.ListResponseObjects(&ListResponseObjectsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -149,7 +150,7 @@ func TestClient_ListResponseObjects_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -159,7 +160,7 @@ func TestClient_CreateResponseObject_validation(t *testing.T) { _, err = TestClient.CreateResponseObject(&CreateResponseObjectInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -167,7 +168,7 @@ func TestClient_CreateResponseObject_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -179,7 +180,7 @@ func TestClient_GetResponseObject_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -187,7 +188,7 @@ func TestClient_GetResponseObject_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -195,7 +196,7 @@ func TestClient_GetResponseObject_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -207,7 +208,7 @@ func TestClient_UpdateResponseObject_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -215,7 +216,7 @@ func TestClient_UpdateResponseObject_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -223,7 +224,7 @@ func TestClient_UpdateResponseObject_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -235,7 +236,7 @@ func TestClient_DeleteResponseObject_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingName { + if !errors.Is(err, ErrMissingName) { t.Errorf("bad error: %s", err) } @@ -243,7 +244,7 @@ func TestClient_DeleteResponseObject_validation(t *testing.T) { Name: "test", ServiceVersion: 1, }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -251,7 +252,7 @@ func TestClient_DeleteResponseObject_validation(t *testing.T) { Name: "test", ServiceID: "foo", }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/vcl_settings_test.go b/fastly/vcl_settings_test.go index ed52ae97..eda30ef6 100644 --- a/fastly/vcl_settings_test.go +++ b/fastly/vcl_settings_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" "github.com/google/go-querystring/query" @@ -80,7 +81,7 @@ func TestClient_GetSettings_validation(t *testing.T) { _, err = TestClient.GetSettings(&GetSettingsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -88,7 +89,7 @@ func TestClient_GetSettings_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -98,7 +99,7 @@ func TestClient_UpdateSettings_validation(t *testing.T) { _, err = TestClient.UpdateSettings(&UpdateSettingsInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -106,7 +107,7 @@ func TestClient_UpdateSettings_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/waf_active_rule_test.go b/fastly/waf_active_rule_test.go index 5322823b..bbd67432 100644 --- a/fastly/waf_active_rule_test.go +++ b/fastly/waf_active_rule_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "testing" ) @@ -151,7 +152,7 @@ func TestClient_ListWAFActiveRules_validation(t *testing.T) { _, err = TestClient.ListWAFActiveRules(&ListWAFActiveRulesInput{ WAFID: "", }) - if err != ErrMissingWAFID { + if !errors.Is(err, ErrMissingWAFID) { t.Errorf("bad error: %s", err) } @@ -159,7 +160,7 @@ func TestClient_ListWAFActiveRules_validation(t *testing.T) { WAFID: "1", WAFVersionNumber: 0, }) - if err != ErrMissingWAFVersionNumber { + if !errors.Is(err, ErrMissingWAFVersionNumber) { t.Errorf("bad error: %s", err) } } @@ -169,7 +170,7 @@ func TestClient_ListAllWAFActiveRules_validation(t *testing.T) { _, err = TestClient.ListAllWAFActiveRules(&ListAllWAFActiveRulesInput{ WAFID: "", }) - if err != ErrMissingWAFID { + if !errors.Is(err, ErrMissingWAFID) { t.Errorf("bad error: %s", err) } @@ -177,7 +178,7 @@ func TestClient_ListAllWAFActiveRules_validation(t *testing.T) { WAFID: "1", WAFVersionNumber: 0, }) - if err != ErrMissingWAFVersionNumber { + if !errors.Is(err, ErrMissingWAFVersionNumber) { t.Errorf("bad error: %s", err) } } @@ -187,7 +188,7 @@ func TestClient_CreateWAFActiveRules_validation(t *testing.T) { _, err = TestClient.CreateWAFActiveRules(&CreateWAFActiveRulesInput{ WAFID: "", }) - if err != ErrMissingWAFID { + if !errors.Is(err, ErrMissingWAFID) { t.Errorf("bad error: %s", err) } @@ -195,7 +196,7 @@ func TestClient_CreateWAFActiveRules_validation(t *testing.T) { WAFID: "1", WAFVersionNumber: 0, }) - if err != ErrMissingWAFVersionNumber { + if !errors.Is(err, ErrMissingWAFVersionNumber) { t.Errorf("bad error: %s", err) } @@ -204,7 +205,7 @@ func TestClient_CreateWAFActiveRules_validation(t *testing.T) { WAFVersionNumber: 1, Rules: []*WAFActiveRule{}, }) - if err != ErrMissingWAFActiveRule { + if !errors.Is(err, ErrMissingWAFActiveRule) { t.Errorf("bad error: %s", err) } } @@ -223,7 +224,7 @@ func TestClient_BatchModificationWAFActiveRules_validation(t *testing.T) { _, err = TestClient.BatchModificationWAFActiveRules(&BatchModificationWAFActiveRulesInput{ Rules: rules, }) - if err != ErrMaxExceededRules { + if !errors.Is(err, ErrMaxExceededRules) { t.Errorf("bad error: %s", err) } } @@ -234,7 +235,7 @@ func TestClient_DeleteWAFActiveRules_validation(t *testing.T) { WAFID: "", }) - if err != ErrMissingWAFID { + if !errors.Is(err, ErrMissingWAFID) { t.Errorf("bad error: %s", err) } @@ -243,7 +244,7 @@ func TestClient_DeleteWAFActiveRules_validation(t *testing.T) { WAFVersionNumber: 0, }) - if err != ErrMissingWAFVersionNumber { + if !errors.Is(err, ErrMissingWAFVersionNumber) { t.Errorf("bad error: %s", err) } @@ -253,7 +254,7 @@ func TestClient_DeleteWAFActiveRules_validation(t *testing.T) { Rules: []*WAFActiveRule{}, }) - if err != ErrMissingWAFActiveRule { + if !errors.Is(err, ErrMissingWAFActiveRule) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/waf_test.go b/fastly/waf_test.go index 6f25691e..9b562bc8 100644 --- a/fastly/waf_test.go +++ b/fastly/waf_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "reflect" "testing" ) @@ -156,7 +157,7 @@ func TestClient_CreateWAF_validation(t *testing.T) { _, err = TestClient.CreateWAF(&CreateWAFInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -164,7 +165,7 @@ func TestClient_CreateWAF_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -174,7 +175,7 @@ func TestClient_GetWAF_validation(t *testing.T) { _, err = TestClient.GetWAF(&GetWAFInput{ ServiceID: "", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -182,7 +183,7 @@ func TestClient_GetWAF_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } @@ -190,7 +191,7 @@ func TestClient_GetWAF_validation(t *testing.T) { ServiceID: "foo", ServiceVersion: 1, }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -201,14 +202,14 @@ func TestClient_UpdateWAF_validation(t *testing.T) { _, err = TestClient.UpdateWAF(&UpdateWAFInput{ ID: "", }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } _, err = TestClient.UpdateWAF(&UpdateWAFInput{ ID: "123999", }) - if err != ErrMissingServiceID { + if !errors.Is(err, ErrMissingServiceID) { t.Errorf("bad error: %s", err) } @@ -218,7 +219,7 @@ func TestClient_UpdateWAF_validation(t *testing.T) { ID: "123", ServiceID: &serviceID, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } } @@ -228,7 +229,7 @@ func TestClient_DeleteWAF_validation(t *testing.T) { err = TestClient.DeleteWAF(&DeleteWAFInput{ ServiceVersion: 0, }) - if err != ErrMissingServiceVersion { + if !errors.Is(err, ErrMissingServiceVersion) { t.Errorf("bad error: %s", err) } @@ -236,7 +237,7 @@ func TestClient_DeleteWAF_validation(t *testing.T) { ServiceVersion: 1, ID: "", }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -247,7 +248,7 @@ func TestClient_UpdateWAF_Enable_validation(t *testing.T) { ID: "", Disabled: ToPointer(false), }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } @@ -258,7 +259,7 @@ func TestClient_UpdateWAF_Disable_validation(t *testing.T) { ID: "", Disabled: ToPointer(true), }) - if err != ErrMissingID { + if !errors.Is(err, ErrMissingID) { t.Errorf("bad error: %s", err) } } diff --git a/fastly/waf_version_test.go b/fastly/waf_version_test.go index af718f7d..1dbb38b6 100644 --- a/fastly/waf_version_test.go +++ b/fastly/waf_version_test.go @@ -1,6 +1,7 @@ package fastly import ( + "errors" "fmt" "reflect" "testing" @@ -386,7 +387,7 @@ func TestClient_ListWAFVersions_validation(t *testing.T) { _, err = TestClient.ListWAFVersions(&ListWAFVersionsInput{ WAFID: "", }) - if err != ErrMissingWAFID { + if !errors.Is(err, ErrMissingWAFID) { t.Errorf("bad error: %s", err) } } @@ -396,7 +397,7 @@ func TestClient_ListAllWAFVersions_validation(t *testing.T) { _, err = TestClient.ListAllWAFVersions(&ListAllWAFVersionsInput{ WAFID: "", }) - if err != ErrMissingWAFID { + if !errors.Is(err, ErrMissingWAFID) { t.Errorf("bad error: %s", err) } } @@ -406,7 +407,7 @@ func TestClient_GetWAFVersion_validation(t *testing.T) { _, err = TestClient.GetWAFVersion(&GetWAFVersionInput{ WAFID: "", }) - if err != ErrMissingWAFID { + if !errors.Is(err, ErrMissingWAFID) { t.Errorf("bad error: %s", err) } @@ -414,7 +415,7 @@ func TestClient_GetWAFVersion_validation(t *testing.T) { WAFID: "1", WAFVersionNumber: 0, }) - if err != ErrMissingWAFVersionNumber { + if !errors.Is(err, ErrMissingWAFVersionNumber) { t.Errorf("bad error: %s", err) } } @@ -424,7 +425,7 @@ func TestClient_UpdateWAFVersion_validation(t *testing.T) { _, err = TestClient.UpdateWAFVersion(&UpdateWAFVersionInput{ WAFID: strToPtr(""), }) - if err != ErrMissingWAFID { + if !errors.Is(err, ErrMissingWAFID) { t.Errorf("bad error: %s", err) } @@ -432,7 +433,7 @@ func TestClient_UpdateWAFVersion_validation(t *testing.T) { WAFID: strToPtr("1"), WAFVersionNumber: intToPtr(0), }) - if err != ErrMissingWAFVersionNumber { + if !errors.Is(err, ErrMissingWAFVersionNumber) { t.Errorf("bad error: %s", err) } @@ -441,7 +442,7 @@ func TestClient_UpdateWAFVersion_validation(t *testing.T) { WAFVersionNumber: intToPtr(1), WAFVersionID: strToPtr(""), }) - if err != ErrMissingWAFVersionID { + if !errors.Is(err, ErrMissingWAFVersionID) { t.Errorf("bad error: %s", err) } } @@ -451,7 +452,7 @@ func TestClient_LockWAFVersion_validation(t *testing.T) { _, err = TestClient.LockWAFVersion(&LockWAFVersionInput{ WAFID: "", }) - if err != ErrMissingWAFID { + if !errors.Is(err, ErrMissingWAFID) { t.Errorf("bad error: %s", err) } @@ -459,7 +460,7 @@ func TestClient_LockWAFVersion_validation(t *testing.T) { WAFID: "1", WAFVersionNumber: 0, }) - if err != ErrMissingWAFVersionNumber { + if !errors.Is(err, ErrMissingWAFVersionNumber) { t.Errorf("bad error: %s", err) } } @@ -469,7 +470,7 @@ func TestClient_CloneWAFVersion_validation(t *testing.T) { _, err = TestClient.CloneWAFVersion(&CloneWAFVersionInput{ WAFID: "", }) - if err != ErrMissingWAFID { + if !errors.Is(err, ErrMissingWAFID) { t.Errorf("bad error: %s", err) } @@ -477,7 +478,7 @@ func TestClient_CloneWAFVersion_validation(t *testing.T) { WAFID: "1", WAFVersionNumber: 0, }) - if err != ErrMissingWAFVersionNumber { + if !errors.Is(err, ErrMissingWAFVersionNumber) { t.Errorf("bad error: %s", err) } } @@ -488,7 +489,7 @@ func TestClient_DeployWAFVersion_validation(t *testing.T) { WAFID: "", }) - if err != ErrMissingWAFID { + if !errors.Is(err, ErrMissingWAFID) { t.Errorf("bad error: %s", err) } @@ -497,7 +498,7 @@ func TestClient_DeployWAFVersion_validation(t *testing.T) { WAFVersionNumber: 0, }) - if err != ErrMissingWAFVersionNumber { + if !errors.Is(err, ErrMissingWAFVersionNumber) { t.Errorf("bad error: %s", err) } } @@ -539,7 +540,7 @@ func TestClient_CreateEmptyWAFVersion_validation(t *testing.T) { WAFID: "", }) - if err != ErrMissingWAFID { + if !errors.Is(err, ErrMissingWAFID) { t.Errorf("bad error: %s", err) } }