From 4f96148a82b34a1e0557d32c516c3219c7fbb66a Mon Sep 17 00:00:00 2001 From: ralikio <74771103+ralikio@users.noreply.github.com> Date: Fri, 14 Jun 2024 14:40:54 +0200 Subject: [PATCH 1/8] Removed Workaround Logic --- cmd/broker/main.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cmd/broker/main.go b/cmd/broker/main.go index 51e5fbf278..d679631ab7 100644 --- a/cmd/broker/main.go +++ b/cmd/broker/main.go @@ -485,13 +485,9 @@ func createAPI(router *mux.Router, servicesConfig broker.ServicesConfig, planVal var convergedCloudRegionProvider = broker.NewOneForAllConvergedCloudRegionsProvider() // backward compatibility for tests - if cfg.SapConvergedCloudRegionMappingsFilePath != "" { - convergedCloudRegionProvider, err = broker.NewDefaultConvergedCloudRegionsProvider(cfg.SapConvergedCloudRegionMappingsFilePath, &broker.YamlRegionReader{}) - fatalOnError(err, logs) - logs.Infof("%s plan region mappings loaded", broker.SapConvergedCloudPlanName) - } else { - logs.Warnf("%s plan region mappings file path is not set, using old configuration", broker.SapConvergedCloudPlanName) - } + convergedCloudRegionProvider, err = broker.NewDefaultConvergedCloudRegionsProvider(cfg.SapConvergedCloudRegionMappingsFilePath, &broker.YamlRegionReader{}) + fatalOnError(err, logs) + logs.Infof("%s plan region mappings loaded", broker.SapConvergedCloudPlanName) // create KymaEnvironmentBroker endpoints kymaEnvBroker := &broker.KymaEnvironmentBroker{ From 54aad93c820add299a1ace508361dab2ea5bdf5d Mon Sep 17 00:00:00 2001 From: ralikio <74771103+ralikio@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:49:06 +0200 Subject: [PATCH 2/8] Backward Compatible Configuration --- cmd/broker/broker_suite_test.go | 1 + .../testdata/old-sap-converged-cloud-region-mappings.yaml | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 cmd/broker/testdata/old-sap-converged-cloud-region-mappings.yaml diff --git a/cmd/broker/broker_suite_test.go b/cmd/broker/broker_suite_test.go index 3448a637ca..54e343fbac 100644 --- a/cmd/broker/broker_suite_test.go +++ b/cmd/broker/broker_suite_test.go @@ -149,6 +149,7 @@ func NewBrokerSuitTestWithMetrics(t *testing.T, cfg *Config, version ...string) func NewBrokerSuiteTestWithOptionalRegion(t *testing.T, version ...string) *BrokerSuiteTest { cfg := fixConfig() + cfg.SapConvergedCloudRegionMappingsFilePath = "testdata/old-sap-converged-cloud-region-mappings.yaml" return NewBrokerSuiteTestWithConfig(t, cfg, version...) } diff --git a/cmd/broker/testdata/old-sap-converged-cloud-region-mappings.yaml b/cmd/broker/testdata/old-sap-converged-cloud-region-mappings.yaml new file mode 100644 index 0000000000..431d29200f --- /dev/null +++ b/cmd/broker/testdata/old-sap-converged-cloud-region-mappings.yaml @@ -0,0 +1,2 @@ +cf-eu20-staging: + - eu-de-1 \ No newline at end of file From 9a8c6ed211d57a65c24f2947b9b44c97e0801ce5 Mon Sep 17 00:00:00 2001 From: ralikio <74771103+ralikio@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:50:31 +0200 Subject: [PATCH 3/8] Newline --- .../testdata/old-sap-converged-cloud-region-mappings.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/broker/testdata/old-sap-converged-cloud-region-mappings.yaml b/cmd/broker/testdata/old-sap-converged-cloud-region-mappings.yaml index 431d29200f..41286e2a33 100644 --- a/cmd/broker/testdata/old-sap-converged-cloud-region-mappings.yaml +++ b/cmd/broker/testdata/old-sap-converged-cloud-region-mappings.yaml @@ -1,2 +1,2 @@ cf-eu20-staging: - - eu-de-1 \ No newline at end of file + - eu-de-1 From fbd47f240df37f020820823970ee0010c8abc089 Mon Sep 17 00:00:00 2001 From: ralikio <74771103+ralikio@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:55:22 +0200 Subject: [PATCH 4/8] Path Initialisation --- cmd/broker/broker_suite_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/broker/broker_suite_test.go b/cmd/broker/broker_suite_test.go index 54e343fbac..25bb48ce52 100644 --- a/cmd/broker/broker_suite_test.go +++ b/cmd/broker/broker_suite_test.go @@ -124,6 +124,7 @@ func (s *BrokerSuiteTest) TearDown() { func NewBrokerSuiteTest(t *testing.T, version ...string) *BrokerSuiteTest { cfg := fixConfig() + cfg.SapConvergedCloudRegionMappingsFilePath = "testdata/old-sap-converged-cloud-region-mappings.yaml" return NewBrokerSuiteTestWithConfig(t, cfg, version...) } From c98bd713d1e487ba3a50b8faca6e6ef1eabe91ab Mon Sep 17 00:00:00 2001 From: ralikio <74771103+ralikio@users.noreply.github.com> Date: Mon, 17 Jun 2024 16:29:15 +0200 Subject: [PATCH 5/8] Path Initialisation --- cmd/broker/suite_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/broker/suite_test.go b/cmd/broker/suite_test.go index aac25e38e4..f8ac28cf4e 100644 --- a/cmd/broker/suite_test.go +++ b/cmd/broker/suite_test.go @@ -1001,6 +1001,7 @@ func fixConfig() *Config { ArchiveEnabled: true, CleaningEnabled: true, + SapConvergedCloudRegionMappingsFilePath: "testdata/old-sap-converged-cloud-region-mappings.yaml", } } From dab94b355daab5122827473d2be2af66e4c4ebde Mon Sep 17 00:00:00 2001 From: ralikio <74771103+ralikio@users.noreply.github.com> Date: Mon, 17 Jun 2024 16:36:46 +0200 Subject: [PATCH 6/8] Linter --- cmd/broker/broker_suite_test.go | 4 ++-- cmd/broker/suite_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/broker/broker_suite_test.go b/cmd/broker/broker_suite_test.go index 25bb48ce52..aebcd8e953 100644 --- a/cmd/broker/broker_suite_test.go +++ b/cmd/broker/broker_suite_test.go @@ -124,7 +124,7 @@ func (s *BrokerSuiteTest) TearDown() { func NewBrokerSuiteTest(t *testing.T, version ...string) *BrokerSuiteTest { cfg := fixConfig() - cfg.SapConvergedCloudRegionMappingsFilePath = "testdata/old-sap-converged-cloud-region-mappings.yaml" + cfg.SapConvergedCloudRegionMappingsFilePath = "testdata/old-sap-converged-cloud-region-mappings.yaml" return NewBrokerSuiteTestWithConfig(t, cfg, version...) } @@ -150,7 +150,7 @@ func NewBrokerSuitTestWithMetrics(t *testing.T, cfg *Config, version ...string) func NewBrokerSuiteTestWithOptionalRegion(t *testing.T, version ...string) *BrokerSuiteTest { cfg := fixConfig() - cfg.SapConvergedCloudRegionMappingsFilePath = "testdata/old-sap-converged-cloud-region-mappings.yaml" + cfg.SapConvergedCloudRegionMappingsFilePath = "testdata/old-sap-converged-cloud-region-mappings.yaml" return NewBrokerSuiteTestWithConfig(t, cfg, version...) } diff --git a/cmd/broker/suite_test.go b/cmd/broker/suite_test.go index f8ac28cf4e..b65b2c1594 100644 --- a/cmd/broker/suite_test.go +++ b/cmd/broker/suite_test.go @@ -999,8 +999,8 @@ func fixConfig() *Config { Deprovisioning: process.StagedManagerConfiguration{MaxStepProcessingTime: time.Minute}, Update: process.StagedManagerConfiguration{MaxStepProcessingTime: time.Minute}, - ArchiveEnabled: true, - CleaningEnabled: true, + ArchiveEnabled: true, + CleaningEnabled: true, SapConvergedCloudRegionMappingsFilePath: "testdata/old-sap-converged-cloud-region-mappings.yaml", } } From 482c3a9605a55ac7688c860f407b7b40e06498be Mon Sep 17 00:00:00 2001 From: ralikio <74771103+ralikio@users.noreply.github.com> Date: Mon, 17 Jun 2024 17:18:56 +0200 Subject: [PATCH 7/8] Test and Main File Adjustments --- cmd/broker/main.go | 4 +--- cmd/broker/provisioning_test.go | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/cmd/broker/main.go b/cmd/broker/main.go index d679631ab7..fcd525faec 100644 --- a/cmd/broker/main.go +++ b/cmd/broker/main.go @@ -482,10 +482,8 @@ func createAPI(router *mux.Router, servicesConfig broker.ServicesConfig, planVal fatalOnError(err, logs) logs.Infof("Number of globalAccountIds for unlimited freeemium: %d\n", len(freemiumGlobalAccountIds)) - var convergedCloudRegionProvider = broker.NewOneForAllConvergedCloudRegionsProvider() - // backward compatibility for tests - convergedCloudRegionProvider, err = broker.NewDefaultConvergedCloudRegionsProvider(cfg.SapConvergedCloudRegionMappingsFilePath, &broker.YamlRegionReader{}) + convergedCloudRegionProvider, err := broker.NewDefaultConvergedCloudRegionsProvider(cfg.SapConvergedCloudRegionMappingsFilePath, &broker.YamlRegionReader{}) fatalOnError(err, logs) logs.Infof("%s plan region mappings loaded", broker.SapConvergedCloudPlanName) diff --git a/cmd/broker/provisioning_test.go b/cmd/broker/provisioning_test.go index ed7489ea66..79f53a2e1e 100644 --- a/cmd/broker/provisioning_test.go +++ b/cmd/broker/provisioning_test.go @@ -199,7 +199,7 @@ func TestProvisioning_HappyPathSapConvergedCloud(t *testing.T) { iid := uuid.New().String() // when - resp := suite.CallAPI("PUT", fmt.Sprintf("oauth/v2/service_instances/%s?accepts_incomplete=true", iid), + resp := suite.CallAPI("PUT", fmt.Sprintf("oauth/cf-eu20-staging/v2/service_instances/%s?accepts_incomplete=true", iid), `{ "service_id": "47c9dcbf-ff30-448e-ab36-d3bad66ba281", "plan_id": "03b812ac-c991-4528-b5bd-08b303523a63", @@ -223,7 +223,6 @@ func TestProvisioning_HappyPathSapConvergedCloud(t *testing.T) { suite.AssertKymaResourceExists(opID) suite.AssertKymaAnnotationExists(opID, "compass-runtime-id-for-migration") suite.AssertKymaLabelsExist(opID, map[string]string{"kyma-project.io/region": "eu-de-1"}) - suite.AssertKymaLabelNotExists(opID, "kyma-project.io/platform-region") } func TestProvisioning_Preview(t *testing.T) { From 2c9b2b2e1387677263a4ae6cbcd869da03bd6e5d Mon Sep 17 00:00:00 2001 From: ralikio <74771103+ralikio@users.noreply.github.com> Date: Mon, 17 Jun 2024 17:21:31 +0200 Subject: [PATCH 8/8] Unnecessary Variable Corrections - Already Set in fixConfig --- cmd/broker/broker_suite_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmd/broker/broker_suite_test.go b/cmd/broker/broker_suite_test.go index aebcd8e953..3448a637ca 100644 --- a/cmd/broker/broker_suite_test.go +++ b/cmd/broker/broker_suite_test.go @@ -124,7 +124,6 @@ func (s *BrokerSuiteTest) TearDown() { func NewBrokerSuiteTest(t *testing.T, version ...string) *BrokerSuiteTest { cfg := fixConfig() - cfg.SapConvergedCloudRegionMappingsFilePath = "testdata/old-sap-converged-cloud-region-mappings.yaml" return NewBrokerSuiteTestWithConfig(t, cfg, version...) } @@ -150,7 +149,6 @@ func NewBrokerSuitTestWithMetrics(t *testing.T, cfg *Config, version ...string) func NewBrokerSuiteTestWithOptionalRegion(t *testing.T, version ...string) *BrokerSuiteTest { cfg := fixConfig() - cfg.SapConvergedCloudRegionMappingsFilePath = "testdata/old-sap-converged-cloud-region-mappings.yaml" return NewBrokerSuiteTestWithConfig(t, cfg, version...) }