diff --git a/.secrets.baseline b/.secrets.baseline index 04d6c18f..23dd436b 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.sum|^.secrets.baseline$|_test.go|package-lock.json|.cra/.cveignore", "lines": null }, - "generated_at": "2022-03-23T14:44:03Z", + "generated_at": "2022-05-27T20:50:10Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -152,7 +152,7 @@ "hashed_secret": "f0f9776696ad22d22eaac21090596c8ff9908a80", "is_secret": false, "is_verified": false, - "line_number": 459, + "line_number": 462, "type": "Secret Keyword", "verified_result": null }, @@ -160,7 +160,7 @@ "hashed_secret": "db4ba57216101b14d842d373717bea5849609df3", "is_secret": false, "is_verified": false, - "line_number": 538, + "line_number": 541, "type": "Secret Keyword", "verified_result": null }, @@ -168,7 +168,7 @@ "hashed_secret": "e117797422d35ce52f036963c7e9603e9955b5c7", "is_secret": false, "is_verified": false, - "line_number": 587, + "line_number": 590, "type": "Secret Keyword", "verified_result": null }, @@ -176,7 +176,7 @@ "hashed_secret": "8ec4981102569463be3512984154c66c098b92c5", "is_secret": false, "is_verified": false, - "line_number": 637, + "line_number": 640, "type": "Secret Keyword", "verified_result": null }, @@ -184,7 +184,7 @@ "hashed_secret": "4d6a6a4e27cfafab93e0487a9de1f26bdfeb8afb", "is_secret": false, "is_verified": false, - "line_number": 817, + "line_number": 820, "type": "Secret Keyword", "verified_result": null }, @@ -192,7 +192,7 @@ "hashed_secret": "0d19d250028ff6865c70faea072729d1a888e9ae", "is_secret": false, "is_verified": false, - "line_number": 2192, + "line_number": 2202, "type": "Secret Keyword", "verified_result": null }, @@ -200,7 +200,7 @@ "hashed_secret": "0ec6d150549780250a9772c06b619bcc46a0e560", "is_secret": false, "is_verified": false, - "line_number": 2379, + "line_number": 2541, "type": "Secret Keyword", "verified_result": null }, @@ -208,7 +208,7 @@ "hashed_secret": "e058a1c493ad749bd67d368340e9056ed1c2f3ed", "is_secret": false, "is_verified": false, - "line_number": 2392, + "line_number": 2554, "type": "Secret Keyword", "verified_result": null }, @@ -216,7 +216,7 @@ "hashed_secret": "d4c3d66fd0c38547a3c7a4c6bdc29c36911bc030", "is_secret": false, "is_verified": false, - "line_number": 3001, + "line_number": 3330, "type": "Secret Keyword", "verified_result": null }, @@ -224,7 +224,7 @@ "hashed_secret": "6452e7c5a42f97b00af1a210afc7d4de315e57ec", "is_secret": false, "is_verified": false, - "line_number": 4744, + "line_number": 5274, "type": "Secret Keyword", "verified_result": null } @@ -248,7 +248,7 @@ } ] }, - "version": "0.13.1+ibm.47.dss", + "version": "0.13.1+ibm.48.dss", "word_list": { "file": null, "hash": null diff --git a/Makefile b/Makefile index 45840b95..7a643e8b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ # Makefile to build the project +GO=go +LINT=golangci-lint +GOSEC=gosec COVERAGE = -coverprofile=coverage.txt -covermode=atomic @@ -6,22 +9,22 @@ all: tidy test lint travis-ci: test-cov lint scan-gosec tidy test: - go test `go list ./...` + ${GO} test `${GO} list ./...` test-cov: - go test `go list ./...` ${COVERAGE} + ${GO} test `${GO} list ./...` ${COVERAGE} test-int: - go test `go list ./...` -tags=integration + ${GO} test `${GO} list ./...` -tags=integration test-int-cov: - go test `go list ./...` -tags=integration ${COVERAGE} + ${GO} test `${GO} list ./...` -tags=integration ${COVERAGE} lint: - golangci-lint run + ${LINT} run --build-tags=integration,examples scan-gosec: - gosec ./... + ${GOSEC} ./... tidy: - go mod tidy + ${GO} mod tidy diff --git a/casemanagementv1/case_management_v1_examples_test.go b/casemanagementv1/case_management_v1_examples_test.go index 9e5fefaa..4dca1f3d 100644 --- a/casemanagementv1/case_management_v1_examples_test.go +++ b/casemanagementv1/case_management_v1_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -47,24 +48,25 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../case_management.env" - -var ( - caseManagementService *casemanagementv1.CaseManagementV1 - config map[string]string - configLoaded bool = false - caseNumber string - attachmentID string - resourceCRN string -) -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") +var _ = Describe(`CaseManagementV1 Examples Tests`, func() { + const externalConfigFile = "../case_management.env" + + var ( + caseManagementService *casemanagementv1.CaseManagementV1 + config map[string]string + configLoaded bool = false + caseNumber string + attachmentID string + resourceCRN string + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`CaseManagementV1 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error @@ -366,8 +368,7 @@ var _ = Describe(`CaseManagementV1 Examples Tests`, func() { if result != nil { defer result.Close() buf := new(bytes.Buffer) - buf.ReadFrom(result) - + _, _ = buf.ReadFrom(result) fmt.Println(buf.String()) } diff --git a/casemanagementv1/case_management_v1_integration_test.go b/casemanagementv1/case_management_v1_integration_test.go index ef0dbb89..b9413a83 100644 --- a/casemanagementv1/case_management_v1_integration_test.go +++ b/casemanagementv1/case_management_v1_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /** @@ -35,54 +36,50 @@ import ( common "github.com/IBM/platform-services-go-sdk/common" ) -const externalConfigFile = "../case_management.env" +var _ = Describe("Case Management - Integration Tests", func() { + const externalConfigFile = "../case_management.env" -var ( - service *casemanagementv1.CaseManagementV1 - err error + var ( + service *casemanagementv1.CaseManagementV1 + err error - configLoaded bool = false + config map[string]string - caseNumber string - commentValue = "Test comment" + caseNumber string + commentValue = "Test comment" - // Configured resource CRN to use in tests. - resourceCRN string + // Configured resource CRN to use in tests. + resourceCRN string - // Model instances needed by the tests. - resourcePayload []casemanagementv1.ResourcePayload - watchlistPayload *casemanagementv1.Watchlist -) + // Model instances needed by the tests. + resourcePayload []casemanagementv1.ResourcePayload + watchlistPayload *casemanagementv1.Watchlist + ) -func shouldSkipTest() { - if !configLoaded { + var shouldSkipTest = func() { Skip("External configuration is not available, skipping...") } -} -var _ = Describe("Case Management - Integration Tests", func() { It("Successfully load the configuration", func() { - var config map[string]string - if _, fileErr := os.Stat(externalConfigFile); fileErr == nil { - os.Setenv("IBM_CREDENTIALS_FILE", externalConfigFile) - config, _ = core.GetServiceProperties(casemanagementv1.DefaultServiceName) - if len(config) > 0 { - configLoaded = true - } - - if configLoaded { - - } + _, err = os.Stat(externalConfigFile) + if err != nil { + Skip("External configuration file not found, skipping tests: " + err.Error()) } - if !configLoaded { - Skip("External configuration could not be loaded, skipping...") + os.Setenv("IBM_CREDENTIALS_FILE", externalConfigFile) + config, err = core.GetServiceProperties(casemanagementv1.DefaultServiceName) + if err != nil { + Skip("Error loading service properties, skipping tests: " + err.Error()) + } + serviceURL := config["URL"] + if serviceURL == "" { + Skip("Unable to load service URL configuration property, skipping tests") } resourceCRN = config["RESOURCE_CRN"] - if resourceCRN == "" { - Skip("RESOURCE_CRN configuration property not found, skipping...") - } + Expect(resourceCRN).ToNot(BeEmpty()) + + shouldSkipTest = func() {} // Initialize required model instances. resourcePayload = []casemanagementv1.ResourcePayload{casemanagementv1.ResourcePayload{ diff --git a/catalogmanagementv1/catalog_management_v1_examples_test.go b/catalogmanagementv1/catalog_management_v1_examples_test.go index cc4c4e06..0f447645 100644 --- a/catalogmanagementv1/catalog_management_v1_examples_test.go +++ b/catalogmanagementv1/catalog_management_v1_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -45,30 +46,31 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../catalog_mgmt.env" - -var ( - catalogManagementService *catalogmanagementv1.CatalogManagementV1 - config map[string]string - configLoaded bool = false - accountID string - bearerToken string - gitAuthTokenForPublicRepo string - catalogID string - offeringID string - clusterID string - objectID string - offeringInstanceID string - versionLocatorID string -) -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") +var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { + const externalConfigFile = "../catalog_mgmt.env" + + var ( + catalogManagementService *catalogmanagementv1.CatalogManagementV1 + config map[string]string + configLoaded bool = false + accountID string + bearerToken string + gitAuthTokenForPublicRepo string + catalogID string + offeringID string + clusterID string + objectID string + offeringInstanceID string + versionLocatorID string + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error @@ -105,7 +107,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { catalogManagementServiceOptions := &catalogmanagementv1.CatalogManagementV1Options{} - catalogManagementService, err = catalogmanagementv1.NewCatalogManagementV1UsingExternalConfig(catalogManagementServiceOptions) + catalogManagementService, err := catalogmanagementv1.NewCatalogManagementV1UsingExternalConfig(catalogManagementServiceOptions) if err != nil { panic(err) @@ -652,6 +654,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { catalogID, offeringID, "roks", + "", ) getOfferingUpdatesOptions.Version = core.StringPtr("0.0.2") getOfferingUpdatesOptions.ClusterID = &clusterID diff --git a/catalogmanagementv1/catalog_management_v1_old_integration_test.go b/catalogmanagementv1/catalog_management_v1_old_integration_test.go index 5585ffb1..52c129a0 100644 --- a/catalogmanagementv1/catalog_management_v1_old_integration_test.go +++ b/catalogmanagementv1/catalog_management_v1_old_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration2 // +build integration2 /** @@ -32,32 +33,32 @@ import ( . "github.com/onsi/gomega" ) -const ( - externalConfigFile = "../catalog_mgmt.env" - expectedShortDesc = "test" - expectedURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s" - expectedOfferingsURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings" - fakeName = "bogus" - fakeVersionLocator = "bogus.bogus" - expectedOfferingName = "test-offering" - expectedOfferingURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings/%s" -) - -var ( - service *catalogmanagementv1.CatalogManagementV1 - gitToken string - accountID string - configLoaded bool = false - expectedLabel = fmt.Sprintf("integration-test-%d", time.Now().Unix()) -) - -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping...") +var _ = Describe("Catalog Management - Integration Tests (OLD)", func() { + const ( + externalConfigFile = "../catalog_mgmt.env" + expectedShortDesc = "test" + expectedURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s" + expectedOfferingsURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings" + fakeName = "bogus" + fakeVersionLocator = "bogus.bogus" + expectedOfferingName = "test-offering" + expectedOfferingURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings/%s" + ) + + var ( + service *catalogmanagementv1.CatalogManagementV1 + gitToken string + accountID string + configLoaded bool = false + expectedLabel = fmt.Sprintf("integration-test-%d", time.Now().Unix()) + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping...") + } } -} -var _ = Describe("Catalog Management - Integration Tests (OLD)", func() { It("Successfully load the configuration", func() { if _, err := os.Stat(externalConfigFile); err == nil { if err = os.Setenv("IBM_CREDENTIALS_FILE", externalConfigFile); err == nil { diff --git a/configurationgovernancev1/configuration_governance_v1_examples_test.go b/configurationgovernancev1/configuration_governance_v1_examples_test.go index 0a806bbd..de232c85 100644 --- a/configurationgovernancev1/configuration_governance_v1_examples_test.go +++ b/configurationgovernancev1/configuration_governance_v1_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -48,40 +49,39 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../configuration_governance.env" -var ( - configurationGovernanceService *configurationgovernancev1.ConfigurationGovernanceV1 - config map[string]string - configLoaded bool = false - - // Test-related configuration properties. - accountID string - serviceName string - enterpriseScopeID string - subacctScopeID string - - transactionID string = uuid.New().String() -) - -// Global variables to hold various values shared between operations -var ( - ruleIDLink string - ruleToUpdateLink *configurationgovernancev1.Rule - ruleToUpdateEtagLink string - - attachmentIDLink string - attachmentToUpdateLink *configurationgovernancev1.Attachment - attachmentToUpdateEtagLink string -) - -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") +var _ = Describe(`ConfigurationGovernanceV1 Examples Tests`, func() { + const externalConfigFile = "../configuration_governance.env" + + var ( + configurationGovernanceService *configurationgovernancev1.ConfigurationGovernanceV1 + config map[string]string + configLoaded bool = false + + // Test-related configuration properties. + accountID string + serviceName string + enterpriseScopeID string + subacctScopeID string + ) + + // Global variables to hold various values shared between operations + var ( + ruleIDLink string + ruleToUpdateLink *configurationgovernancev1.Rule + ruleToUpdateEtagLink string + + attachmentIDLink string + attachmentToUpdateLink *configurationgovernancev1.Attachment + attachmentToUpdateEtagLink string + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`ConfigurationGovernanceV1 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/configurationgovernancev1/configuration_governance_v1_integration_test.go b/configurationgovernancev1/configuration_governance_v1_integration_test.go index db8d046a..655f1882 100644 --- a/configurationgovernancev1/configuration_governance_v1_integration_test.go +++ b/configurationgovernancev1/configuration_governance_v1_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /** @@ -40,10 +41,6 @@ import ( * The integration test will automatically skip tests if the required config file is not available. */ -const verbose bool = true - -var transactionID string - var _ = Describe(`ConfigurationGovernanceV1 Integration Tests`, func() { const externalConfigFile = "../configuration_governance.env" @@ -81,6 +78,8 @@ var _ = Describe(`ConfigurationGovernanceV1 Integration Tests`, func() { attachment1 *Attachment attachmentEtag1 string attachmentID2 string + + transactionID string ) var shouldSkipTest = func() { @@ -247,7 +246,7 @@ var _ = Describe(`ConfigurationGovernanceV1 Integration Tests`, func() { It("Successfully setup the environment for tests", func() { fmt.Fprintln(GinkgoWriter, "Setup...") - cleanRules(service, accountID, TestLabel) + cleanRules(service, accountID, TestLabel, transactionID) fmt.Fprintln(GinkgoWriter, "Finished setup.") }) }) @@ -543,11 +542,12 @@ var _ = Describe(`ConfigurationGovernanceV1 Integration Tests`, func() { ruleList, response, err := service.ListRules(listRulesOptions) Expect(err).To(BeNil()) + Expect(response).ToNot(BeNil()) Expect(ruleList).ToNot(BeNil()) Expect(*ruleList.TotalCount).To(Equal(int64(1))) // Next, make sure we can't do a get on the deleted rule. - rule := getRule(service, ruleID2) + rule := getRule(service, ruleID2, transactionID) Expect(rule).To(BeNil()) }) It(`Fail to delete rule with invalid rule id`, func() { @@ -598,7 +598,7 @@ var _ = Describe(`ConfigurationGovernanceV1 Integration Tests`, func() { Expect(attachmentID1).ToNot(BeNil()) // Now retrieve the rule and make sure the number_of_attachments is 1. - rule := getRule(service, ruleID1) + rule := getRule(service, ruleID1, transactionID) Expect(rule).ToNot(BeNil()) Expect(rule.NumberOfAttachments).ToNot(BeNil()) Expect(*rule.NumberOfAttachments).To(Equal(int64(1))) @@ -632,7 +632,7 @@ var _ = Describe(`ConfigurationGovernanceV1 Integration Tests`, func() { Expect(attachmentID2).ToNot(BeEmpty()) // Now retrieve the rule and make sure the number_of_attachments is 1. - rule := getRule(service, ruleID1) + rule := getRule(service, ruleID1, transactionID) Expect(rule).ToNot(BeNil()) Expect(rule.NumberOfAttachments).ToNot(BeNil()) Expect(*rule.NumberOfAttachments).To(Equal(int64(2))) @@ -861,13 +861,13 @@ var _ = Describe(`ConfigurationGovernanceV1 Integration Tests`, func() { }) It(`Clean rules`, func() { fmt.Fprintln(GinkgoWriter, "Teardown...") - cleanRules(service, accountID, TestLabel) + cleanRules(service, accountID, TestLabel, transactionID) fmt.Fprintln(GinkgoWriter, "Finished teardown.") }) }) }) -func cleanRules(service *ConfigurationGovernanceV1, accountID string, label string) { +func cleanRules(service *ConfigurationGovernanceV1, accountID string, label string, transactionID string) { fmt.Fprintln(GinkgoWriter, "Cleaning rules...") listRulesOptions := &ListRulesOptions{ @@ -905,7 +905,7 @@ func cleanRules(service *ConfigurationGovernanceV1, accountID string, label stri fmt.Fprintln(GinkgoWriter, "Finished cleaning rules...") } -func getRule(service *ConfigurationGovernanceV1, ruleID string) (rule *Rule) { +func getRule(service *ConfigurationGovernanceV1, ruleID string, transactionID string) (rule *Rule) { rule, _, _ = service.GetRule(&GetRuleOptions{ RuleID: core.StringPtr(ruleID), TransactionID: &transactionID, diff --git a/contextbasedrestrictionsv1/context_based_restrictions_v1_examples_test.go b/contextbasedrestrictionsv1/context_based_restrictions_v1_examples_test.go index df3eb20b..810f5070 100644 --- a/contextbasedrestrictionsv1/context_based_restrictions_v1_examples_test.go +++ b/contextbasedrestrictionsv1/context_based_restrictions_v1_examples_test.go @@ -45,27 +45,28 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../context_based_restrictions_v1.env" - -var ( - contextBasedRestrictionsService *contextbasedrestrictionsv1.ContextBasedRestrictionsV1 - config map[string]string - configLoaded bool = false - accountID string - serviceName string - zoneID string - zoneRev string - ruleID string - ruleRev string -) -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") +var _ = Describe(`contextbasedrestrictionsv1.ContextBasedRestrictionsV1 Examples Tests`, func() { + const externalConfigFile = "../context_based_restrictions_v1.env" + + var ( + contextBasedRestrictionsService *contextbasedrestrictionsv1.ContextBasedRestrictionsV1 + config map[string]string + configLoaded bool = false + accountID string + serviceName string + zoneID string + zoneRev string + ruleID string + ruleRev string + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`contextbasedrestrictionsv1.ContextBasedRestrictionsV1 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/contextbasedrestrictionsv1/context_based_restrictions_v1_integration_test.go b/contextbasedrestrictionsv1/context_based_restrictions_v1_integration_test.go index c29080d2..e75a3361 100644 --- a/contextbasedrestrictionsv1/context_based_restrictions_v1_integration_test.go +++ b/contextbasedrestrictionsv1/context_based_restrictions_v1_integration_test.go @@ -32,11 +32,6 @@ import ( . "github.com/onsi/gomega" ) -var ( - NonExistentID = "1234567890abcdef1234567890abcdef" - InvalidID = "this_is_an_invalid_id" -) - /** * This file contains an integration test for the contextbasedrestrictionsv1 package. * @@ -49,6 +44,11 @@ var _ = Describe(`ContextBasedRestrictionsV1 Integration Tests`, func() { const externalConfigFile = "../context_based_restrictions_v1.env" + const ( + NonExistentID = "1234567890abcdef1234567890abcdef" + InvalidID = "this_is_an_invalid_id" + ) + var ( err error contextBasedRestrictionsService *contextbasedrestrictionsv1.ContextBasedRestrictionsV1 diff --git a/enterprisebillingunitsv1/enterprise_billing_units_v1_examples_test.go b/enterprisebillingunitsv1/enterprise_billing_units_v1_examples_test.go index 1a0f6cf4..a953f991 100644 --- a/enterprisebillingunitsv1/enterprise_billing_units_v1_examples_test.go +++ b/enterprisebillingunitsv1/enterprise_billing_units_v1_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -45,24 +46,25 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../enterprise_billing_units.env" -var ( - enterpriseBillingUnitsService *enterprisebillingunitsv1.EnterpriseBillingUnitsV1 - config map[string]string - configLoaded bool = false +var _ = Describe(`EnterpriseBillingUnitsV1 Examples Tests`, func() { + const externalConfigFile = "../enterprise_billing_units.env" - enterpriseID string - billingUnitID string -) + var ( + enterpriseBillingUnitsService *enterprisebillingunitsv1.EnterpriseBillingUnitsV1 + config map[string]string + configLoaded bool = false -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") + enterpriseID string + billingUnitID string + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`EnterpriseBillingUnitsV1 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/enterprisemanagementv1/enterprise_management_v1_examples_test.go b/enterprisemanagementv1/enterprise_management_v1_examples_test.go index 19a6cdc0..5f2735f1 100644 --- a/enterprisemanagementv1/enterprise_management_v1_examples_test.go +++ b/enterprisemanagementv1/enterprise_management_v1_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -45,28 +46,29 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../enterprise_management.env" - -var ( - enterpriseManagementService *enterprisemanagementv1.EnterpriseManagementV1 - config map[string]string - configLoaded bool = false - enterpriseID string - enterpriseAccountID string - enterpriseAccountIamID string - - accountGroupID string - newParentAccountGroupID string - accountID string -) -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") +var _ = Describe(`EnterpriseManagementV1 Examples Tests`, func() { + const externalConfigFile = "../enterprise_management.env" + + var ( + enterpriseManagementService *enterprisemanagementv1.EnterpriseManagementV1 + config map[string]string + configLoaded bool = false + enterpriseID string + enterpriseAccountID string + enterpriseAccountIamID string + + accountGroupID string + newParentAccountGroupID string + accountID string + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`EnterpriseManagementV1 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/globalcatalogv1/global_catalog_v1_examples_test.go b/globalcatalogv1/global_catalog_v1_examples_test.go index e7f77b16..8a805095 100644 --- a/globalcatalogv1/global_catalog_v1_examples_test.go +++ b/globalcatalogv1/global_catalog_v1_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -49,22 +50,23 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../global_catalog.env" -var ( - globalCatalogService *globalcatalogv1.GlobalCatalogV1 - config map[string]string - configLoaded bool = false - catalogEntryID string -) - -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") +var _ = Describe(`GlobalCatalogV1 Examples Tests`, func() { + const externalConfigFile = "../global_catalog.env" + + var ( + globalCatalogService *globalcatalogv1.GlobalCatalogV1 + config map[string]string + configLoaded bool = false + catalogEntryID string + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`GlobalCatalogV1 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error @@ -479,7 +481,7 @@ var _ = Describe(`GlobalCatalogV1 Examples Tests`, func() { if result != nil { defer result.Close() buf := new(bytes.Buffer) - buf.ReadFrom(result) + _, _ = buf.ReadFrom(result) fmt.Println(buf.String()) } diff --git a/globalcatalogv1/global_catalog_v1_integration_test.go b/globalcatalogv1/global_catalog_v1_integration_test.go index 4e4261f7..103eb4f9 100644 --- a/globalcatalogv1/global_catalog_v1_integration_test.go +++ b/globalcatalogv1/global_catalog_v1_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /** @@ -35,47 +36,47 @@ import ( . "github.com/onsi/gomega" ) -const ( - externalConfigFile = "../global_catalog.env" - visibilityRestriction = "private" - artifact = `{"someKey": "someValue"}` -) - -var ( - service *globalcatalogv1.GlobalCatalogV1 - defaultCreate *globalcatalogv1.CreateCatalogEntryOptions - defaultDelete *globalcatalogv1.DeleteCatalogEntryOptions - forceDelete *globalcatalogv1.DeleteCatalogEntryOptions - defaultGet *globalcatalogv1.GetCatalogEntryOptions - defaultUpdate *globalcatalogv1.UpdateCatalogEntryOptions - defaultList *globalcatalogv1.ListCatalogEntriesOptions - defaultChild *globalcatalogv1.CreateCatalogEntryOptions - getChild *globalcatalogv1.GetChildObjectsOptions - deleteChild *globalcatalogv1.DeleteCatalogEntryOptions - defaultRestore *globalcatalogv1.RestoreCatalogEntryOptions - bogusRestore *globalcatalogv1.RestoreCatalogEntryOptions - getVisibility *globalcatalogv1.GetVisibilityOptions - updateVisibility *globalcatalogv1.UpdateVisibilityOptions - getPricing *globalcatalogv1.GetPricingOptions - defaultArtifact *globalcatalogv1.UploadArtifactOptions - uploadArtifactList *globalcatalogv1.UploadArtifactOptions - uploadArtifactCreate *globalcatalogv1.UploadArtifactOptions - uploadArtifactCreateFailure *globalcatalogv1.UploadArtifactOptions - uploadArtifactDelete *globalcatalogv1.UploadArtifactOptions - listArtifacts *globalcatalogv1.ListArtifactsOptions - getArtifact *globalcatalogv1.GetArtifactOptions - deleteArtifact *globalcatalogv1.DeleteArtifactOptions - config map[string]string - configLoaded bool = false -) +var _ = Describe("Global Catalog - Integration Tests", func() { -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping...") + const ( + externalConfigFile = "../global_catalog.env" + visibilityRestriction = "private" + artifact = `{"someKey": "someValue"}` + ) + + var ( + service *globalcatalogv1.GlobalCatalogV1 + defaultCreate *globalcatalogv1.CreateCatalogEntryOptions + defaultDelete *globalcatalogv1.DeleteCatalogEntryOptions + forceDelete *globalcatalogv1.DeleteCatalogEntryOptions + defaultGet *globalcatalogv1.GetCatalogEntryOptions + defaultUpdate *globalcatalogv1.UpdateCatalogEntryOptions + defaultList *globalcatalogv1.ListCatalogEntriesOptions + defaultChild *globalcatalogv1.CreateCatalogEntryOptions + getChild *globalcatalogv1.GetChildObjectsOptions + defaultRestore *globalcatalogv1.RestoreCatalogEntryOptions + bogusRestore *globalcatalogv1.RestoreCatalogEntryOptions + getVisibility *globalcatalogv1.GetVisibilityOptions + updateVisibility *globalcatalogv1.UpdateVisibilityOptions + getPricing *globalcatalogv1.GetPricingOptions + defaultArtifact *globalcatalogv1.UploadArtifactOptions + uploadArtifactList *globalcatalogv1.UploadArtifactOptions + uploadArtifactCreate *globalcatalogv1.UploadArtifactOptions + uploadArtifactCreateFailure *globalcatalogv1.UploadArtifactOptions + uploadArtifactDelete *globalcatalogv1.UploadArtifactOptions + listArtifacts *globalcatalogv1.ListArtifactsOptions + getArtifact *globalcatalogv1.GetArtifactOptions + deleteArtifact *globalcatalogv1.DeleteArtifactOptions + config map[string]string + configLoaded bool = false + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping...") + } } -} -var _ = Describe("Global Catalog - Integration Tests", func() { It("Successfully load the configuration", func() { var err error _, err = os.Stat(externalConfigFile) @@ -201,7 +202,6 @@ var _ = Describe("Global Catalog - Integration Tests", func() { listArtifacts = service.NewListArtifactsOptions(id) getArtifact = service.NewGetArtifactOptions(id, artifactId) deleteArtifact = service.NewDeleteArtifactOptions(id, artifactId) - deleteChild = service.NewDeleteCatalogEntryOptions(idChild) defaultChild.SetParentID(id) defaultArtifact.SetArtifact(ioutil.NopCloser(strings.NewReader(artifact))) @@ -216,13 +216,13 @@ var _ = Describe("Global Catalog - Integration Tests", func() { JustBeforeEach(func() { shouldSkipTest() - service.DeleteCatalogEntry(forceDelete) + _, _ = service.DeleteCatalogEntry(forceDelete) }) JustAfterEach(func() { shouldSkipTest() - service.DeleteCatalogEntry(forceDelete) + _, _ = service.DeleteCatalogEntry(forceDelete) }) It("Create a catalog entry", func() { @@ -244,7 +244,7 @@ var _ = Describe("Global Catalog - Integration Tests", func() { It("Get a catalog entry", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) + _, _, _ = service.CreateCatalogEntry(defaultCreate) result, detailedResponse, err := service.GetCatalogEntry(defaultGet) Expect(err).To(BeNil()) Expect(detailedResponse.StatusCode).To(Equal(200)) @@ -261,7 +261,7 @@ var _ = Describe("Global Catalog - Integration Tests", func() { It("Update a catalog entry", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) + _, _, _ = service.CreateCatalogEntry(defaultCreate) result, detailedResponse, err := service.UpdateCatalogEntry(defaultUpdate) Expect(err).To(BeNil()) Expect(detailedResponse.StatusCode).To(Equal(200)) @@ -278,7 +278,7 @@ var _ = Describe("Global Catalog - Integration Tests", func() { It("Delete a catalog entry", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) + _, _, _ = service.CreateCatalogEntry(defaultCreate) detailedResponse, err := service.DeleteCatalogEntry(forceDelete) Expect(err).To(BeNil()) Expect(detailedResponse.StatusCode).To(Equal(200)) @@ -287,8 +287,8 @@ var _ = Describe("Global Catalog - Integration Tests", func() { It("Fail to get a catalog entry after deletion", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) - service.DeleteCatalogEntry(forceDelete) + _, _, _ = service.CreateCatalogEntry(defaultCreate) + _, _ = service.DeleteCatalogEntry(forceDelete) _, detailedResponse, err := service.GetCatalogEntry(defaultGet) Expect(err).NotTo(BeNil()) @@ -322,7 +322,7 @@ var _ = Describe("Global Catalog - Integration Tests", func() { It("Fail to create a catalog entry that already exists", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) + _, _, _ = service.CreateCatalogEntry(defaultCreate) _, detailedResponse, err := service.CreateCatalogEntry(defaultCreate) Expect(err).NotTo(BeNil()) @@ -348,8 +348,8 @@ var _ = Describe("Global Catalog - Integration Tests", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) - service.CreateCatalogEntry(defaultChild) + _, _, _ = service.CreateCatalogEntry(defaultCreate) + _, _, _ = service.CreateCatalogEntry(defaultChild) result, detailedResponse, err := service.GetChildObjects(getChild) Expect(err).To(BeNil()) @@ -377,8 +377,8 @@ var _ = Describe("Global Catalog - Integration Tests", func() { It("Restore a catalog entry", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) - service.DeleteCatalogEntry(defaultDelete) + _, _, _ = service.CreateCatalogEntry(defaultCreate) + _, _ = service.DeleteCatalogEntry(defaultDelete) detailedResponseRestore, errRestore := service.RestoreCatalogEntry(defaultRestore) Expect(errRestore).To(BeNil()) @@ -406,7 +406,7 @@ var _ = Describe("Global Catalog - Integration Tests", func() { It("Get visibility for catalog entry", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) + _, _, _ = service.CreateCatalogEntry(defaultCreate) result, detailedResponse, err := service.GetVisibility(getVisibility) Expect(err).To(BeNil()) @@ -427,7 +427,7 @@ var _ = Describe("Global Catalog - Integration Tests", func() { It("Update visibility for catalog entry", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) + _, _, _ = service.CreateCatalogEntry(defaultCreate) detailedResponse, err := service.UpdateVisibility(updateVisibility) Expect(err).NotTo(BeNil()) @@ -445,13 +445,13 @@ var _ = Describe("Global Catalog - Integration Tests", func() { It("Fail to get pricing", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) + _, _, _ = service.CreateCatalogEntry(defaultCreate) _, detailedResponseExists, errExists := service.GetPricing(getPricing) Expect(errExists).NotTo(BeNil()) Expect(detailedResponseExists.StatusCode).To(Equal(404)) - service.DeleteCatalogEntry(forceDelete) + _, _ = service.DeleteCatalogEntry(forceDelete) _, detailedResponseNotExists, errNotExists := service.GetPricing(getPricing) Expect(errNotExists).NotTo(BeNil()) @@ -464,8 +464,8 @@ var _ = Describe("Global Catalog - Integration Tests", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) - service.UploadArtifact(uploadArtifactList) + _, _, _ = service.CreateCatalogEntry(defaultCreate) + _, _ = service.UploadArtifact(uploadArtifactList) result, detailedResponse, err := service.ListArtifacts(listArtifacts) Expect(err).To(BeNil()) @@ -493,28 +493,28 @@ var _ = Describe("Global Catalog - Integration Tests", func() { It("Get artifact for a catalog entry", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) - service.UploadArtifact(defaultArtifact) + _, _, _ = service.CreateCatalogEntry(defaultCreate) + _, _ = service.UploadArtifact(defaultArtifact) result, detailedResponse, err := service.GetArtifact(getArtifact) Expect(result).NotTo(BeNil()) Expect(err).To(BeNil()) Expect(detailedResponse.StatusCode).To(Equal(200)) buf := new(bytes.Buffer) - buf.ReadFrom(result) + _, _ = buf.ReadFrom(result) Expect(buf.String()).To(Equal(artifact)) }) It("Fail to get artifacts that do not exists", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) + _, _, _ = service.CreateCatalogEntry(defaultCreate) _, detailedResponseExists, errExists := service.GetArtifact(getArtifact) Expect(errExists).NotTo(BeNil()) Expect(detailedResponseExists.StatusCode).To(Equal(404)) - service.DeleteCatalogEntry(forceDelete) + _, _ = service.DeleteCatalogEntry(forceDelete) _, detailedResponseNotExists, errNotExists := service.GetArtifact(getArtifact) Expect(errNotExists).NotTo(BeNil()) @@ -524,7 +524,7 @@ var _ = Describe("Global Catalog - Integration Tests", func() { It("Create artifact for a catalog entry", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) + _, _, _ = service.CreateCatalogEntry(defaultCreate) detailedResponse, err := service.UploadArtifact(uploadArtifactCreate) Expect(err).To(BeNil()) @@ -542,8 +542,8 @@ var _ = Describe("Global Catalog - Integration Tests", func() { It("Delete artifact for a catalog entry", func() { shouldSkipTest() - service.CreateCatalogEntry(defaultCreate) - service.UploadArtifact(uploadArtifactDelete) + _, _, _ = service.CreateCatalogEntry(defaultCreate) + _, _ = service.UploadArtifact(uploadArtifactDelete) detailedResponse, err := service.DeleteArtifact(deleteArtifact) Expect(err).To(BeNil()) diff --git a/globalsearchv2/global_search_v2_examples_test.go b/globalsearchv2/global_search_v2_examples_test.go index 85338fba..c6bcd27b 100644 --- a/globalsearchv2/global_search_v2_examples_test.go +++ b/globalsearchv2/global_search_v2_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -44,21 +45,22 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../global_search.env" -var ( - globalSearchService *globalsearchv2.GlobalSearchV2 - config map[string]string - configLoaded bool = false -) - -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") +var _ = Describe(`GlobalSearchV2 Examples Tests`, func() { + const externalConfigFile = "../global_search.env" + + var ( + globalSearchService *globalsearchv2.GlobalSearchV2 + config map[string]string + configLoaded bool = false + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`GlobalSearchV2 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/globaltaggingv1/global_tagging_v1_examples_test.go b/globaltaggingv1/global_tagging_v1_examples_test.go index b38f538b..61938e89 100644 --- a/globaltaggingv1/global_tagging_v1_examples_test.go +++ b/globaltaggingv1/global_tagging_v1_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -44,23 +45,24 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../global_tagging.env" -var ( - globalTaggingService *globaltaggingv1.GlobalTaggingV1 - config map[string]string - configLoaded bool = false +var _ = Describe(`GlobalTaggingV1 Examples Tests`, func() { + const externalConfigFile = "../global_tagging.env" - resourceCRN string -) + var ( + globalTaggingService *globaltaggingv1.GlobalTaggingV1 + config map[string]string + configLoaded bool = false -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") + resourceCRN string + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`GlobalTaggingV1 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/globaltaggingv1/global_tagging_v1_integration_test.go b/globaltaggingv1/global_tagging_v1_integration_test.go index f5d92ab2..a7bb6f7c 100644 --- a/globaltaggingv1/global_tagging_v1_integration_test.go +++ b/globaltaggingv1/global_tagging_v1_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /** @@ -40,15 +41,14 @@ import ( * The integration test will automatically skip tests if the required config file is not available. */ -const ( - externalConfigFile = "../global_tagging.env" - sdkLabel = "go-sdk" -) - -var resourceCRN string - var _ = Describe(`GlobalTaggingV1 Integration Tests`, func() { + const ( + externalConfigFile = "../global_tagging.env" + sdkLabel = "go-sdk" + ) + + var resourceCRN string var ( err error globalTaggingService *globaltaggingv1.GlobalTaggingV1 @@ -113,7 +113,7 @@ var _ = Describe(`GlobalTaggingV1 Integration Tests`, func() { It("Successfully setup the environment for tests", func() { fmt.Fprintln(GinkgoWriter, "Setup...") - cleanTags(globalTaggingService) + cleanTags(globalTaggingService, resourceCRN, sdkLabel) fmt.Fprintln(GinkgoWriter, "Finished setup.") }) }) @@ -448,7 +448,7 @@ var _ = Describe(`GlobalTaggingV1 Integration Tests`, func() { }) It(`Clean rules`, func() { fmt.Fprintln(GinkgoWriter, "Teardown...") - cleanTags(globalTaggingService) + cleanTags(globalTaggingService, resourceCRN, sdkLabel) fmt.Fprintln(GinkgoWriter, "Finished teardown.") }) }) @@ -537,7 +537,7 @@ func listTagsWithLabel(service *globaltaggingv1.GlobalTaggingV1, tagType string, return tagNames } -func cleanTags(service *globaltaggingv1.GlobalTaggingV1) { +func cleanTags(service *globaltaggingv1.GlobalTaggingV1, resourceCRN string, sdkLabel string) { // Detach all user and access tags that contain our label. userTags := getTagNamesForResource(service, resourceCRN, "user") for _, tagName := range userTags { diff --git a/go.mod b/go.mod index 4a4a94a0..79488115 100644 --- a/go.mod +++ b/go.mod @@ -3,11 +3,10 @@ module github.com/IBM/platform-services-go-sdk go 1.16 require ( - github.com/IBM/go-sdk-core/v5 v5.9.5 - github.com/go-openapi/strfmt v0.21.1 + github.com/IBM/go-sdk-core/v5 v5.10.1 + github.com/go-openapi/strfmt v0.21.2 github.com/google/uuid v1.3.0 - github.com/onsi/ginkgo v1.14.2 - github.com/onsi/gomega v1.10.5 - github.com/stretchr/testify v1.7.0 - golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f // indirect + github.com/onsi/ginkgo v1.16.5 + github.com/onsi/gomega v1.17.0 + github.com/stretchr/testify v1.7.1 ) diff --git a/go.sum b/go.sum index 127d32c5..47b679af 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/IBM/go-sdk-core/v5 v5.9.5 h1:+uMyHpOyBlFFd/I0PB+7JqqXOPY2DzRR0tbBjTc4d/g= -github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= +github.com/IBM/go-sdk-core/v5 v5.10.1 h1:IEpjDJyB7okrC6bJ7fPZqBiOv+16VichT6kZXAz9bbQ= +github.com/IBM/go-sdk-core/v5 v5.10.1/go.mod h1:u/33BzPy8sthgEhSeBnf6/kPCqwvC9VKw5byfqQfbe0= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -11,28 +11,32 @@ github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/go-openapi/errors v0.19.8 h1:doM+tQdZbUm9gydV9yR+iQNmztbjj7I3sW4sIcAwIzc= github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/strfmt v0.21.1 h1:G6s2t5V5kGCHLVbSdZ/6lI8Wm4OzoPFkc3/cjAsKQrM= -github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= +github.com/go-openapi/strfmt v0.21.2 h1:5NDNgadiX1Vhemth/TH4gCGopWSTdDjxl60H3B7f+os= +github.com/go-openapi/strfmt v0.21.2/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -41,8 +45,8 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4= -github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-retryablehttp v0.7.1 h1:sUiuQAnLlbvmExtFQs72iFW/HXeUn8Z1aJLQ4LJJbTQ= +github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -57,46 +61,55 @@ github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M= -github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ= -github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= +github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.mongodb.org/mongo-driver v1.7.5 h1:ny3p0reEpgsR2cfA5cjgwFZg3Cv/ofFh/8jbhGtz9VI= go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -104,27 +117,34 @@ golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f h1:rlezHXNlxYWvBCzNses9Dlc7nGFaNMJeqLolcmQSSZY= -golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= @@ -136,9 +156,11 @@ gopkg.in/go-playground/validator.v9 v9.31.0 h1:bmXmP2RSNtFES+bn4uYuHT7iJFJv7Vj+a gopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo= gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/iamaccessgroupsv2/iam_access_groups_v2_integration_test.go b/iamaccessgroupsv2/iam_access_groups_v2_integration_test.go index 7981437c..3777fb0c 100644 --- a/iamaccessgroupsv2/iam_access_groups_v2_integration_test.go +++ b/iamaccessgroupsv2/iam_access_groups_v2_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /** @@ -32,35 +33,35 @@ import ( "github.com/IBM/platform-services-go-sdk/iamaccessgroupsv2" ) -const externalConfigFile = "../iam_access_groups_v2.env" - -var ( - service *iamaccessgroupsv2.IamAccessGroupsV2 - err error - config map[string]string - configLoaded bool = false - - testAccountID string - testGroupName string = "SDK Test Group - Golang" - testGroupDescription string = "This group is used for integration test purposes. It can be deleted at any time." - testGroupEtag string - testGroupID string - testUserID string = "IBMid-" + strconv.Itoa(rand.Intn(100000)) - testClaimRuleID string - testClaimRuleEtag string - testAccountSettings *iamaccessgroupsv2.AccountSettings - - userType string = "user" - etagHeader string = "Etag" -) - -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping...") +var _ = Describe("IAM Access Groups - Integration Tests", func() { + const externalConfigFile = "../iam_access_groups_v2.env" + + var ( + service *iamaccessgroupsv2.IamAccessGroupsV2 + err error + config map[string]string + configLoaded bool = false + + testAccountID string + testGroupName string = "SDK Test Group - Golang" + testGroupDescription string = "This group is used for integration test purposes. It can be deleted at any time." + testGroupEtag string + testGroupID string + testUserID string = "IBMid-" + strconv.Itoa(rand.Intn(100000)) + testClaimRuleID string + testClaimRuleEtag string + testAccountSettings *iamaccessgroupsv2.AccountSettings + + userType string = "user" + etagHeader string = "Etag" + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping...") + } } -} -var _ = Describe("IAM Access Groups - Integration Tests", func() { It("Successfully load the configuration", func() { err = os.Setenv("IBM_CREDENTIALS_FILE", externalConfigFile) if err != nil { @@ -410,37 +411,36 @@ var _ = Describe("IAM Access Groups - Integration Tests", func() { }) }) -}) - -// clean up all test groups -var _ = AfterSuite(func() { - if !configLoaded { - return - } + // clean up all test groups + AfterSuite(func() { + if !configLoaded { + return + } - // list all groups in the account (minus the public access group) - options := service.NewListAccessGroupsOptions(testAccountID) - options.SetHidePublicAccess(true) - result, detailedResponse, err := service.ListAccessGroups(options) - Expect(err).To(BeNil()) - Expect(detailedResponse.StatusCode).To(Equal(200)) + // list all groups in the account (minus the public access group) + options := service.NewListAccessGroupsOptions(testAccountID) + options.SetHidePublicAccess(true) + result, detailedResponse, err := service.ListAccessGroups(options) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(200)) - // iterate across the groups - for _, group := range result.Groups { + // iterate across the groups + for _, group := range result.Groups { - // force delete the test group (or any test groups older than 5 minutes) - if *group.Name == testGroupName { + // force delete the test group (or any test groups older than 5 minutes) + if *group.Name == testGroupName { - createdAt := time.Time(*group.CreatedAt) - fiveMinutesAgo := time.Now().Add(-(time.Duration(5) * time.Minute)) + createdAt := time.Time(*group.CreatedAt) + fiveMinutesAgo := time.Now().Add(-(time.Duration(5) * time.Minute)) - if *group.ID == testGroupID || createdAt.Before(fiveMinutesAgo) { - options := service.NewDeleteAccessGroupOptions(*group.ID) - options.SetForce(true) - detailedResponse, err := service.DeleteAccessGroup(options) - Expect(err).To(BeNil()) - Expect(detailedResponse.StatusCode).To(Equal(204)) + if *group.ID == testGroupID || createdAt.Before(fiveMinutesAgo) { + options := service.NewDeleteAccessGroupOptions(*group.ID) + options.SetForce(true) + detailedResponse, err := service.DeleteAccessGroup(options) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(204)) + } } } - } + }) }) diff --git a/iamidentityv1/iam_identity_v1_examples_test.go b/iamidentityv1/iam_identity_v1_examples_test.go index dbeba73c..dfa4c458 100644 --- a/iamidentityv1/iam_identity_v1_examples_test.go +++ b/iamidentityv1/iam_identity_v1_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -45,48 +46,46 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../iam_identity.env" - -var ( - iamIdentityService *iamidentityv1.IamIdentityV1 - config map[string]string - configLoaded bool = false - - err error - serviceURL string - - apikeyName string = "Example-ApiKey" - serviceIDName string = "Example-ServiceId" - profileName string = "Example-Profile" - accountID string - iamID string - iamAPIKey string - - apikeyID string - apikeyEtag string - - svcID string - svcIDEtag string - - profileId string - profileIamId string - profileEtag string - claimRuleId string - claimRuleEtag string - claimRuleType string = "Profile-SAML" - realmName string = "https://w3id.sso.ibm.com/auth/sps/samlidp2/saml20" - linkId string - - accountSettingEtag string -) - -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") - } -} var _ = Describe(`IamIdentityV1 Examples Tests`, func() { + const externalConfigFile = "../iam_identity.env" + + var ( + iamIdentityService *iamidentityv1.IamIdentityV1 + config map[string]string + configLoaded bool = false + + serviceURL string + + apikeyName string = "Example-ApiKey" + serviceIDName string = "Example-ServiceId" + profileName string = "Example-Profile" + accountID string + iamID string + iamAPIKey string + + apikeyID string + apikeyEtag string + + svcID string + svcIDEtag string + + profileId string + profileEtag string + claimRuleId string + claimRuleEtag string + claimRuleType string = "Profile-SAML" + realmName string = "https://w3id.sso.ibm.com/auth/sps/samlidp2/saml20" + linkId string + + accountSettingEtag string + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } + } Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/iamidentityv1/iam_identity_v1_integration_test.go b/iamidentityv1/iam_identity_v1_integration_test.go index dcb21638..30eff3d3 100644 --- a/iamidentityv1/iam_identity_v1_integration_test.go +++ b/iamidentityv1/iam_identity_v1_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /** @@ -40,28 +41,25 @@ import ( * The integration test will automatically skip tests if the required config file is not available. */ -var ( - apikeyName string = "Go-SDK-IT-APIKey" - serviceIDName string = "Go-SDK-IT-ServiceId" - profileName1 string = "Go-SDK-IT-Profile-1" - profileName2 string = "Go-SDK-IT-Profile-2" - accountID string - iamID string - iamAPIKey string - claimRuleType string = "Profile-SAML" - realmName string = "https://w3id.sso.ibm.com/auth/sps/samlidp2/saml20" - - iamIdentityService *iamidentityv1.IamIdentityV1 -) - var _ = Describe(`IamIdentityV1 Integration Tests`, func() { const externalConfigFile = "../iam_identity.env" var ( - err error - serviceURL string - config map[string]string + apikeyName string = "Go-SDK-IT-APIKey" + serviceIDName string = "Go-SDK-IT-ServiceId" + profileName1 string = "Go-SDK-IT-Profile-1" + profileName2 string = "Go-SDK-IT-Profile-2" + accountID string + iamID string + iamAPIKey string + claimRuleType string = "Profile-SAML" + realmName string = "https://w3id.sso.ibm.com/auth/sps/samlidp2/saml20" + + iamIdentityService *iamidentityv1.IamIdentityV1 + err error + serviceURL string + config map[string]string apikeyId1 string apikeyId2 string @@ -141,7 +139,7 @@ var _ = Describe(`IamIdentityV1 Integration Tests`, func() { }) It("Successfully setup the environment for tests", func() { fmt.Fprintln(GinkgoWriter, "Setup...") - cleanupResources(iamIdentityService) + cleanupResources(iamIdentityService, accountID, iamID, apikeyName, serviceIDName, profileName1, profileName2) fmt.Fprintln(GinkgoWriter, "Finished setup.") }) }) @@ -1443,12 +1441,12 @@ var _ = Describe(`IamIdentityV1 Integration Tests`, func() { Expect(err).ToNot(BeNil()) }) }) -}) -var _ = AfterSuite(func() { - fmt.Println("\nBeginning teardown.") - cleanupResources(iamIdentityService) - fmt.Println("Finished teardown.") + AfterSuite(func() { + fmt.Println("\nBeginning teardown.") + cleanupResources(iamIdentityService, accountID, iamID, apikeyName, serviceIDName, profileName1, profileName2) + fmt.Println("Finished teardown.") + }) }) func getAPIkey(service *iamidentityv1.IamIdentityV1, apikeyID string) *iamidentityv1.APIKey { @@ -1524,7 +1522,7 @@ func getPageTokenFromURL(sptr *string) *string { return &token } -func cleanupResources(service *iamidentityv1.IamIdentityV1) { +func cleanupResources(service *iamidentityv1.IamIdentityV1, accountID string, iamID string, apikeyName string, serviceIDName string, profileName1 string, profileName2 string) { if service == nil { panic("'service' cannot be nil!") } @@ -1562,7 +1560,7 @@ func cleanupResources(service *iamidentityv1.IamIdentityV1) { Pagesize: core.Int64Ptr(int64(100)), } - serviceIDList, response, err := service.ListServiceIds(listServiceIdsOptions) + serviceIDList, _, _ := service.ListServiceIds(listServiceIdsOptions) numServiceIds := len(serviceIDList.Serviceids) fmt.Fprintf(GinkgoWriter, ">>> Cleanup found %d serviceIDs.\n", numServiceIds) diff --git a/iampolicymanagementv1/iam_policy_management_v1_examples_test.go b/iampolicymanagementv1/iam_policy_management_v1_examples_test.go index 350f04c4..0e001f69 100644 --- a/iampolicymanagementv1/iam_policy_management_v1_examples_test.go +++ b/iampolicymanagementv1/iam_policy_management_v1_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -21,11 +22,12 @@ package iampolicymanagementv1_test import ( "encoding/json" "fmt" + "os" + "github.com/IBM/go-sdk-core/v5/core" "github.com/IBM/platform-services-go-sdk/iampolicymanagementv1" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "os" ) // @@ -44,30 +46,31 @@ import ( // export IBM_CREDENTIALS_FILE= // // Location of our config file. -const externalConfigFile = "../iam_policy_management.env" - -var ( - // TODO: Align - iamPolicyManagementService *iampolicymanagementv1.IamPolicyManagementV1 - config map[string]string - configLoaded bool = false - - exampleUserID = "IBMid-user1" - exampleServiceName = "iam-groups" - exampleAccountID string - examplePolicyID string - examplePolicyETag string - exampleCustomRoleID string - exampleCustomRoleETag string -) -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") +var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() { + const externalConfigFile = "../iam_policy_management.env" + + var ( + // TODO: Align + iamPolicyManagementService *iampolicymanagementv1.IamPolicyManagementV1 + config map[string]string + configLoaded bool = false + + exampleUserID = "IBMid-user1" + exampleServiceName = "iam-groups" + exampleAccountID string + examplePolicyID string + examplePolicyETag string + exampleCustomRoleID string + exampleCustomRoleETag string + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/iampolicymanagementv1/iam_policy_management_v1_integration_test.go b/iampolicymanagementv1/iam_policy_management_v1_integration_test.go index 8e549fcf..d534e478 100644 --- a/iampolicymanagementv1/iam_policy_management_v1_integration_test.go +++ b/iampolicymanagementv1/iam_policy_management_v1_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /** @@ -34,35 +35,35 @@ import ( "github.com/IBM/platform-services-go-sdk/iampolicymanagementv1" ) -const externalConfigFile = "../iam_policy_management.env" - -var ( - service *iampolicymanagementv1.IamPolicyManagementV1 - err error - config map[string]string - configLoaded bool = false - - testAccountID string - etagHeader string = "ETag" - testPolicyETag string = "" - testPolicyId string = "" - testUserId string = "IBMid-GoSDK" + strconv.Itoa(rand.Intn(100000)) - testViewerRoleCrn string = "crn:v1:bluemix:public:iam::::role:Viewer" - testEditorRoleCrn string = "crn:v1:bluemix:public:iam::::role:Editor" - testServiceName string = "iam-groups" - - testCustomRoleId string = "" - testCustomRoleETag string = "" - testCustomRoleName string = "TestGoRole" + strconv.Itoa(rand.Intn(100000)) -) - -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping...") +var _ = Describe("IAM Policy Management - Integration Tests", func() { + const externalConfigFile = "../iam_policy_management.env" + + var ( + service *iampolicymanagementv1.IamPolicyManagementV1 + err error + config map[string]string + configLoaded bool = false + + testAccountID string + etagHeader string = "ETag" + testPolicyETag string = "" + testPolicyId string = "" + testUserId string = "IBMid-GoSDK" + strconv.Itoa(rand.Intn(100000)) + testViewerRoleCrn string = "crn:v1:bluemix:public:iam::::role:Viewer" + testEditorRoleCrn string = "crn:v1:bluemix:public:iam::::role:Editor" + testServiceName string = "iam-groups" + + testCustomRoleId string = "" + testCustomRoleETag string = "" + testCustomRoleName string = "TestGoRole" + strconv.Itoa(rand.Intn(100000)) + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping...") + } } -} -var _ = Describe("IAM Policy Management - Integration Tests", func() { It("Successfully load the configuration", func() { err = os.Setenv("IBM_CREDENTIALS_FILE", externalConfigFile) if err != nil { @@ -373,67 +374,66 @@ var _ = Describe("IAM Policy Management - Integration Tests", func() { }) }) -}) - -// clean up all test groups -var _ = AfterSuite(func() { - if !configLoaded { - return - } + // clean up all test groups + AfterSuite(func() { + if !configLoaded { + return + } - fmt.Fprintf(GinkgoWriter, "Cleaning up test groups...\n") + fmt.Fprintf(GinkgoWriter, "Cleaning up test groups...\n") - // list all policies in the account - policyOptions := service.NewListPoliciesOptions(testAccountID) - policyOptions.SetIamID(testUserId) - policyResult, policyDetailedResponse, err := service.ListPolicies(policyOptions) - Expect(err).To(BeNil()) - Expect(policyDetailedResponse.StatusCode).To(Equal(200)) + // list all policies in the account + policyOptions := service.NewListPoliciesOptions(testAccountID) + policyOptions.SetIamID(testUserId) + policyResult, policyDetailedResponse, err := service.ListPolicies(policyOptions) + Expect(err).To(BeNil()) + Expect(policyDetailedResponse.StatusCode).To(Equal(200)) - for _, policy := range policyResult.Policies { + for _, policy := range policyResult.Policies { - // delete the test policy (or any test policy older than 5 minutes) - createdAt, err := time.Parse(time.RFC3339, policy.CreatedAt.String()) - if err != nil { - fmt.Fprintf(GinkgoWriter, "time.Parse error occurred: %v\n", err) - fmt.Fprintf(GinkgoWriter, "Cleanup of policy (%v) failed\n", *policy.ID) - continue - } - fiveMinutesAgo := time.Now().Add(-(time.Duration(5) * time.Minute)) + // delete the test policy (or any test policy older than 5 minutes) + createdAt, err := time.Parse(time.RFC3339, policy.CreatedAt.String()) + if err != nil { + fmt.Fprintf(GinkgoWriter, "time.Parse error occurred: %v\n", err) + fmt.Fprintf(GinkgoWriter, "Cleanup of policy (%v) failed\n", *policy.ID) + continue + } + fiveMinutesAgo := time.Now().Add(-(time.Duration(5) * time.Minute)) - if *policy.ID == testPolicyId || createdAt.Before(fiveMinutesAgo) { - options := service.NewDeletePolicyOptions(*policy.ID) - detailedResponse, err := service.DeletePolicy(options) - Expect(err).To(BeNil()) - Expect(detailedResponse.StatusCode).To(Equal(204)) + if *policy.ID == testPolicyId || createdAt.Before(fiveMinutesAgo) { + options := service.NewDeletePolicyOptions(*policy.ID) + detailedResponse, err := service.DeletePolicy(options) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(204)) + } } - } - // List all custom roles in the account - roleOptions := service.NewListRolesOptions() - roleOptions.SetAccountID(testAccountID) - roleResult, roleDetailedResponse, err := service.ListRoles(roleOptions) - Expect(err).To(BeNil()) - Expect(roleDetailedResponse.StatusCode).To(Equal(200)) + // List all custom roles in the account + roleOptions := service.NewListRolesOptions() + roleOptions.SetAccountID(testAccountID) + roleResult, roleDetailedResponse, err := service.ListRoles(roleOptions) + Expect(err).To(BeNil()) + Expect(roleDetailedResponse.StatusCode).To(Equal(200)) - for _, role := range roleResult.CustomRoles { + for _, role := range roleResult.CustomRoles { - // delete the role (or any test role older than 5 minutes) - createdAt, err := time.Parse(time.RFC3339, role.CreatedAt.String()) - if err != nil { - fmt.Fprintf(GinkgoWriter, "time.Parse error occurred: %v\n", err) - fmt.Fprintf(GinkgoWriter, "Cleanup of role (%v) failed\n", *role.ID) - continue - } - fiveMinutesAgo := time.Now().Add(-(time.Duration(5) * time.Minute)) + // delete the role (or any test role older than 5 minutes) + createdAt, err := time.Parse(time.RFC3339, role.CreatedAt.String()) + if err != nil { + fmt.Fprintf(GinkgoWriter, "time.Parse error occurred: %v\n", err) + fmt.Fprintf(GinkgoWriter, "Cleanup of role (%v) failed\n", *role.ID) + continue + } + fiveMinutesAgo := time.Now().Add(-(time.Duration(5) * time.Minute)) - if *role.ID == testCustomRoleId || createdAt.Before(fiveMinutesAgo) { - options := service.NewDeleteRoleOptions(*role.ID) - detailedResponse, err := service.DeleteRole(options) - Expect(err).To(BeNil()) - Expect(detailedResponse.StatusCode).To(Equal(204)) + if *role.ID == testCustomRoleId || createdAt.Before(fiveMinutesAgo) { + options := service.NewDeleteRoleOptions(*role.ID) + detailedResponse, err := service.DeleteRole(options) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(204)) + } } - } - fmt.Fprintf(GinkgoWriter, "Cleanup finished!\n") + fmt.Fprintf(GinkgoWriter, "Cleanup finished!\n") + }) }) diff --git a/ibmcloudshellv1/ibm_cloud_shell_v1_examples_test.go b/ibmcloudshellv1/ibm_cloud_shell_v1_examples_test.go index b43abc5e..682b973b 100644 --- a/ibmcloudshellv1/ibm_cloud_shell_v1_examples_test.go +++ b/ibmcloudshellv1/ibm_cloud_shell_v1_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -43,22 +44,23 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../ibm_cloud_shell_v1.env" -var ( - ibmCloudShellService *ibmcloudshellv1.IBMCloudShellV1 - config map[string]string - configLoaded bool = false - accountID string -) - -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") +var _ = Describe(`IBMCloudShellV1 Examples Tests`, func() { + const externalConfigFile = "../ibm_cloud_shell_v1.env" + + var ( + ibmCloudShellService *ibmcloudshellv1.IBMCloudShellV1 + config map[string]string + configLoaded bool = false + accountID string + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`IBMCloudShellV1 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error @@ -111,9 +113,7 @@ var _ = Describe(`IBMCloudShellV1 Examples Tests`, func() { fmt.Println("\nGetAccountSettings() result:") // begin-get_account_settings - getAccountSettingsOptions := ibmCloudShellService.NewGetAccountSettingsOptions( - AccountID: &accountID, - ) + getAccountSettingsOptions := ibmCloudShellService.NewGetAccountSettingsOptions(accountID) accountSettings, response, err := ibmCloudShellService.GetAccountSettings(getAccountSettingsOptions) if err != nil { @@ -161,7 +161,7 @@ var _ = Describe(`IBMCloudShellV1 Examples Tests`, func() { updateAccountSettingsOptions := &ibmcloudshellv1.UpdateAccountSettingsOptions{ AccountID: &accountID, - Rev: core.StringPtr(fmt.Sprintf("130-%s", &accountID)), + Rev: core.StringPtr(fmt.Sprintf("130-%s", accountID)), DefaultEnableNewFeatures: core.BoolPtr(false), DefaultEnableNewRegions: core.BoolPtr(true), Enabled: core.BoolPtr(true), diff --git a/openservicebrokerv1/open_service_broker_v1_examples_test.go b/openservicebrokerv1/open_service_broker_v1_examples_test.go index c8e86c49..9afff0e5 100644 --- a/openservicebrokerv1/open_service_broker_v1_examples_test.go +++ b/openservicebrokerv1/open_service_broker_v1_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -51,33 +52,33 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../open_service_broker.env" - -var ( - openServiceBrokerService *openservicebrokerv1.OpenServiceBrokerV1 - config map[string]string - configLoaded bool = false - - instanceId string - orgGUID string - planId string - serviceId string - spaceGUID string - accountId string - bindingId string - appGUID string - initiatorId string = "null" - reasonCode string = "IBMCLOUD_ACCT_SUSPEND" - operation string = "Privision_45" -) -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") +var _ = Describe(`OpenServiceBrokerV1 Examples Tests`, func() { + const externalConfigFile = "../open_service_broker.env" + + var ( + openServiceBrokerService *openservicebrokerv1.OpenServiceBrokerV1 + config map[string]string + configLoaded bool = false + + instanceId string + orgGUID string + planId string + serviceId string + spaceGUID string + accountId string + bindingId string + appGUID string + initiatorId string = "null" + operation string = "Privision_45" + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`OpenServiceBrokerV1 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/openservicebrokerv1/open_service_broker_v1_integration_test.go b/openservicebrokerv1/open_service_broker_v1_integration_test.go index f26c0802..61b37c91 100644 --- a/openservicebrokerv1/open_service_broker_v1_integration_test.go +++ b/openservicebrokerv1/open_service_broker_v1_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /** @@ -32,38 +33,33 @@ import ( "os" ) -const externalConfigFile = "../open_service_broker.env" - -var ( - service *openservicebrokerv1.OpenServiceBrokerV1 - err error - configLoaded bool = false - - testAccountId string = "bc2b2fca0af84354a916dc1de6eee42e" - testResourceGroupGUID string = "13aa3ee48c3b44ddb64c05c79f7ab8ef" - testOrgGUID string = "d35d4f0e-5076-4c89-9361-2522894b6548" - testSpaceGUID string = "336ba5f3-f185-488e-ac8d-02195eebb2f3" - testAppGUID string = "bf692181-1f0e-46be-9faf-eb0857f4d1d5" - testPlanId1 string = "a10e4820-3685-11e9-b210-d663bd873d93" - testPlanId2 string = "a10e4410-3685-11e9-b210-d663bd873d933" - testInstanceId string = "crn:v1:staging:public:bss-monitor:global:a/bc2b2fca0af84354a916dc1de6eee42e:sdkTestInstance::" - testBindingId string = "crn:v1:staging:public:bss-monitor:us-south:a/bc2b2fca0af84354a916dc1de6eee42e:sdkTestInstance:resource-binding:sdkTestBinding" - testInstanceIdEscaped string = "crn%3Av1%3Astaging%3Apublic%3Abss-monitor%3Aglobal%3Aa%2Fbc2b2fca0af84354a916dc1de6eee42e%3AsdkTestInstance%3A%3A" - testBindingIdEscaped string = "crn%3Av1%3Astaging%3Apublic%3Abss-monitor%3Aus-south%3Aa%2Fbc2b2fca0af84354a916dc1de6eee42e%3AsdkTestInstance%3Aresource-binding%3AsdkTestBinding" - testDashboardUrl string = "http://www.example.com/crn%3Av1%3Astaging%3Apublic%3Abss-monitor%3Aglobal%3Aa%2Fbc2b2fca0af84354a916dc1de6eee42e%3AsdkTestInstance%3A%3A" - testServiceId string = "a10e46ae-3685-11e9-b210-d663bd873d93" - testReasonCode string = "test_reason" - testInitiatorId string = "test_initiator" - transactionId string = uuid.New().String() -) - -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping...") - } -} - var _ = Describe("Open Service Broker - Integration Tests", func() { + const externalConfigFile = "../open_service_broker.env" + + var ( + service *openservicebrokerv1.OpenServiceBrokerV1 + err error + configLoaded bool = false + + testAccountId string = "bc2b2fca0af84354a916dc1de6eee42e" + testOrgGUID string = "d35d4f0e-5076-4c89-9361-2522894b6548" + testSpaceGUID string = "336ba5f3-f185-488e-ac8d-02195eebb2f3" + testAppGUID string = "bf692181-1f0e-46be-9faf-eb0857f4d1d5" + testPlanId1 string = "a10e4820-3685-11e9-b210-d663bd873d93" + testPlanId2 string = "a10e4410-3685-11e9-b210-d663bd873d933" + testInstanceId string = "crn:v1:staging:public:bss-monitor:global:a/bc2b2fca0af84354a916dc1de6eee42e:sdkTestInstance::" + testInstanceIdEscaped string = "crn%3Av1%3Astaging%3Apublic%3Abss-monitor%3Aglobal%3Aa%2Fbc2b2fca0af84354a916dc1de6eee42e%3AsdkTestInstance%3A%3A" + testBindingIdEscaped string = "crn%3Av1%3Astaging%3Apublic%3Abss-monitor%3Aus-south%3Aa%2Fbc2b2fca0af84354a916dc1de6eee42e%3AsdkTestInstance%3Aresource-binding%3AsdkTestBinding" + testServiceId string = "a10e46ae-3685-11e9-b210-d663bd873d93" + testInitiatorId string = "test_initiator" + transactionId string = uuid.New().String() + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping...") + } + } It("Successfully load the configuration", func() { _, err = os.Stat(externalConfigFile) diff --git a/posturemanagementv1/posture_management_v1_examples_test.go b/posturemanagementv1/posture_management_v1_examples_test.go index e19325b7..e7420090 100644 --- a/posturemanagementv1/posture_management_v1_examples_test.go +++ b/posturemanagementv1/posture_management_v1_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -45,30 +46,31 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../posture_management.env" -var ( - postureManagementService *posturemanagementv1.PostureManagementV1 - config map[string]string - configLoaded bool = false +var _ = Describe(`PostureManagementV1 Examples Tests`, func() { + const externalConfigFile = "../posture_management.env" - accountID string - profileName string - scopesName string + var ( + postureManagementService *posturemanagementv1.PostureManagementV1 + config map[string]string + configLoaded bool = false - profileID string - scopeID string + accountID string + profileName string + scopesName string - groupProfileID = "0" -) + profileID string + scopeID string -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") + groupProfileID = "0" + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`PostureManagementV1 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/resourcecontrollerv2/resource_controller_v2_examples_test.go b/resourcecontrollerv2/resource_controller_v2_examples_test.go index 7cb0a0c3..f29b443c 100644 --- a/resourcecontrollerv2/resource_controller_v2_examples_test.go +++ b/resourcecontrollerv2/resource_controller_v2_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -49,41 +50,41 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../resource_controller.env" - -var ( - resourceControllerService *resourcecontrollerv2.ResourceControllerV2 - config map[string]string - configLoaded bool = false - - instanceGUID string - aliasGUID string - bindingGUID string - instanceKeyGUID string - resourceGroup string - resourcePlanID string - accountID string - aliasTargetCRN string - bindingTargetCRN string - reclamationID string - resourceInstanceName string = "RcSdkInstance1Go" - resourceInstanceUpdateName string = "RcSdkInstanceUpdate1Go" - aliasName string = "RcSdkAlias1Go" - aliasUpdateName string = "RcSdkAliasUpdate1Go" - bindingName string = "RcSdkBinding1Go" - bindingUpdateName string = "RcSdkBindingUpdate1Go" - keyName string = "RcSdkKey1Go" - keyUpdateName string = "RcSdkKeyUpdate1Go" - targetRegion string = "global" -) - -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") - } -} var _ = Describe(`ResourceControllerV2 Examples Tests`, func() { + const externalConfigFile = "../resource_controller.env" + + var ( + resourceControllerService *resourcecontrollerv2.ResourceControllerV2 + config map[string]string + configLoaded bool = false + + instanceGUID string + aliasGUID string + bindingGUID string + instanceKeyGUID string + resourceGroup string + resourcePlanID string + accountID string + aliasTargetCRN string + bindingTargetCRN string + reclamationID string + resourceInstanceName string = "RcSdkInstance1Go" + resourceInstanceUpdateName string = "RcSdkInstanceUpdate1Go" + aliasName string = "RcSdkAlias1Go" + aliasUpdateName string = "RcSdkAliasUpdate1Go" + bindingName string = "RcSdkBinding1Go" + bindingUpdateName string = "RcSdkBindingUpdate1Go" + keyName string = "RcSdkKey1Go" + keyUpdateName string = "RcSdkKeyUpdate1Go" + targetRegion string = "global" + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } + } Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/resourcemanagerv2/resource_manager_v2_examples_test.go b/resourcemanagerv2/resource_manager_v2_examples_test.go index 486b5292..10da6ac2 100644 --- a/resourcemanagerv2/resource_manager_v2_examples_test.go +++ b/resourcemanagerv2/resource_manager_v2_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -49,27 +50,28 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../resource_manager.env" -var ( - resourceManagerService *resourcemanagerv2.ResourceManagerV2 - deleteResourceManagerService *resourcemanagerv2.ResourceManagerV2 - config map[string]string - configLoaded bool = false +var _ = Describe(`ResourceManagerV2 Examples Tests`, func() { + const externalConfigFile = "../resource_manager.env" - exampleQuotaID string - exampleUserAccountID string + var ( + resourceManagerService *resourcemanagerv2.ResourceManagerV2 + deleteResourceManagerService *resourcemanagerv2.ResourceManagerV2 + config map[string]string + configLoaded bool = false - resourceGroupID string -) + exampleQuotaID string + exampleUserAccountID string -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") + resourceGroupID string + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`ResourceManagerV2 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/resourcemanagerv2/resource_manager_v2_integration_test.go b/resourcemanagerv2/resource_manager_v2_integration_test.go index 9c7dd7f5..f097e15b 100644 --- a/resourcemanagerv2/resource_manager_v2_integration_test.go +++ b/resourcemanagerv2/resource_manager_v2_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /** @@ -28,26 +29,27 @@ import ( . "github.com/onsi/gomega" ) -const externalConfigFile = "../resource_manager.env" - -var ( - service *resourcemanagerv2.ResourceManagerV2 - altService *resourcemanagerv2.ResourceManagerV2 - err error - config map[string]string - testQuotaID string - testUserAccountID string - newResourceGroupID string - configLoaded bool = false -) +var _ = Describe("Resource Manager - Integration Tests", func() { + + const externalConfigFile = "../resource_manager.env" + + var ( + service *resourcemanagerv2.ResourceManagerV2 + altService *resourcemanagerv2.ResourceManagerV2 + err error + config map[string]string + testQuotaID string + testUserAccountID string + newResourceGroupID string + configLoaded bool = false + ) -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping...") + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping...") + } } -} -var _ = Describe("Resource Manager - Integration Tests", func() { It("Successfully load the configuration", func() { _, err = os.Stat(externalConfigFile) if err == nil { diff --git a/usagemeteringv4/usage_metering_v4_examples_test.go b/usagemeteringv4/usage_metering_v4_examples_test.go index ac0c3b6e..80a7b742 100644 --- a/usagemeteringv4/usage_metering_v4_examples_test.go +++ b/usagemeteringv4/usage_metering_v4_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -44,21 +45,22 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../usage_metering.env" -var ( - usageMeteringService *usagemeteringv4.UsageMeteringV4 - config map[string]string - configLoaded bool = false -) - -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") +var _ = Describe(`UsageMeteringV4 Examples Tests`, func() { + const externalConfigFile = "../usage_metering.env" + + var ( + usageMeteringService *usagemeteringv4.UsageMeteringV4 + config map[string]string + configLoaded bool = false + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`UsageMeteringV4 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/usagereportsv4/usage_reports_v4_examples_test.go b/usagereportsv4/usage_reports_v4_examples_test.go index c6d28947..ac42c504 100644 --- a/usagereportsv4/usage_reports_v4_examples_test.go +++ b/usagereportsv4/usage_reports_v4_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -46,26 +47,27 @@ import ( // in a configuration file and then: // export IBM_CREDENTIALS_FILE= // -const externalConfigFile = "../usage_reports.env" -var ( - usageReportsService *usagereportsv4.UsageReportsV4 - config map[string]string - configLoaded bool = false - - accountID string - resourceGroupID string - orgID string - billingMonth string -) - -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") +var _ = Describe(`UsageReportsV4 Examples Tests`, func() { + const externalConfigFile = "../usage_reports.env" + + var ( + usageReportsService *usagereportsv4.UsageReportsV4 + config map[string]string + configLoaded bool = false + + accountID string + resourceGroupID string + orgID string + billingMonth string + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`UsageReportsV4 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/usermanagementv1/user_management_v1_examples_test.go b/usermanagementv1/user_management_v1_examples_test.go index 5e5b4da9..80ce4648 100644 --- a/usermanagementv1/user_management_v1_examples_test.go +++ b/usermanagementv1/user_management_v1_examples_test.go @@ -1,3 +1,4 @@ +//go:build examples // +build examples /** @@ -30,30 +31,31 @@ import ( . "github.com/onsi/gomega" ) -const externalConfigFile = "../user_management.env" +var _ = Describe(`UserManagementV1 Examples Tests`, func() { -var ( - userManagementService *usermanagementv1.UserManagementV1 - userManagementAdminService *usermanagementv1.UserManagementV1 - config map[string]string - configLoaded bool = false + const externalConfigFile = "../user_management.env" - accountID string - userID string - memberEmail string - viewerRoleID string - accessGroupID string + var ( + userManagementService *usermanagementv1.UserManagementV1 + userManagementAdminService *usermanagementv1.UserManagementV1 + config map[string]string + configLoaded bool = false - deleteUserID string -) + accountID string + userID string + memberEmail string + viewerRoleID string + accessGroupID string -func shouldSkipTest() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") + deleteUserID string + ) + + var shouldSkipTest = func() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } } -} -var _ = Describe(`UserManagementV1 Examples Tests`, func() { Describe(`External configuration`, func() { It("Successfully load the configuration", func() { var err error diff --git a/usermanagementv1/user_management_v1_integration_test.go b/usermanagementv1/user_management_v1_integration_test.go index 9cade3fb..874d5c98 100644 --- a/usermanagementv1/user_management_v1_integration_test.go +++ b/usermanagementv1/user_management_v1_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /** @@ -193,9 +194,7 @@ var _ = Describe(`UserManagementV1 Integration Tests`, func() { Expect(result).ToNot(BeNil()) // fmt.Fprintf(GinkgoWriter, "ListUsers() result:\n%s\n", common.ToJSON(result)) - for _, userProfile := range result.Resources { - results = append(results, userProfile) - } + results = append(results, result.Resources...) if result.NextURL != nil { pageStart = getStartTokenFromURL(result.NextURL)