From 3191dfc36f8bcb90d8ec7967fbd4a43ca782cb9c Mon Sep 17 00:00:00 2001 From: Arsalan Khan Date: Mon, 28 Oct 2024 08:51:34 +0100 Subject: [PATCH] Review-fixes -> cleanup --- src/acceptance/app/custom_metric_test.go | 9 --------- .../assets/app/go_app/internal/app/custom_metrics.go | 4 +--- src/acceptance/broker/broker_test.go | 1 - src/autoscaler/metricsforwarder/server/auth/auth_test.go | 1 - 4 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/acceptance/app/custom_metric_test.go b/src/acceptance/app/custom_metric_test.go index b17d589a94..3b9410e5c1 100644 --- a/src/acceptance/app/custom_metric_test.go +++ b/src/acceptance/app/custom_metric_test.go @@ -34,10 +34,6 @@ var _ = Describe("AutoScaler custom metrics", func() { // This test will fail if credential-type is set to X509 in autoscaler broker. // Therefore, only mtls connection will be supported for custom metrics in future Context("when scaling by custom metrics", func() { - BeforeEach(func() { - //instanceName = CreatePolicy(cfg, appToScaleName, appToScaleGUID, policy) - //StartApp(appToScaleName, cfg.CfPushTimeoutDuration()) - }) It("should scale out and scale in", Label(acceptance.LabelSmokeTests), func() { By("Scale out to 2 instances") scaleOut := sendMetricToAutoscaler(cfg, appToScaleGUID, appToScaleName, 550, false) @@ -57,10 +53,6 @@ var _ = Describe("AutoScaler custom metrics", func() { }) Context("when scaling by custom metrics via mtls", func() { - BeforeEach(func() { - //instanceName = CreatePolicy(cfg, appToScaleName, appToScaleGUID, policy) - //StartApp(appToScaleName, cfg.CfPushTimeoutDuration()) - }) It("should scale out and scale in", Label(acceptance.LabelSmokeTests), func() { By("Scale out to 2 instances") scaleOut := sendMetricToAutoscaler(cfg, appToScaleGUID, appToScaleName, 550, true) @@ -114,7 +106,6 @@ var _ = Describe("AutoScaler custom metrics", func() { WithTimeout(5 * time.Minute). WithPolling(15 * time.Second). Should(Equal(1)) - }) }) }) diff --git a/src/acceptance/assets/app/go_app/internal/app/custom_metrics.go b/src/acceptance/assets/app/go_app/internal/app/custom_metrics.go index 0fd629a730..f3bcb84f88 100644 --- a/src/acceptance/assets/app/go_app/internal/app/custom_metrics.go +++ b/src/acceptance/assets/app/go_app/internal/app/custom_metrics.go @@ -73,13 +73,11 @@ func (*CustomMetricAPIClient) PostCustomMetric(ctx context.Context, logger logr. if err != nil { return fmt.Errorf("cloud foundry environment not found %w", err) } - // appToScale is provided i.e. producer and consumer app relationship if appConfig != nil && appConfig.AppID != "" { logger.Info("producer-app-relationship-found", "appToScaleGuid", appConfig.AppID) //assuming the producer app has the same autoscaler service credentials as appToScale appConfig.Services = currentApp.Services - } - if appConfig.AppID == "" { + } else { // metric producer = appToScale (default case) appConfig = currentApp } appId := api.GUID(appConfig.AppID) diff --git a/src/acceptance/broker/broker_test.go b/src/acceptance/broker/broker_test.go index c9474b4d0a..0230550136 100644 --- a/src/acceptance/broker/broker_test.go +++ b/src/acceptance/broker/broker_test.go @@ -109,7 +109,6 @@ var _ = Describe("AutoScaler Service Broker", func() { It("binds&unbinds with configurations and policy", func() { policyFile := "../assets/file/policy/policy-with-configuration.json" policy, err := os.ReadFile(policyFile) - fmt.Println("policy", string(policy)) //FIXME Expect(err).NotTo(HaveOccurred()) err = helpers.BindServiceToAppWithPolicy(cfg, appName, instance.name(), policyFile) diff --git a/src/autoscaler/metricsforwarder/server/auth/auth_test.go b/src/autoscaler/metricsforwarder/server/auth/auth_test.go index 43b93b8d5d..65cdbaf0d7 100644 --- a/src/autoscaler/metricsforwarder/server/auth/auth_test.go +++ b/src/autoscaler/metricsforwarder/server/auth/auth_test.go @@ -211,7 +211,6 @@ var _ = Describe("Authentication", func() { testAppId = "app-to-scale-id" vars["appid"] = testAppId req.Header.Add("X-Forwarded-Client-Cert", MustReadXFCCcert(validClientCert2)) - // ToDO: this should be read via configurations aka scaling policy binding parameters fakeBindingDB.GetCustomMetricStrategyByAppIdReturns("bound_app", nil) nextCalled := 0 nextFunc := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {