diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 89cea199dac..b187a808ab3 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. #------------------------------------------------------------------------------------------------------------- -FROM golang:1.19.7 +FROM golang:1.20.4 # Avoid warnings by switching to noninteractive ENV DEBIAN_FRONTEND=noninteractive @@ -63,7 +63,7 @@ RUN apt-get update \ && mv $HOME/.local/include/ /usr/local/bin/include/ \ && protoc --version \ # Install golangci-lint - && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0 \ + && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2 \ # # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user. && groupadd --gid $USER_GID $USERNAME \ diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index e4166c00507..48fffcad572 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: "1.20" - run: go version - name: Get branch name id: branch-name diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index 6367f7fd878..0cb9a2d6be7 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -13,7 +13,7 @@ jobs: id-token: write # needed for signing the images with GitHub OIDC Token **not production ready** # build-tools is built from ../../tools/build-tools.Dockerfile - container: ghcr.io/kedacore/build-tools:1.19.7 + container: ghcr.io/kedacore/build-tools:1.20.4 steps: - name: Check out code uses: actions/checkout@v3 @@ -41,7 +41,7 @@ jobs: key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} - name: Go modules sync - run: go mod tidy -compat=1.19 + run: go mod tidy -compat=1.20 - name: Test run: make test diff --git a/.github/workflows/pr-e2e.yml b/.github/workflows/pr-e2e.yml index 06b3d1d92e6..0c76fa1c5fd 100644 --- a/.github/workflows/pr-e2e.yml +++ b/.github/workflows/pr-e2e.yml @@ -55,7 +55,7 @@ jobs: needs: triage runs-on: ubuntu-latest name: Build images - container: ghcr.io/kedacore/build-tools:1.19.7 + container: ghcr.io/kedacore/build-tools:1.20.4 if: needs.triage.outputs.run-e2e == 'true' steps: - name: Set status in-progress @@ -98,7 +98,7 @@ jobs: needs: [triage, build-test-images] runs-on: e2e name: Execute e2e tests - container: ghcr.io/kedacore/build-tools:1.19.7 + container: ghcr.io/kedacore/build-tools:1.20.4 if: needs.triage.outputs.run-e2e == 'true' steps: - name: Set status in-progress diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 3a1dbd51505..43c78917a34 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -5,7 +5,7 @@ jobs: validate: name: validate - ${{ matrix.name }} runs-on: ${{ matrix.runner }} - container: ghcr.io/kedacore/build-tools:1.19.7 + container: ghcr.io/kedacore/build-tools:1.20.4 strategy: matrix: include: @@ -45,7 +45,7 @@ jobs: key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} - name: Go modules sync - run: go mod tidy -compat=1.19 + run: go mod tidy -compat=1.20 - name: Verify Generated clientset is up to date run: make clientset-verify @@ -65,7 +65,7 @@ jobs: validate-dockerfiles: name: validate-dockerfiles - ${{ matrix.name }} runs-on: ${{ matrix.runner }} - container: ghcr.io/kedacore/build-tools:1.19.7 + container: ghcr.io/kedacore/build-tools:1.20.4 strategy: matrix: include: @@ -96,7 +96,7 @@ jobs: validate-build-tools: name: Validate build-tools - ${{ matrix.name }} runs-on: ${{ matrix.runner }} - container: ghcr.io/kedacore/build-tools:1.19.7 + container: ghcr.io/kedacore/build-tools:1.20.4 strategy: matrix: include: @@ -133,7 +133,7 @@ jobs: validate-dev-container: name: Validate dev-container - ${{ matrix.name }} runs-on: ${{ matrix.runner }} - container: ghcr.io/kedacore/build-tools:1.19.7 + container: ghcr.io/kedacore/build-tools:1.20.4 strategy: matrix: include: @@ -168,9 +168,9 @@ jobs: python-version: 3.x - uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: "1.20" - name: Get golangci - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0 + run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2 - uses: pre-commit/action@v3.0.0 trivy-scan: diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 8b588428af1..bb24e1a8e34 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -13,7 +13,7 @@ jobs: id-token: write # needed for signing the images with GitHub OIDC Token **not production ready** # build-tools is built from ../../tools/build-tools.Dockerfile - container: ghcr.io/kedacore/build-tools:1.19.7 + container: ghcr.io/kedacore/build-tools:1.20.4 steps: - name: Check out code uses: actions/checkout@v3 @@ -41,7 +41,7 @@ jobs: key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} - name: Go modules sync - run: go mod tidy -compat=1.19 + run: go mod tidy -compat=1.20 - name: Login to GitHub Container Registry uses: docker/login-action@v2 diff --git a/.github/workflows/static-analysis-codeql.yml b/.github/workflows/static-analysis-codeql.yml index 1532b845644..650f2c5aea0 100644 --- a/.github/workflows/static-analysis-codeql.yml +++ b/.github/workflows/static-analysis-codeql.yml @@ -9,7 +9,7 @@ jobs: codeQl: name: Analyze CodeQL Go runs-on: ubuntu-latest - container: ghcr.io/kedacore/build-tools:1.19.7 + container: ghcr.io/kedacore/build-tools:1.20.4 if: (github.actor != 'dependabot[bot]') steps: - name: Checkout repository diff --git a/.github/workflows/template-main-e2e-test.yml b/.github/workflows/template-main-e2e-test.yml index b99e6d4deee..f31aa423076 100644 --- a/.github/workflows/template-main-e2e-test.yml +++ b/.github/workflows/template-main-e2e-test.yml @@ -8,7 +8,7 @@ jobs: name: Run e2e test runs-on: ARM64 # build-tools is built from ../../tools/build-tools.Dockerfile - container: ghcr.io/kedacore/build-tools:1.19.7 + container: ghcr.io/kedacore/build-tools:1.20.4 concurrency: e2e-tests steps: - name: Check out code diff --git a/.github/workflows/template-smoke-tests.yml b/.github/workflows/template-smoke-tests.yml index 4d634ec951d..7f0e6e20ec8 100644 --- a/.github/workflows/template-smoke-tests.yml +++ b/.github/workflows/template-smoke-tests.yml @@ -20,7 +20,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: "1.20" - name: Install prerequisites run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index b39dab8aa03..20f0b57af69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,6 +73,7 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio ### Other +- **General**: Bump Golang to 1.20 ([#4517](https://github.com/kedacore/keda/issues/4517)) - **General**: Drop a transitive dependency on bou.ke/monkey ([#4364](https://github.com/kedacore/keda/issues/4364)) - **General**: Fix odd number of arguments passed as key-value pairs for logging ([#4368](https://github.com/kedacore/keda/issues/4368)) - **General**: Automatically scale test clusters in/out to reduce environmental footprint & improve cost-efficiency ([#4456](https://github.com/kedacore/keda/pull/4456)) diff --git a/Dockerfile b/Dockerfile index feb74ac8949..1f1c50168b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM --platform=$BUILDPLATFORM ghcr.io/kedacore/build-tools:1.19.7 AS builder +FROM --platform=$BUILDPLATFORM ghcr.io/kedacore/build-tools:1.20.4 AS builder ARG BUILD_VERSION=main ARG GIT_COMMIT=HEAD diff --git a/Dockerfile.adapter b/Dockerfile.adapter index 6427fbdd091..a8bd5313df8 100644 --- a/Dockerfile.adapter +++ b/Dockerfile.adapter @@ -1,5 +1,5 @@ # Build the adapter binary -FROM --platform=$BUILDPLATFORM ghcr.io/kedacore/build-tools:1.19.7 AS builder +FROM --platform=$BUILDPLATFORM ghcr.io/kedacore/build-tools:1.20.4 AS builder ARG BUILD_VERSION=main ARG GIT_COMMIT=HEAD diff --git a/Dockerfile.webhooks b/Dockerfile.webhooks index aff9721ca8c..e0b7877c206 100644 --- a/Dockerfile.webhooks +++ b/Dockerfile.webhooks @@ -1,5 +1,5 @@ # Build the manager binary -FROM --platform=$BUILDPLATFORM ghcr.io/kedacore/build-tools:1.19.7 AS builder +FROM --platform=$BUILDPLATFORM ghcr.io/kedacore/build-tools:1.20.4 AS builder ARG BUILD_VERSION=main ARG GIT_COMMIT=HEAD diff --git a/go.mod b/go.mod index 871a1c07086..a47a056c04f 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/kedacore/keda/v2 -go 1.19 +go 1.20 require ( cloud.google.com/go/compute/metadata v0.2.3 diff --git a/pkg/certificates/certificate_manager.go b/pkg/certificates/certificate_manager.go index a7ccab5b49f..570a3a12663 100644 --- a/pkg/certificates/certificate_manager.go +++ b/pkg/certificates/certificate_manager.go @@ -73,7 +73,7 @@ func (cm CertManager) AddCertificateRotation(ctx context.Context, mgr manager.Ma extraDNSNames = append(extraDNSNames, getDNSNames(cm.MetricsServerService)...) cm.Logger.V(1).Info("setting up cert rotation") - if err := rotator.AddRotator(mgr, &rotator.CertRotator{ + err = rotator.AddRotator(mgr, &rotator.CertRotator{ SecretKey: types.NamespacedName{ Namespace: kedautil.GetPodNamespace(), Name: cm.SecretName, @@ -91,10 +91,8 @@ func (cm CertManager) AddCertificateRotation(ctx context.Context, mgr manager.Ma x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth, }, - }); err != nil { - return err - } - return nil + }) + return err } // getDNSNames creates all the possible DNS names for a given service diff --git a/pkg/provider/provider.go b/pkg/provider/provider.go index c6a5752705a..737b1d4017e 100644 --- a/pkg/provider/provider.go +++ b/pkg/provider/provider.go @@ -239,14 +239,14 @@ func (p *KedaProvider) ListAllExternalMetrics() []provider.ExternalMetricInfo { // GetMetricByName fetches a particular metric for a particular object. // The namespace will be empty if the metric is root-scoped. -func (p *KedaProvider) GetMetricByName(ctx context.Context, name types.NamespacedName, info provider.CustomMetricInfo, metricSelector labels.Selector) (*custom_metrics.MetricValue, error) { +func (p *KedaProvider) GetMetricByName(_ context.Context, _ types.NamespacedName, _ provider.CustomMetricInfo, _ labels.Selector) (*custom_metrics.MetricValue, error) { // not implemented yet return nil, apiErrors.NewServiceUnavailable("not implemented yet") } // GetMetricBySelector fetches a particular metric for a set of objects matching // the given label selector. The namespace will be empty if the metric is root-scoped. -func (p *KedaProvider) GetMetricBySelector(ctx context.Context, namespace string, selector labels.Selector, info provider.CustomMetricInfo, metricSelector labels.Selector) (*custom_metrics.MetricValueList, error) { +func (p *KedaProvider) GetMetricBySelector(_ context.Context, namespace string, selector labels.Selector, info provider.CustomMetricInfo, _ labels.Selector) (*custom_metrics.MetricValueList, error) { logger.V(0).Info("Received request for custom metric, which is not supported by this adapter", "groupresource", info.GroupResource.String(), "namespace", namespace, "metric name", info.Metric, "selector", selector.String()) return nil, apiErrors.NewServiceUnavailable("not implemented yet") } diff --git a/pkg/scalers/arangodb_scaler.go b/pkg/scalers/arangodb_scaler.go index 29b343f971c..1a7208f5ee1 100644 --- a/pkg/scalers/arangodb_scaler.go +++ b/pkg/scalers/arangodb_scaler.go @@ -202,7 +202,7 @@ func parseArangoDBMetadata(config *ScalerConfig) (*arangoDBMetadata, error) { } // Close disposes of arangoDB connections -func (s *arangoDBScaler) Close(ctx context.Context) error { +func (s *arangoDBScaler) Close(_ context.Context) error { return nil } diff --git a/pkg/scalers/aws_cloudwatch_scaler.go b/pkg/scalers/aws_cloudwatch_scaler.go index 53eb2ea7f9b..82406fedcf7 100644 --- a/pkg/scalers/aws_cloudwatch_scaler.go +++ b/pkg/scalers/aws_cloudwatch_scaler.go @@ -278,7 +278,7 @@ func computeQueryWindow(current time.Time, metricPeriodSec, metricEndTimeOffsetS return } -func (s *awsCloudwatchScaler) GetMetricsAndActivity(ctx context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { +func (s *awsCloudwatchScaler) GetMetricsAndActivity(_ context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { metricValue, err := s.GetCloudwatchMetrics() if err != nil { diff --git a/pkg/scalers/aws_dynamodb_scaler.go b/pkg/scalers/aws_dynamodb_scaler.go index c6913efb1a5..4d0d1cef9b3 100644 --- a/pkg/scalers/aws_dynamodb_scaler.go +++ b/pkg/scalers/aws_dynamodb_scaler.go @@ -180,7 +180,7 @@ func createDynamoDBClient(metadata *awsDynamoDBMetadata) *dynamodb.DynamoDB { return dynamodb.New(sess, config) } -func (s *awsDynamoDBScaler) GetMetricsAndActivity(ctx context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { +func (s *awsDynamoDBScaler) GetMetricsAndActivity(_ context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { metricValue, err := s.GetQueryMetrics() if err != nil { s.logger.Error(err, "Error getting metric value") diff --git a/pkg/scalers/aws_dynamodb_streams_scaler_test.go b/pkg/scalers/aws_dynamodb_streams_scaler_test.go index c792c8f5299..a4dc8b2441d 100644 --- a/pkg/scalers/aws_dynamodb_streams_scaler_test.go +++ b/pkg/scalers/aws_dynamodb_streams_scaler_test.go @@ -66,7 +66,7 @@ type mockAwsDynamoDBStreams struct { dynamodbstreamsiface.DynamoDBStreamsAPI } -func (m *mockAwsDynamoDBStreams) DescribeStreamWithContext(ctx context.Context, input *dynamodbstreams.DescribeStreamInput, opts ...request.Option) (*dynamodbstreams.DescribeStreamOutput, error) { +func (m *mockAwsDynamoDBStreams) DescribeStreamWithContext(_ context.Context, input *dynamodbstreams.DescribeStreamInput, _ ...request.Option) (*dynamodbstreams.DescribeStreamOutput, error) { switch *input.StreamArn { case testAWSDynamoDBStreamsErrorArn: return nil, errors.New("Error dynamodbstream DescribeStream") @@ -95,7 +95,7 @@ type mockAwsDynamoDB struct { dynamodbiface.DynamoDBAPI } -func (m *mockAwsDynamoDB) DescribeTableWithContext(ctx context.Context, input *dynamodb.DescribeTableInput, opts ...request.Option) (*dynamodb.DescribeTableOutput, error) { +func (m *mockAwsDynamoDB) DescribeTableWithContext(_ context.Context, input *dynamodb.DescribeTableInput, _ ...request.Option) (*dynamodb.DescribeTableOutput, error) { switch *input.TableName { case testAWSDynamoDBInvalidTable: return nil, fmt.Errorf("DynamoDB Stream Arn is invalid") diff --git a/pkg/scalers/aws_kinesis_stream_scaler.go b/pkg/scalers/aws_kinesis_stream_scaler.go index 513b4c09645..419407bfe70 100644 --- a/pkg/scalers/aws_kinesis_stream_scaler.go +++ b/pkg/scalers/aws_kinesis_stream_scaler.go @@ -134,7 +134,7 @@ func (s *awsKinesisStreamScaler) GetMetricSpecForScaling(context.Context) []v2.M } // GetMetricsAndActivity returns value for a supported metric and an error if there is a problem getting the metric -func (s *awsKinesisStreamScaler) GetMetricsAndActivity(ctx context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { +func (s *awsKinesisStreamScaler) GetMetricsAndActivity(_ context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { shardCount, err := s.GetAwsKinesisOpenShardCount() if err != nil { diff --git a/pkg/scalers/aws_sqs_queue_scaler.go b/pkg/scalers/aws_sqs_queue_scaler.go index be1c50cb87e..effc6fa607e 100644 --- a/pkg/scalers/aws_sqs_queue_scaler.go +++ b/pkg/scalers/aws_sqs_queue_scaler.go @@ -187,7 +187,7 @@ func (s *awsSqsQueueScaler) GetMetricSpecForScaling(context.Context) []v2.Metric } // GetMetricsAndActivity returns value for a supported metric and an error if there is a problem getting the metric -func (s *awsSqsQueueScaler) GetMetricsAndActivity(ctx context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { +func (s *awsSqsQueueScaler) GetMetricsAndActivity(_ context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { queuelen, err := s.getAwsSqsQueueLength() if err != nil { diff --git a/pkg/scalers/azure/azure_aad_workload_identity.go b/pkg/scalers/azure/azure_aad_workload_identity.go index 25afc89daad..e8d4ac89549 100644 --- a/pkg/scalers/azure/azure_aad_workload_identity.go +++ b/pkg/scalers/azure/azure_aad_workload_identity.go @@ -186,7 +186,7 @@ func (wiTokenProvider *ADWorkloadIdentityTokenProvider) EnsureFresh() error { } // GetToken is for implementing the auth.TokenProvider interface -func (wiTokenProvider *ADWorkloadIdentityTokenProvider) GetToken(uri string) (*amqpAuth.Token, error) { +func (wiTokenProvider *ADWorkloadIdentityTokenProvider) GetToken(_ string) (*amqpAuth.Token, error) { err := wiTokenProvider.Refresh() if err != nil { return nil, err diff --git a/pkg/scalers/cassandra_scaler.go b/pkg/scalers/cassandra_scaler.go index 3c7c0773a85..35a3c29415d 100644 --- a/pkg/scalers/cassandra_scaler.go +++ b/pkg/scalers/cassandra_scaler.go @@ -226,7 +226,7 @@ func (s *cassandraScaler) GetQueryResult(ctx context.Context) (int64, error) { } // Close closes the Cassandra session connection. -func (s *cassandraScaler) Close(ctx context.Context) error { +func (s *cassandraScaler) Close(_ context.Context) error { s.session.Close() return nil diff --git a/pkg/scalers/cpu_memory_scaler.go b/pkg/scalers/cpu_memory_scaler.go index 8f7a355ae41..83851b360f1 100644 --- a/pkg/scalers/cpu_memory_scaler.go +++ b/pkg/scalers/cpu_memory_scaler.go @@ -119,6 +119,6 @@ func (s *cpuMemoryScaler) GetMetricSpecForScaling(context.Context) []v2.MetricSp } // GetMetrics no need for cpu/memory scaler and always active for cpu/memory scaler -func (s *cpuMemoryScaler) GetMetricsAndActivity(ctx context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { +func (s *cpuMemoryScaler) GetMetricsAndActivity(_ context.Context, _ string) ([]external_metrics.ExternalMetricValue, bool, error) { return nil, true, nil } diff --git a/pkg/scalers/cron_scaler.go b/pkg/scalers/cron_scaler.go index 9a0cbc5e1c6..9bb269eaf6f 100644 --- a/pkg/scalers/cron_scaler.go +++ b/pkg/scalers/cron_scaler.go @@ -140,7 +140,7 @@ func (s *cronScaler) GetMetricSpecForScaling(context.Context) []v2.MetricSpec { } // GetMetricsAndActivity returns value for a supported metric and an error if there is a problem getting the metric -func (s *cronScaler) GetMetricsAndActivity(ctx context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { +func (s *cronScaler) GetMetricsAndActivity(_ context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { var defaultDesiredReplicas = int64(defaultDesiredReplicas) location, err := time.LoadLocation(s.metadata.timezone) diff --git a/pkg/scalers/elasticsearch_scaler.go b/pkg/scalers/elasticsearch_scaler.go index 932a187207f..f06827b9f44 100644 --- a/pkg/scalers/elasticsearch_scaler.go +++ b/pkg/scalers/elasticsearch_scaler.go @@ -256,7 +256,7 @@ func newElasticsearchClient(meta *elasticsearchMetadata, logger logr.Logger) (*e return esClient, nil } -func (s *elasticsearchScaler) Close(ctx context.Context) error { +func (s *elasticsearchScaler) Close(_ context.Context) error { return nil } diff --git a/pkg/scalers/external_mock_scaler.go b/pkg/scalers/external_mock_scaler.go index ee9a2bbc60a..29564c33515 100644 --- a/pkg/scalers/external_mock_scaler.go +++ b/pkg/scalers/external_mock_scaler.go @@ -26,12 +26,12 @@ var ( type externalMockScaler struct{} -func NewExternalMockScaler(config *ScalerConfig) (Scaler, error) { +func NewExternalMockScaler(_ *ScalerConfig) (Scaler, error) { return &externalMockScaler{}, nil } // Close implements Scaler -func (*externalMockScaler) Close(ctx context.Context) error { +func (*externalMockScaler) Close(_ context.Context) error { return nil } @@ -45,7 +45,7 @@ func (*externalMockScaler) GetMetricSpecForScaling(context.Context) []v2.MetricS } // GetMetricsAndActivity implements Scaler -func (*externalMockScaler) GetMetricsAndActivity(ctx context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { +func (*externalMockScaler) GetMetricsAndActivity(_ context.Context, _ string) ([]external_metrics.ExternalMetricValue, bool, error) { if atomic.LoadInt32(&MockExternalServerStatus) != MockExternalServerStatusOnline { return nil, false, ErrMock } diff --git a/pkg/scalers/github_runner_scaler.go b/pkg/scalers/github_runner_scaler.go index 9e5314a4941..505abe4b537 100644 --- a/pkg/scalers/github_runner_scaler.go +++ b/pkg/scalers/github_runner_scaler.go @@ -601,7 +601,7 @@ func (s *githubRunnerScaler) GetMetricsAndActivity(ctx context.Context, metricNa return []external_metrics.ExternalMetricValue{metric}, queueLen >= s.metadata.targetWorkflowQueueLength, nil } -func (s *githubRunnerScaler) GetMetricSpecForScaling(ctx context.Context) []v2.MetricSpec { +func (s *githubRunnerScaler) GetMetricSpecForScaling(_ context.Context) []v2.MetricSpec { externalMetric := &v2.ExternalMetricSource{ Metric: v2.MetricIdentifier{ Name: GenerateMetricNameWithIndex(s.metadata.scalerIndex, kedautil.NormalizeString(fmt.Sprintf("github-runner-%s", s.metadata.owner))), @@ -612,6 +612,6 @@ func (s *githubRunnerScaler) GetMetricSpecForScaling(ctx context.Context) []v2.M return []v2.MetricSpec{metricSpec} } -func (s *githubRunnerScaler) Close(ctx context.Context) error { +func (s *githubRunnerScaler) Close(_ context.Context) error { return nil } diff --git a/pkg/scalers/huawei_cloudeye_scaler.go b/pkg/scalers/huawei_cloudeye_scaler.go index 081ee2509ed..4f13a10d6c7 100644 --- a/pkg/scalers/huawei_cloudeye_scaler.go +++ b/pkg/scalers/huawei_cloudeye_scaler.go @@ -240,7 +240,7 @@ func gethuaweiAuthorization(authParams map[string]string) (huaweiAuthorizationMe return meta, nil } -func (s *huaweiCloudeyeScaler) GetMetricsAndActivity(ctx context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { +func (s *huaweiCloudeyeScaler) GetMetricsAndActivity(_ context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { metricValue, err := s.GetCloudeyeMetrics() if err != nil { diff --git a/pkg/scalers/kafka_scaler.go b/pkg/scalers/kafka_scaler.go index 1505dd748fb..9a3de9c7e65 100644 --- a/pkg/scalers/kafka_scaler.go +++ b/pkg/scalers/kafka_scaler.go @@ -603,7 +603,7 @@ func (s *kafkaScaler) getConsumerAndProducerOffsets(topicPartitions map[string][ } // GetMetricsAndActivity returns value for a supported metric and an error if there is a problem getting the metric -func (s *kafkaScaler) GetMetricsAndActivity(ctx context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { +func (s *kafkaScaler) GetMetricsAndActivity(_ context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { totalLag, totalLagWithPersistent, err := s.getTotalLag() if err != nil { return []external_metrics.ExternalMetricValue{}, false, err diff --git a/pkg/scalers/kafka_scaler_test.go b/pkg/scalers/kafka_scaler_test.go index d9eb7fb6b6f..d321f5bcfd0 100644 --- a/pkg/scalers/kafka_scaler_test.go +++ b/pkg/scalers/kafka_scaler_test.go @@ -440,7 +440,7 @@ type MockClusterAdmin struct { partitionIds []int32 } -func (m *MockClusterAdmin) CreateTopic(topic string, detail *sarama.TopicDetail, validateOnly bool) error { +func (m *MockClusterAdmin) CreateTopic(_ string, _ *sarama.TopicDetail, _ bool) error { return nil } func (m *MockClusterAdmin) ListTopics() (map[string]sarama.TopicDetail, error) { @@ -461,39 +461,39 @@ func (m *MockClusterAdmin) DescribeTopics(topics []string) (metadata []*sarama.T return metadatas, nil } -func (m *MockClusterAdmin) DeleteTopic(topic string) error { +func (m *MockClusterAdmin) DeleteTopic(_ string) error { return nil } -func (m *MockClusterAdmin) CreatePartitions(topic string, count int32, assignment [][]int32, validateOnly bool) error { +func (m *MockClusterAdmin) CreatePartitions(_ string, _ int32, _ [][]int32, _ bool) error { return nil } -func (m *MockClusterAdmin) AlterPartitionReassignments(topic string, assignment [][]int32) error { +func (m *MockClusterAdmin) AlterPartitionReassignments(_ string, _ [][]int32) error { return nil } -func (m *MockClusterAdmin) ListPartitionReassignments(topics string, partitions []int32) (topicStatus map[string]map[int32]*sarama.PartitionReplicaReassignmentsStatus, err error) { +func (m *MockClusterAdmin) ListPartitionReassignments(_ string, _ []int32) (topicStatus map[string]map[int32]*sarama.PartitionReplicaReassignmentsStatus, err error) { return nil, nil } -func (m *MockClusterAdmin) DeleteRecords(topic string, partitionOffsets map[int32]int64) error { +func (m *MockClusterAdmin) DeleteRecords(_ string, _ map[int32]int64) error { return nil } -func (m *MockClusterAdmin) DescribeConfig(resource sarama.ConfigResource) ([]sarama.ConfigEntry, error) { +func (m *MockClusterAdmin) DescribeConfig(_ sarama.ConfigResource) ([]sarama.ConfigEntry, error) { return nil, nil } -func (m *MockClusterAdmin) AlterConfig(resourceType sarama.ConfigResourceType, name string, entries map[string]*string, validateOnly bool) error { +func (m *MockClusterAdmin) AlterConfig(_ sarama.ConfigResourceType, _ string, _ map[string]*string, _ bool) error { return nil } -func (m *MockClusterAdmin) IncrementalAlterConfig(resourceType sarama.ConfigResourceType, name string, entries map[string]sarama.IncrementalAlterConfigsEntry, validateOnly bool) error { +func (m *MockClusterAdmin) IncrementalAlterConfig(_ sarama.ConfigResourceType, _ string, _ map[string]sarama.IncrementalAlterConfigsEntry, _ bool) error { return nil } -func (m *MockClusterAdmin) CreateACL(resource sarama.Resource, acl sarama.Acl) error { +func (m *MockClusterAdmin) CreateACL(_ sarama.Resource, _ sarama.Acl) error { return nil } @@ -501,11 +501,11 @@ func (m *MockClusterAdmin) CreateACLs([]*sarama.ResourceAcls) error { return nil } -func (m *MockClusterAdmin) ListAcls(filter sarama.AclFilter) ([]sarama.ResourceAcls, error) { +func (m *MockClusterAdmin) ListAcls(_ sarama.AclFilter) ([]sarama.ResourceAcls, error) { return nil, nil } -func (m *MockClusterAdmin) DeleteACL(filter sarama.AclFilter, validateOnly bool) ([]sarama.MatchingAcl, error) { +func (m *MockClusterAdmin) DeleteACL(_ sarama.AclFilter, _ bool) ([]sarama.MatchingAcl, error) { return nil, nil } @@ -513,19 +513,19 @@ func (m *MockClusterAdmin) ListConsumerGroups() (map[string]string, error) { return nil, nil } -func (m *MockClusterAdmin) DescribeConsumerGroups(groups []string) ([]*sarama.GroupDescription, error) { +func (m *MockClusterAdmin) DescribeConsumerGroups(_ []string) ([]*sarama.GroupDescription, error) { return nil, nil } -func (m *MockClusterAdmin) ListConsumerGroupOffsets(group string, topicPartitions map[string][]int32) (*sarama.OffsetFetchResponse, error) { +func (m *MockClusterAdmin) ListConsumerGroupOffsets(_ string, _ map[string][]int32) (*sarama.OffsetFetchResponse, error) { return nil, nil } -func (m *MockClusterAdmin) DeleteConsumerGroupOffset(group string, topic string, partition int32) error { +func (m *MockClusterAdmin) DeleteConsumerGroupOffset(_ string, _ string, _ int32) error { return nil } -func (m *MockClusterAdmin) DeleteConsumerGroup(group string) error { +func (m *MockClusterAdmin) DeleteConsumerGroup(_ string) error { return nil } @@ -533,27 +533,27 @@ func (m *MockClusterAdmin) DescribeCluster() (brokers []*sarama.Broker, controll return nil, 0, nil } -func (m *MockClusterAdmin) DescribeLogDirs(brokers []int32) (map[int32][]sarama.DescribeLogDirsResponseDirMetadata, error) { +func (m *MockClusterAdmin) DescribeLogDirs(_ []int32) (map[int32][]sarama.DescribeLogDirsResponseDirMetadata, error) { return nil, nil } -func (m *MockClusterAdmin) DescribeUserScramCredentials(users []string) ([]*sarama.DescribeUserScramCredentialsResult, error) { +func (m *MockClusterAdmin) DescribeUserScramCredentials(_ []string) ([]*sarama.DescribeUserScramCredentialsResult, error) { return nil, nil } -func (m *MockClusterAdmin) DeleteUserScramCredentials(delete []sarama.AlterUserScramCredentialsDelete) ([]*sarama.AlterUserScramCredentialsResult, error) { +func (m *MockClusterAdmin) DeleteUserScramCredentials(_ []sarama.AlterUserScramCredentialsDelete) ([]*sarama.AlterUserScramCredentialsResult, error) { return nil, nil } -func (m *MockClusterAdmin) UpsertUserScramCredentials(upsert []sarama.AlterUserScramCredentialsUpsert) ([]*sarama.AlterUserScramCredentialsResult, error) { +func (m *MockClusterAdmin) UpsertUserScramCredentials(_ []sarama.AlterUserScramCredentialsUpsert) ([]*sarama.AlterUserScramCredentialsResult, error) { return nil, nil } -func (m *MockClusterAdmin) DescribeClientQuotas(components []sarama.QuotaFilterComponent, strict bool) ([]sarama.DescribeClientQuotasEntry, error) { +func (m *MockClusterAdmin) DescribeClientQuotas(_ []sarama.QuotaFilterComponent, _ bool) ([]sarama.DescribeClientQuotasEntry, error) { return nil, nil } -func (m *MockClusterAdmin) AlterClientQuotas(entity []sarama.QuotaEntityComponent, op sarama.ClientQuotasOp, validateOnly bool) error { +func (m *MockClusterAdmin) AlterClientQuotas(_ []sarama.QuotaEntityComponent, _ sarama.ClientQuotasOp, _ bool) error { return nil } @@ -561,7 +561,7 @@ func (m *MockClusterAdmin) Controller() (*sarama.Broker, error) { return nil, nil } -func (m *MockClusterAdmin) RemoveMemberFromConsumerGroup(groupID string, groupInstanceIds []string) (*sarama.LeaveGroupResponse, error) { +func (m *MockClusterAdmin) RemoveMemberFromConsumerGroup(_ string, _ []string) (*sarama.LeaveGroupResponse, error) { return nil, nil } diff --git a/pkg/scalers/rabbitmq_scaler.go b/pkg/scalers/rabbitmq_scaler.go index cb4befe3925..57a04f1584c 100644 --- a/pkg/scalers/rabbitmq_scaler.go +++ b/pkg/scalers/rabbitmq_scaler.go @@ -535,7 +535,7 @@ func (s *rabbitMQScaler) GetMetricSpecForScaling(context.Context) []v2.MetricSpe } // GetMetricsAndActivity returns value for a supported metric and an error if there is a problem getting the metric -func (s *rabbitMQScaler) GetMetricsAndActivity(ctx context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { +func (s *rabbitMQScaler) GetMetricsAndActivity(_ context.Context, metricName string) ([]external_metrics.ExternalMetricValue, bool, error) { messages, publishRate, err := s.getQueueStatus() if err != nil { return []external_metrics.ExternalMetricValue{}, false, s.anonimizeRabbitMQError(err) @@ -600,8 +600,8 @@ func getSum(q []queueInfo) (int, int, float64) { func getAverage(q []queueInfo) (int, int, float64) { sumMessages, sumReady, sumRate := getSum(q) - len := len(q) - return sumMessages / len, sumReady / len, sumRate / float64(len) + length := len(q) + return sumMessages / length, sumReady / length, sumRate / float64(length) } func getMaximum(q []queueInfo) (int, int, float64) { diff --git a/pkg/scaling/executor/scale_jobs.go b/pkg/scaling/executor/scale_jobs.go index 69629fa88a5..8cb09647c49 100644 --- a/pkg/scaling/executor/scale_jobs.go +++ b/pkg/scaling/executor/scale_jobs.go @@ -395,7 +395,7 @@ type ScalingStrategy interface { type defaultScalingStrategy struct { } -func (s defaultScalingStrategy) GetEffectiveMaxScale(maxScale, runningJobCount, pendingJobCount, maxReplicaCount int64) int64 { +func (s defaultScalingStrategy) GetEffectiveMaxScale(maxScale, runningJobCount, _, _ int64) int64 { return maxScale - runningJobCount } @@ -404,7 +404,7 @@ type customScalingStrategy struct { CustomScalingRunningJobPercentage *float64 } -func (s customScalingStrategy) GetEffectiveMaxScale(maxScale, runningJobCount, pendingJobCount, maxReplicaCount int64) int64 { +func (s customScalingStrategy) GetEffectiveMaxScale(maxScale, runningJobCount, _, maxReplicaCount int64) int64 { return min(maxScale-int64(*s.CustomScalingQueueLengthDeduction)-int64(float64(runningJobCount)*(*s.CustomScalingRunningJobPercentage)), maxReplicaCount) } diff --git a/tests/README.md b/tests/README.md index e2a9e8f6981..417e4277bbe 100644 --- a/tests/README.md +++ b/tests/README.md @@ -154,7 +154,7 @@ func TestScaler(t *testing.T) { testScaleOut(t) // Ensure that this gets run. Using defer is necessary - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupTest(t) } diff --git a/tests/helper/helper.go b/tests/helper/helper.go index 1f9ead3983b..6c685f933e9 100644 --- a/tests/helper/helper.go +++ b/tests/helper/helper.go @@ -220,8 +220,8 @@ func GetKedaKubernetesClient(t *testing.T) *v1alpha1.KedaV1alpha1Client { // Creates a new namespace. If it already exists, make sure it is deleted first. func CreateNamespace(t *testing.T, kc *kubernetes.Clientset, nsName string) { - DeleteNamespace(t, kc, nsName) - WaitForNamespaceDeletion(t, kc, nsName) + DeleteNamespace(t, nsName) + WaitForNamespaceDeletion(t, nsName) t.Logf("Creating namespace - %s", nsName) namespace := &corev1.Namespace{ @@ -235,7 +235,7 @@ func CreateNamespace(t *testing.T, kc *kubernetes.Clientset, nsName string) { assert.NoErrorf(t, err, "cannot create kubernetes namespace - %s", err) } -func DeleteNamespace(t *testing.T, kc *kubernetes.Clientset, nsName string) { +func DeleteNamespace(t *testing.T, nsName string) { t.Logf("deleting namespace %s", nsName) period := int64(0) err := KubeClient.CoreV1().Namespaces().Delete(context.Background(), nsName, metav1.DeleteOptions{ @@ -287,7 +287,7 @@ func WaitForAllJobsSuccess(t *testing.T, kc *kubernetes.Clientset, namespace str return false } -func WaitForNamespaceDeletion(t *testing.T, kc *kubernetes.Clientset, nsName string) bool { +func WaitForNamespaceDeletion(t *testing.T, nsName string) bool { for i := 0; i < 120; i++ { t.Logf("waiting for namespace %s deletion", nsName) _, err := KubeClient.CoreV1().Namespaces().Get(context.Background(), nsName, metav1.GetOptions{}) @@ -580,10 +580,10 @@ func CreateKubernetesResources(t *testing.T, kc *kubernetes.Clientset, nsName st KubectlApplyMultipleWithTemplate(t, data, templates) } -func DeleteKubernetesResources(t *testing.T, kc *kubernetes.Clientset, nsName string, data interface{}, templates []Template) { +func DeleteKubernetesResources(t *testing.T, nsName string, data interface{}, templates []Template) { KubectlDeleteMultipleWithTemplate(t, data, templates) - DeleteNamespace(t, kc, nsName) - deleted := WaitForNamespaceDeletion(t, kc, nsName) + DeleteNamespace(t, nsName) + deleted := WaitForNamespaceDeletion(t, nsName) assert.Truef(t, deleted, "%s namespace not deleted", nsName) } diff --git a/tests/internals/cache_metrics/cache_metrics_test.go b/tests/internals/cache_metrics/cache_metrics_test.go index 93d29caaf3e..3f5525c1833 100644 --- a/tests/internals/cache_metrics/cache_metrics_test.go +++ b/tests/internals/cache_metrics/cache_metrics_test.go @@ -124,7 +124,7 @@ func TestScaler(t *testing.T) { testCacheMetricsOnPollingInterval(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func getTemplateData() (templateData, []Template) { diff --git a/tests/internals/custom_hpa_name/custom_hpa_name_test.go b/tests/internals/custom_hpa_name/custom_hpa_name_test.go index 57c63ff4be8..a89bca1256b 100644 --- a/tests/internals/custom_hpa_name/custom_hpa_name_test.go +++ b/tests/internals/custom_hpa_name/custom_hpa_name_test.go @@ -150,7 +150,7 @@ func test(t *testing.T, testName string, firstHpaName string, firstSOTemplate st assert.True(t, errors.IsNotFound(err)) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func getTemplateData(testNamespace string, deploymentName string, scaledObjectName string, customHpaName string) templateData { diff --git a/tests/internals/fallback/fallback_test.go b/tests/internals/fallback/fallback_test.go index 7073a594be1..f685bceff41 100644 --- a/tests/internals/fallback/fallback_test.go +++ b/tests/internals/fallback/fallback_test.go @@ -240,7 +240,7 @@ func TestFallback(t *testing.T) { testFallback(t, kc, data) testRestoreAfterFallback(t, kc, data) - DeleteKubernetesResources(t, kc, namespace, data, templates) + DeleteKubernetesResources(t, namespace, data, templates) } // scale out to max replicas first diff --git a/tests/internals/global_custom_ca/global_custom_ca_test.go b/tests/internals/global_custom_ca/global_custom_ca_test.go index a48c6f1d7b3..f11d7661589 100644 --- a/tests/internals/global_custom_ca/global_custom_ca_test.go +++ b/tests/internals/global_custom_ca/global_custom_ca_test.go @@ -234,7 +234,7 @@ func TestCustomCa(t *testing.T) { testScaleIn(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testScaleOut(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/internals/idle_replicas/idle_replicas_test.go b/tests/internals/idle_replicas/idle_replicas_test.go index 99900035393..46a682f9180 100644 --- a/tests/internals/idle_replicas/idle_replicas_test.go +++ b/tests/internals/idle_replicas/idle_replicas_test.go @@ -121,7 +121,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func getTemplateData() (templateData, []Template) { diff --git a/tests/internals/min_replica_sj/min_replica_sj_test.go b/tests/internals/min_replica_sj/min_replica_sj_test.go index d8c7b2416d2..4e2bf94680f 100644 --- a/tests/internals/min_replica_sj/min_replica_sj_test.go +++ b/tests/internals/min_replica_sj/min_replica_sj_test.go @@ -129,7 +129,7 @@ func TestMinReplicaCount(t *testing.T) { testMinReplicaCountGreaterMaxReplicaCountScalesOnlyToMaxReplicaCount(t, kc, data) testMinReplicaCountWithMetricValueGreaterMaxReplicaCountScalesOnlyToMaxReplicaCount(t, kc, data) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testMinReplicaCountWithMetricValue(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/internals/pause_scaling/pause_scaling_test.go b/tests/internals/pause_scaling/pause_scaling_test.go index db783ae6cb6..cfa8d5ed288 100644 --- a/tests/internals/pause_scaling/pause_scaling_test.go +++ b/tests/internals/pause_scaling/pause_scaling_test.go @@ -147,7 +147,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func getTemplateData() (templateData, []Template) { diff --git a/tests/internals/polling_cooldown_so/polling_cooldown_so_test.go b/tests/internals/polling_cooldown_so/polling_cooldown_so_test.go index c802a822d87..977040eb86e 100644 --- a/tests/internals/polling_cooldown_so/polling_cooldown_so_test.go +++ b/tests/internals/polling_cooldown_so/polling_cooldown_so_test.go @@ -203,7 +203,7 @@ func TestPollingInterval(t *testing.T) { testPollingIntervalDown(t, kc, data) testCooldownPeriod(t, kc, data) - DeleteKubernetesResources(t, kc, namespace, data, templates) + DeleteKubernetesResources(t, namespace, data, templates) } func testPollingIntervalUp(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/internals/replica_update_so/replica_update_so_test.go b/tests/internals/replica_update_so/replica_update_so_test.go index 6b60d66ffec..6f9355b6272 100644 --- a/tests/internals/replica_update_so/replica_update_so_test.go +++ b/tests/internals/replica_update_so/replica_update_so_test.go @@ -213,7 +213,7 @@ func TestScaler(t *testing.T) { scaleMinReplicasDownToZero(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, namespace, data, templates) + DeleteKubernetesResources(t, namespace, data, templates) } // expect replicas to scale up because maxReplicas was updated diff --git a/tests/internals/restore_original/restore_original_test.go b/tests/internals/restore_original/restore_original_test.go index 36a6f4a502e..83de6a3b3a1 100644 --- a/tests/internals/restore_original/restore_original_test.go +++ b/tests/internals/restore_original/restore_original_test.go @@ -119,7 +119,7 @@ func TestScaler(t *testing.T) { testRestore(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func getTemplateData() (templateData, []Template) { diff --git a/tests/internals/scaled_object_validation/scaled_object_validation_test.go b/tests/internals/scaled_object_validation/scaled_object_validation_test.go index 8a8db6851df..a9cf813aafe 100644 --- a/tests/internals/scaled_object_validation/scaled_object_validation_test.go +++ b/tests/internals/scaled_object_validation/scaled_object_validation_test.go @@ -145,7 +145,7 @@ func TestScaledObjectValidations(t *testing.T) { testMissingMemory(t, data) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testWithNotScaledWorkload(t *testing.T, data templateData) { diff --git a/tests/internals/subresource_scale/subresource_scale_test.go b/tests/internals/subresource_scale/subresource_scale_test.go index 47fb7685810..79571e47e30 100644 --- a/tests/internals/subresource_scale/subresource_scale_test.go +++ b/tests/internals/subresource_scale/subresource_scale_test.go @@ -129,8 +129,8 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) - cleanupArgo(t, kc) + DeleteKubernetesResources(t, testNamespace, data, templates) + cleanupArgo(t) } func setupArgo(t *testing.T, kc *kubernetes.Clientset) { @@ -142,13 +142,13 @@ func setupArgo(t *testing.T, kc *kubernetes.Clientset) { assert.NoErrorf(t, err, "cannot install argo resources - %s", err) } -func cleanupArgo(t *testing.T, kc *kubernetes.Clientset) { +func cleanupArgo(t *testing.T) { cmdWithNamespace := fmt.Sprintf("kubectl delete -n %s -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml", argoNamespace) _, err := ExecuteCommand(cmdWithNamespace) assert.NoErrorf(t, err, "cannot delete argo resources - %s", err) - DeleteNamespace(t, kc, argoNamespace) + DeleteNamespace(t, argoNamespace) } func testScaleOut(t *testing.T, kc *kubernetes.Clientset) { diff --git a/tests/internals/trigger_update_so/trigger_update_so_test.go b/tests/internals/trigger_update_so/trigger_update_so_test.go index 96dc3a4e8d3..17e9c90dae3 100644 --- a/tests/internals/trigger_update_so/trigger_update_so_test.go +++ b/tests/internals/trigger_update_so/trigger_update_so_test.go @@ -311,7 +311,7 @@ func TestScaledObjectGeneral(t *testing.T) { testRemoveTrigger(t, kc, data) // remove trigger during active scaling testThreeTriggersWithCPU(t, kc, data) // three triggers - DeleteKubernetesResources(t, kc, namespace, data, templates) + DeleteKubernetesResources(t, namespace, data, templates) } // tests basic scaling with one trigger based on metrics diff --git a/tests/internals/value_metric_type/value_metric_type_test.go b/tests/internals/value_metric_type/value_metric_type_test.go index 8e2784f0115..06a175f9012 100644 --- a/tests/internals/value_metric_type/value_metric_type_test.go +++ b/tests/internals/value_metric_type/value_metric_type_test.go @@ -122,7 +122,7 @@ func TestScaler(t *testing.T) { testScaleByValue(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func getTemplateData() (templateData, []Template) { diff --git a/tests/run-all.go b/tests/run-all.go index d7d9e4eae61..60d35eceb78 100644 --- a/tests/run-all.go +++ b/tests/run-all.go @@ -176,7 +176,7 @@ func getTestFiles(e2eRegex string, filter func(path string, file string) bool) [ } // We randomize the executions - rand.Seed(time.Now().UnixNano()) + rand.New(rand.NewSource(time.Now().UnixNano())) rand.Shuffle(len(testFiles), func(i, j int) { testFiles[i], testFiles[j] = testFiles[j], testFiles[i] }) diff --git a/tests/scalers/activemq/activemq_test.go b/tests/scalers/activemq/activemq_test.go index eacaed55be6..f9effde7e8a 100644 --- a/tests/scalers/activemq/activemq_test.go +++ b/tests/scalers/activemq/activemq_test.go @@ -464,7 +464,7 @@ func TestActiveMQScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func setupActiveMQ(t *testing.T, kc *kubernetes.Clientset) { diff --git a/tests/scalers/arangodb/arangodb_test.go b/tests/scalers/arangodb/arangodb_test.go index 84273c87a08..000c54c2a26 100644 --- a/tests/scalers/arangodb/arangodb_test.go +++ b/tests/scalers/arangodb/arangodb_test.go @@ -206,7 +206,7 @@ func TestArangoDBScaler(t *testing.T) { CreateNamespace(t, kc, testNamespace) arangodb.InstallArangoDB(t, kc, testNamespace) - arangodb.SetupArangoDB(t, kc, testNamespace, arangoDBName, arangoDBCollection, arangoDBUsername) + arangodb.SetupArangoDB(t, kc, testNamespace, arangoDBName, arangoDBCollection) data, templates := getTemplateData() KubectlApplyMultipleWithTemplate(t, data, templates) @@ -220,10 +220,10 @@ func TestArangoDBScaler(t *testing.T) { // cleanup KubectlDeleteMultipleWithTemplate(t, data, templates) - arangodb.UninstallArangoDB(t, kc, testNamespace) + arangodb.UninstallArangoDB(t, testNamespace) - DeleteNamespace(t, kc, testNamespace) - WaitForNamespaceDeletion(t, kc, testNamespace) + DeleteNamespace(t, testNamespace) + WaitForNamespaceDeletion(t, testNamespace) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/arangodb/helper.go b/tests/scalers/arangodb/helper.go index d0021a3cdbc..7f81a07606f 100644 --- a/tests/scalers/arangodb/helper.go +++ b/tests/scalers/arangodb/helper.go @@ -99,7 +99,7 @@ func InstallArangoDB(t *testing.T, kc *kubernetes.Clientset, testNamespace strin assert.True(t, helper.WaitForAllPodRunningInNamespace(t, kc, testNamespace, 5, 20), "all pods should be running") } -func SetupArangoDB(t *testing.T, kc *kubernetes.Clientset, testNamespace, arangoDBName, arangoDBCollection, arangoDBUsername string) { +func SetupArangoDB(t *testing.T, kc *kubernetes.Clientset, testNamespace, arangoDBName, arangoDBCollection string) { helper.KubectlApplyWithTemplate(t, templateData{Namespace: testNamespace, Database: arangoDBName}, "createDatabaseTemplate", createDatabaseTemplate) assert.True(t, helper.WaitForJobSuccess(t, kc, "create-db", testNamespace, 5, 10), "create database job failed") @@ -107,7 +107,7 @@ func SetupArangoDB(t *testing.T, kc *kubernetes.Clientset, testNamespace, arango assert.True(t, helper.WaitForJobSuccess(t, kc, "create-arangodb-collection", testNamespace, 5, 10), "create collection job failed") } -func UninstallArangoDB(t *testing.T, kc *kubernetes.Clientset, namespace string) { +func UninstallArangoDB(t *testing.T, namespace string) { helper.KubectlDeleteMultipleWithTemplate(t, templateData{Namespace: namespace}, []helper.Template{{Name: "arangoDeploymentTemplate", Config: arangoDeploymentTemplate}}) _, err := helper.ExecuteCommand(fmt.Sprintf("helm uninstall arangodb --namespace=%s --wait", namespace)) diff --git a/tests/scalers/artemis/artemis_test.go b/tests/scalers/artemis/artemis_test.go index 23375f055c1..b8a27153db7 100644 --- a/tests/scalers/artemis/artemis_test.go +++ b/tests/scalers/artemis/artemis_test.go @@ -317,7 +317,7 @@ func TestArtemisScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/aws/aws_cloudwatch/aws_cloudwatch_test.go b/tests/scalers/aws/aws_cloudwatch/aws_cloudwatch_test.go index edb29dd4459..847ab05bf97 100644 --- a/tests/scalers/aws/aws_cloudwatch/aws_cloudwatch_test.go +++ b/tests/scalers/aws/aws_cloudwatch/aws_cloudwatch_test.go @@ -160,7 +160,7 @@ func TestCloudWatchScaler(t *testing.T) { testScaleIn(t, kc, cloudwatchClient) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) setCloudWatchCustomMetric(t, cloudwatchClient, 0) } diff --git a/tests/scalers/aws/aws_cloudwatch_expression/aws_cloudwatch_expression_test.go b/tests/scalers/aws/aws_cloudwatch_expression/aws_cloudwatch_expression_test.go index e7af58b22e9..69afd6ba077 100644 --- a/tests/scalers/aws/aws_cloudwatch_expression/aws_cloudwatch_expression_test.go +++ b/tests/scalers/aws/aws_cloudwatch_expression/aws_cloudwatch_expression_test.go @@ -155,7 +155,7 @@ func TestCloudWatchExpressionScaler(t *testing.T) { testScaleIn(t, kc, cloudwatchClient) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) setCloudWatchCustomMetric(t, cloudwatchClient, 0) } diff --git a/tests/scalers/aws/aws_cloudwatch_pod_identity/aws_cloudwatch_pod_identity_test.go b/tests/scalers/aws/aws_cloudwatch_pod_identity/aws_cloudwatch_pod_identity_test.go index f231a0d120a..0a2c832cb99 100644 --- a/tests/scalers/aws/aws_cloudwatch_pod_identity/aws_cloudwatch_pod_identity_test.go +++ b/tests/scalers/aws/aws_cloudwatch_pod_identity/aws_cloudwatch_pod_identity_test.go @@ -147,7 +147,7 @@ func TestCloudWatchScaler(t *testing.T) { testScaleIn(t, kc, cloudwatchClient) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) setCloudWatchCustomMetric(t, cloudwatchClient, 0) } diff --git a/tests/scalers/aws/aws_dynamodb/aws_dynamodb_test.go b/tests/scalers/aws/aws_dynamodb/aws_dynamodb_test.go index a2799f7a4da..599d106fa50 100644 --- a/tests/scalers/aws/aws_dynamodb/aws_dynamodb_test.go +++ b/tests/scalers/aws/aws_dynamodb/aws_dynamodb_test.go @@ -159,7 +159,7 @@ func TestDynamoDBScaler(t *testing.T) { testScaleIn(t, kc, dynamodbClient) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupTable(t, dynamodbClient) } diff --git a/tests/scalers/aws/aws_dynamodb_pod_identity/aws_dynamodb_pod_identity_test.go b/tests/scalers/aws/aws_dynamodb_pod_identity/aws_dynamodb_pod_identity_test.go index e1ee1421fb0..19cfdba5c89 100644 --- a/tests/scalers/aws/aws_dynamodb_pod_identity/aws_dynamodb_pod_identity_test.go +++ b/tests/scalers/aws/aws_dynamodb_pod_identity/aws_dynamodb_pod_identity_test.go @@ -146,7 +146,7 @@ func TestDynamoDBScaler(t *testing.T) { testScaleIn(t, kc, dynamodbClient) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupTable(t, dynamodbClient) } diff --git a/tests/scalers/aws/aws_dynamodb_streams/aws_dynamodb_streams_test.go b/tests/scalers/aws/aws_dynamodb_streams/aws_dynamodb_streams_test.go index 749a7f2a5e5..e389a291724 100644 --- a/tests/scalers/aws/aws_dynamodb_streams/aws_dynamodb_streams_test.go +++ b/tests/scalers/aws/aws_dynamodb_streams/aws_dynamodb_streams_test.go @@ -172,7 +172,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, data, shardCount) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupDynamoDBTable(t, dbClient) } diff --git a/tests/scalers/aws/aws_dynamodb_streams_pod_identity/aws_dynamodb_streams_pod_identity_test.go b/tests/scalers/aws/aws_dynamodb_streams_pod_identity/aws_dynamodb_streams_pod_identity_test.go index eb33a5094e6..0c0547d34d5 100644 --- a/tests/scalers/aws/aws_dynamodb_streams_pod_identity/aws_dynamodb_streams_pod_identity_test.go +++ b/tests/scalers/aws/aws_dynamodb_streams_pod_identity/aws_dynamodb_streams_pod_identity_test.go @@ -156,7 +156,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, data, shardCount) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupDynamoDBTable(t, dbClient) } diff --git a/tests/scalers/aws/aws_kinesis_stream/aws_kinesis_stream_test.go b/tests/scalers/aws/aws_kinesis_stream/aws_kinesis_stream_test.go index bb029fd018c..06a8d1e7843 100644 --- a/tests/scalers/aws/aws_kinesis_stream/aws_kinesis_stream_test.go +++ b/tests/scalers/aws/aws_kinesis_stream/aws_kinesis_stream_test.go @@ -154,7 +154,7 @@ func TestKiensisScaler(t *testing.T) { testScaleIn(t, kc, kinesisClient) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupStream(t, kinesisClient) } diff --git a/tests/scalers/aws/aws_kinesis_stream_pod_identity/aws_kinesis_stream_pod_identity_test.go b/tests/scalers/aws/aws_kinesis_stream_pod_identity/aws_kinesis_stream_pod_identity_test.go index 9be539465b3..40b48dcef07 100644 --- a/tests/scalers/aws/aws_kinesis_stream_pod_identity/aws_kinesis_stream_pod_identity_test.go +++ b/tests/scalers/aws/aws_kinesis_stream_pod_identity/aws_kinesis_stream_pod_identity_test.go @@ -141,7 +141,7 @@ func TestKiensisScaler(t *testing.T) { testScaleIn(t, kc, kinesisClient) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupStream(t, kinesisClient) } diff --git a/tests/scalers/aws/aws_sqs_queue/aws_sqs_queue_test.go b/tests/scalers/aws/aws_sqs_queue/aws_sqs_queue_test.go index 12558b77023..5adbda95fe6 100644 --- a/tests/scalers/aws/aws_sqs_queue/aws_sqs_queue_test.go +++ b/tests/scalers/aws/aws_sqs_queue/aws_sqs_queue_test.go @@ -148,7 +148,7 @@ func TestSqsScaler(t *testing.T) { testScaleIn(t, kc, sqsClient, queue.QueueUrl) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupQueue(t, sqsClient, queue.QueueUrl) } diff --git a/tests/scalers/aws/aws_sqs_queue_pod_identity/aws_sqs_queue_pod_identity_test.go b/tests/scalers/aws/aws_sqs_queue_pod_identity/aws_sqs_queue_pod_identity_test.go index f1f16da69ac..2c63e1c54d2 100644 --- a/tests/scalers/aws/aws_sqs_queue_pod_identity/aws_sqs_queue_pod_identity_test.go +++ b/tests/scalers/aws/aws_sqs_queue_pod_identity/aws_sqs_queue_pod_identity_test.go @@ -135,7 +135,7 @@ func TestSqsScaler(t *testing.T) { testScaleIn(t, kc, sqsClient, queue.QueueUrl) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupQueue(t, sqsClient, queue.QueueUrl) } diff --git a/tests/scalers/azure/azure_application_insights/azure_application_insights_test.go b/tests/scalers/azure/azure_application_insights/azure_application_insights_test.go index 9a243e7f282..7819924f41a 100644 --- a/tests/scalers/azure/azure_application_insights/azure_application_insights_test.go +++ b/tests/scalers/azure/azure_application_insights/azure_application_insights_test.go @@ -169,7 +169,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, client) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, client appinsights.TelemetryClient) { diff --git a/tests/scalers/azure/azure_application_insights_aad_pod_identity/azure_application_insights_aad_pod_identity_test.go b/tests/scalers/azure/azure_application_insights_aad_pod_identity/azure_application_insights_aad_pod_identity_test.go index b699f3828b3..91126e697b8 100644 --- a/tests/scalers/azure/azure_application_insights_aad_pod_identity/azure_application_insights_aad_pod_identity_test.go +++ b/tests/scalers/azure/azure_application_insights_aad_pod_identity/azure_application_insights_aad_pod_identity_test.go @@ -157,7 +157,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, client) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, client appinsights.TelemetryClient) { diff --git a/tests/scalers/azure/azure_application_insights_aad_wi/azure_application_insights_aad_wi_test.go b/tests/scalers/azure/azure_application_insights_aad_wi/azure_application_insights_aad_wi_test.go index bb912d51e11..d890d65c747 100644 --- a/tests/scalers/azure/azure_application_insights_aad_wi/azure_application_insights_aad_wi_test.go +++ b/tests/scalers/azure/azure_application_insights_aad_wi/azure_application_insights_aad_wi_test.go @@ -157,7 +157,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, client) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, client appinsights.TelemetryClient) { diff --git a/tests/scalers/azure/azure_blob/azure_blob_test.go b/tests/scalers/azure/azure_blob/azure_blob_test.go index f0b597e341d..299cb3a790c 100644 --- a/tests/scalers/azure/azure_blob/azure_blob_test.go +++ b/tests/scalers/azure/azure_blob/azure_blob_test.go @@ -145,7 +145,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, containerURL) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupContainer(t, containerURL) } diff --git a/tests/scalers/azure/azure_blob_aad_pod_identity/azure_blob_aad_pod_identity_test.go b/tests/scalers/azure/azure_blob_aad_pod_identity/azure_blob_aad_pod_identity_test.go index 08c03d67f6a..f4f96ecee37 100644 --- a/tests/scalers/azure/azure_blob_aad_pod_identity/azure_blob_aad_pod_identity_test.go +++ b/tests/scalers/azure/azure_blob_aad_pod_identity/azure_blob_aad_pod_identity_test.go @@ -160,7 +160,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, containerURL) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupContainer(t, containerURL) } diff --git a/tests/scalers/azure/azure_blob_aad_wi/azure_blob_aad_wi_test.go b/tests/scalers/azure/azure_blob_aad_wi/azure_blob_aad_wi_test.go index 3cd619c7e58..8175c9b5cea 100644 --- a/tests/scalers/azure/azure_blob_aad_wi/azure_blob_aad_wi_test.go +++ b/tests/scalers/azure/azure_blob_aad_wi/azure_blob_aad_wi_test.go @@ -160,7 +160,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, containerURL) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupContainer(t, containerURL) } diff --git a/tests/scalers/azure/azure_data_explorer/azure_data_explorer_test.go b/tests/scalers/azure/azure_data_explorer/azure_data_explorer_test.go index e8e0d448ff8..f0e8efe4f45 100644 --- a/tests/scalers/azure/azure_data_explorer/azure_data_explorer_test.go +++ b/tests/scalers/azure/azure_data_explorer/azure_data_explorer_test.go @@ -160,7 +160,7 @@ func TestScaler(t *testing.T) { // cleanup templates = append(templates, Template{Name: "triggerAuthTemplate", Config: triggerAuthTemplate}) templates = append(templates, Template{Name: "scaledObjectTemplate", Config: scaledObjectTemplate}) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/azure/azure_data_explorer_aad_pod_identity/azure_data_explorer_aad_pod_identity_test.go b/tests/scalers/azure/azure_data_explorer_aad_pod_identity/azure_data_explorer_aad_pod_identity_test.go index e8ee4b26386..f4a4283e5c1 100644 --- a/tests/scalers/azure/azure_data_explorer_aad_pod_identity/azure_data_explorer_aad_pod_identity_test.go +++ b/tests/scalers/azure/azure_data_explorer_aad_pod_identity/azure_data_explorer_aad_pod_identity_test.go @@ -134,7 +134,7 @@ func TestScaler(t *testing.T) { // cleanup templates = append(templates, Template{Name: "triggerAuthTemplate", Config: triggerAuthTemplate}) templates = append(templates, Template{Name: "scaledObjectTemplate", Config: scaledObjectTemplate}) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/azure/azure_data_explorer_aad_wi/azure_data_explorer_aad_wi_test.go b/tests/scalers/azure/azure_data_explorer_aad_wi/azure_data_explorer_aad_wi_test.go index 5c3a852130b..2e5edc09732 100644 --- a/tests/scalers/azure/azure_data_explorer_aad_wi/azure_data_explorer_aad_wi_test.go +++ b/tests/scalers/azure/azure_data_explorer_aad_wi/azure_data_explorer_aad_wi_test.go @@ -134,7 +134,7 @@ func TestScaler(t *testing.T) { // cleanup templates = append(templates, Template{Name: "triggerAuthTemplate", Config: triggerAuthTemplate}) templates = append(templates, Template{Name: "scaledObjectTemplate", Config: scaledObjectTemplate}) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/azure/azure_event_hub_aad_pod_identity/azure_event_hub_aad_pod_identity_test.go b/tests/scalers/azure/azure_event_hub_aad_pod_identity/azure_event_hub_aad_pod_identity_test.go index 7e9ecc87da0..6c611d9fde7 100644 --- a/tests/scalers/azure/azure_event_hub_aad_pod_identity/azure_event_hub_aad_pod_identity_test.go +++ b/tests/scalers/azure/azure_event_hub_aad_pod_identity/azure_event_hub_aad_pod_identity_test.go @@ -186,7 +186,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) deleteEventHub(t, adminClient) deleteContainer(t, container) } diff --git a/tests/scalers/azure/azure_event_hub_aad_wi/azure_event_hub_aad_wi_test.go b/tests/scalers/azure/azure_event_hub_aad_wi/azure_event_hub_aad_wi_test.go index b71c3401a67..030316b72db 100644 --- a/tests/scalers/azure/azure_event_hub_aad_wi/azure_event_hub_aad_wi_test.go +++ b/tests/scalers/azure/azure_event_hub_aad_wi/azure_event_hub_aad_wi_test.go @@ -186,7 +186,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) deleteEventHub(t, adminClient) deleteContainer(t, container) } diff --git a/tests/scalers/azure/azure_event_hub_blob_metadata/azure_event_hub_blob_metadata_test.go b/tests/scalers/azure/azure_event_hub_blob_metadata/azure_event_hub_blob_metadata_test.go index f5f7fe2ca37..9861ad47c4d 100644 --- a/tests/scalers/azure/azure_event_hub_blob_metadata/azure_event_hub_blob_metadata_test.go +++ b/tests/scalers/azure/azure_event_hub_blob_metadata/azure_event_hub_blob_metadata_test.go @@ -181,7 +181,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) deleteEventHub(t, adminClient) deleteContainer(t, container) } diff --git a/tests/scalers/azure/azure_event_hub_dapr/azure_event_hub_dapr_test.go b/tests/scalers/azure/azure_event_hub_dapr/azure_event_hub_dapr_test.go index 694b9d710d5..23e3ef78aaf 100644 --- a/tests/scalers/azure/azure_event_hub_dapr/azure_event_hub_dapr_test.go +++ b/tests/scalers/azure/azure_event_hub_dapr/azure_event_hub_dapr_test.go @@ -209,7 +209,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) deleteEventHub(t, adminClient) deleteContainer(t, container) } diff --git a/tests/scalers/azure/azure_event_hub_go_sdk/azure_event_hub_go_sdk_test.go b/tests/scalers/azure/azure_event_hub_go_sdk/azure_event_hub_go_sdk_test.go index 594dd654d86..7e35a319b4d 100644 --- a/tests/scalers/azure/azure_event_hub_go_sdk/azure_event_hub_go_sdk_test.go +++ b/tests/scalers/azure/azure_event_hub_go_sdk/azure_event_hub_go_sdk_test.go @@ -181,7 +181,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) deleteEventHub(t, adminClient) deleteContainer(t, container) } diff --git a/tests/scalers/azure/azure_log_analytics/azure_log_analytics_test.go b/tests/scalers/azure/azure_log_analytics/azure_log_analytics_test.go index 631b4f38d4e..b1f41e52831 100644 --- a/tests/scalers/azure/azure_log_analytics/azure_log_analytics_test.go +++ b/tests/scalers/azure/azure_log_analytics/azure_log_analytics_test.go @@ -149,7 +149,7 @@ func TestScaler(t *testing.T) { // cleanup templates = append(templates, Template{Name: "triggerAuthTemplate", Config: triggerAuthTemplate}) templates = append(templates, Template{Name: "scaledObjectTemplate", Config: scaledObjectTemplate}) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/azure/azure_log_analytics_aad_pod_identity/azure_log_analytics_aad_pod_identity_test.go b/tests/scalers/azure/azure_log_analytics_aad_pod_identity/azure_log_analytics_aad_pod_identity_test.go index 32980c102bc..029c76bbc1c 100644 --- a/tests/scalers/azure/azure_log_analytics_aad_pod_identity/azure_log_analytics_aad_pod_identity_test.go +++ b/tests/scalers/azure/azure_log_analytics_aad_pod_identity/azure_log_analytics_aad_pod_identity_test.go @@ -123,7 +123,7 @@ func TestScaler(t *testing.T) { // cleanup templates = append(templates, Template{Name: "triggerAuthTemplate", Config: triggerAuthTemplate}) templates = append(templates, Template{Name: "scaledObjectTemplate", Config: scaledObjectTemplate}) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/azure/azure_log_analytics_aad_wi/azure_log_analytics_aad_wi_test.go b/tests/scalers/azure/azure_log_analytics_aad_wi/azure_log_analytics_aad_wi_test.go index c8a64628583..eb881ca50e0 100644 --- a/tests/scalers/azure/azure_log_analytics_aad_wi/azure_log_analytics_aad_wi_test.go +++ b/tests/scalers/azure/azure_log_analytics_aad_wi/azure_log_analytics_aad_wi_test.go @@ -123,7 +123,7 @@ func TestScaler(t *testing.T) { // cleanup templates = append(templates, Template{Name: "triggerAuthTemplate", Config: triggerAuthTemplate}) templates = append(templates, Template{Name: "scaledObjectTemplate", Config: scaledObjectTemplate}) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/azure/azure_managed_prometheus/helper/helper.go b/tests/scalers/azure/azure_managed_prometheus/helper/helper.go index ec0672f970d..9acab391695 100644 --- a/tests/scalers/azure/azure_managed_prometheus/helper/helper.go +++ b/tests/scalers/azure/azure_managed_prometheus/helper/helper.go @@ -234,7 +234,7 @@ func TestAzureManagedPrometheusScaler(t *testing.T, data TemplateData) { // cleanup helper.KubectlDeleteMultipleWithTemplate(t, data, templates) - helper.DeleteNamespace(t, kc, data.TestNamespace) + helper.DeleteNamespace(t, data.TestNamespace) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data TemplateData) { diff --git a/tests/scalers/azure/azure_monitor/azure_monitor_test.go b/tests/scalers/azure/azure_monitor/azure_monitor_test.go index df960904b24..c7822260cbf 100644 --- a/tests/scalers/azure/azure_monitor/azure_monitor_test.go +++ b/tests/scalers/azure/azure_monitor/azure_monitor_test.go @@ -173,7 +173,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, client appinsights.TelemetryClient) { diff --git a/tests/scalers/azure/azure_monitor_aad_pod_identity/azure_monitor_aad_pod_identity_test.go b/tests/scalers/azure/azure_monitor_aad_pod_identity/azure_monitor_aad_pod_identity_test.go index 7eadbe5405b..9296028d54c 100644 --- a/tests/scalers/azure/azure_monitor_aad_pod_identity/azure_monitor_aad_pod_identity_test.go +++ b/tests/scalers/azure/azure_monitor_aad_pod_identity/azure_monitor_aad_pod_identity_test.go @@ -149,7 +149,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, client appinsights.TelemetryClient) { diff --git a/tests/scalers/azure/azure_monitor_aad_wi/azure_monitor_aad_wi_test.go b/tests/scalers/azure/azure_monitor_aad_wi/azure_monitor_aad_wi_test.go index f27fefecf14..537f4545f89 100644 --- a/tests/scalers/azure/azure_monitor_aad_wi/azure_monitor_aad_wi_test.go +++ b/tests/scalers/azure/azure_monitor_aad_wi/azure_monitor_aad_wi_test.go @@ -149,7 +149,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, client appinsights.TelemetryClient) { diff --git a/tests/scalers/azure/azure_pipelines/azure_pipelines_test.go b/tests/scalers/azure/azure_pipelines/azure_pipelines_test.go index a90ac7bdf21..b8fe47135e1 100644 --- a/tests/scalers/azure/azure_pipelines/azure_pipelines_test.go +++ b/tests/scalers/azure/azure_pipelines/azure_pipelines_test.go @@ -190,7 +190,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func getAzDoPoolID(t *testing.T, connection *azuredevops.Connection) int { diff --git a/tests/scalers/azure/azure_pipelines_adv/azure_pipelines_adv_test.go b/tests/scalers/azure/azure_pipelines_adv/azure_pipelines_adv_test.go index 2a0efd8a398..47010a700e4 100644 --- a/tests/scalers/azure/azure_pipelines_adv/azure_pipelines_adv_test.go +++ b/tests/scalers/azure/azure_pipelines_adv/azure_pipelines_adv_test.go @@ -322,7 +322,7 @@ func TestScaler(t *testing.T) { testJobScaleIn(t, kc) KubectlDeleteWithTemplate(t, data, "demandRequireAllScaledJobTemplate", demandRequireAllScaledJobTemplate) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) CleanUpAdo(t, data) } diff --git a/tests/scalers/azure/azure_queue/azure_queue_test.go b/tests/scalers/azure/azure_queue/azure_queue_test.go index 12bf4cc1110..25029a3c3e6 100644 --- a/tests/scalers/azure/azure_queue/azure_queue_test.go +++ b/tests/scalers/azure/azure_queue/azure_queue_test.go @@ -135,7 +135,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, messageURL) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupQueue(t, queueURL) } diff --git a/tests/scalers/azure/azure_queue_aad_pod_identity/azure_queue_aad_pod_identity_test.go b/tests/scalers/azure/azure_queue_aad_pod_identity/azure_queue_aad_pod_identity_test.go index 4cc4d5ecc4e..7c769fc03b3 100644 --- a/tests/scalers/azure/azure_queue_aad_pod_identity/azure_queue_aad_pod_identity_test.go +++ b/tests/scalers/azure/azure_queue_aad_pod_identity/azure_queue_aad_pod_identity_test.go @@ -151,7 +151,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, messageURL) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupQueue(t, queueURL) } diff --git a/tests/scalers/azure/azure_queue_aad_wi/azure_queue_aad_wi_test.go b/tests/scalers/azure/azure_queue_aad_wi/azure_queue_aad_wi_test.go index 8e8fd1e358f..ca4dc3b7ce3 100644 --- a/tests/scalers/azure/azure_queue_aad_wi/azure_queue_aad_wi_test.go +++ b/tests/scalers/azure/azure_queue_aad_wi/azure_queue_aad_wi_test.go @@ -151,7 +151,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, messageURL) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupQueue(t, queueURL) } diff --git a/tests/scalers/azure/azure_service_bus_queue/azure_service_bus_queue_test.go b/tests/scalers/azure/azure_service_bus_queue/azure_service_bus_queue_test.go index 30ea90bd072..167ba0d76a3 100644 --- a/tests/scalers/azure/azure_service_bus_queue/azure_service_bus_queue_test.go +++ b/tests/scalers/azure/azure_service_bus_queue/azure_service_bus_queue_test.go @@ -139,7 +139,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, adminClient) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupServiceBusQueue(t, adminClient) } diff --git a/tests/scalers/azure/azure_service_bus_queue_aad_pod_identity/azure_service_bus_queue_aad_pod_identity_test.go b/tests/scalers/azure/azure_service_bus_queue_aad_pod_identity/azure_service_bus_queue_aad_pod_identity_test.go index 8f77c04ab24..1d20fb48882 100644 --- a/tests/scalers/azure/azure_service_bus_queue_aad_pod_identity/azure_service_bus_queue_aad_pod_identity_test.go +++ b/tests/scalers/azure/azure_service_bus_queue_aad_pod_identity/azure_service_bus_queue_aad_pod_identity_test.go @@ -127,7 +127,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, adminClient) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupServiceBusQueue(t, adminClient) } diff --git a/tests/scalers/azure/azure_service_bus_queue_aad_wi/azure_service_bus_queue_aad_wi_test.go b/tests/scalers/azure/azure_service_bus_queue_aad_wi/azure_service_bus_queue_aad_wi_test.go index 5792bc2cc0c..cc6b6a9c708 100644 --- a/tests/scalers/azure/azure_service_bus_queue_aad_wi/azure_service_bus_queue_aad_wi_test.go +++ b/tests/scalers/azure/azure_service_bus_queue_aad_wi/azure_service_bus_queue_aad_wi_test.go @@ -123,7 +123,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, adminClient) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupServiceBusQueue(t, adminClient) } diff --git a/tests/scalers/azure/azure_service_bus_queue_regex/azure_service_bus_queue_regex_test.go b/tests/scalers/azure/azure_service_bus_queue_regex/azure_service_bus_queue_regex_test.go index aff3e0e721d..a8419ecd44b 100644 --- a/tests/scalers/azure/azure_service_bus_queue_regex/azure_service_bus_queue_regex_test.go +++ b/tests/scalers/azure/azure_service_bus_queue_regex/azure_service_bus_queue_regex_test.go @@ -149,7 +149,7 @@ func TestScaler(t *testing.T) { testScale(t, kc, client, queueName1, queueName2, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupServiceBusQueue(t, adminClient, queueName1) cleanupServiceBusQueue(t, adminClient, queueName2) } diff --git a/tests/scalers/azure/azure_service_bus_topic/azure_service_bus_topic_test.go b/tests/scalers/azure/azure_service_bus_topic/azure_service_bus_topic_test.go index 8d11d819b96..b7c7524d7f4 100644 --- a/tests/scalers/azure/azure_service_bus_topic/azure_service_bus_topic_test.go +++ b/tests/scalers/azure/azure_service_bus_topic/azure_service_bus_topic_test.go @@ -142,7 +142,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, adminClient) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupServiceBusTopic(t, adminClient) } diff --git a/tests/scalers/azure/azure_service_bus_topic_aad_pod_identity/azure_service_bus_topic_aad_pod_identity_test.go b/tests/scalers/azure/azure_service_bus_topic_aad_pod_identity/azure_service_bus_topic_aad_pod_identity_test.go index 3dc9ba448d0..215b75b788f 100644 --- a/tests/scalers/azure/azure_service_bus_topic_aad_pod_identity/azure_service_bus_topic_aad_pod_identity_test.go +++ b/tests/scalers/azure/azure_service_bus_topic_aad_pod_identity/azure_service_bus_topic_aad_pod_identity_test.go @@ -130,7 +130,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, adminClient) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupServiceBusTopic(t, adminClient) } diff --git a/tests/scalers/azure/azure_service_bus_topic_aad_wi/azure_service_bus_topic_aad_wi_test.go b/tests/scalers/azure/azure_service_bus_topic_aad_wi/azure_service_bus_topic_aad_wi_test.go index 012aa1ad50d..5cf8781eea8 100644 --- a/tests/scalers/azure/azure_service_bus_topic_aad_wi/azure_service_bus_topic_aad_wi_test.go +++ b/tests/scalers/azure/azure_service_bus_topic_aad_wi/azure_service_bus_topic_aad_wi_test.go @@ -143,7 +143,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, adminClient) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupServiceBusTopic(t, adminClient) } diff --git a/tests/scalers/azure/azure_service_bus_topic_regex/azure_service_bus_topic_regex_test.go b/tests/scalers/azure/azure_service_bus_topic_regex/azure_service_bus_topic_regex_test.go index 96dce97cf93..07bfdc57572 100644 --- a/tests/scalers/azure/azure_service_bus_topic_regex/azure_service_bus_topic_regex_test.go +++ b/tests/scalers/azure/azure_service_bus_topic_regex/azure_service_bus_topic_regex_test.go @@ -148,7 +148,7 @@ func TestScaler(t *testing.T) { testScale(t, kc, client, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupServiceBusTopic(t, adminClient, topicName) } diff --git a/tests/scalers/cassandra/cassandra_test.go b/tests/scalers/cassandra/cassandra_test.go index 0451c2c0685..05740b15f7d 100644 --- a/tests/scalers/cassandra/cassandra_test.go +++ b/tests/scalers/cassandra/cassandra_test.go @@ -191,7 +191,7 @@ func TestCassandraScaler(t *testing.T) { // cleanup uninstallCassandra(t) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func installCassandra(t *testing.T) { diff --git a/tests/scalers/couchdb/couchdb_test.go b/tests/scalers/couchdb/couchdb_test.go index 8b439b14647..b957e72dfe0 100644 --- a/tests/scalers/couchdb/couchdb_test.go +++ b/tests/scalers/couchdb/couchdb_test.go @@ -175,7 +175,7 @@ func TestCouchDBScaler(t *testing.T) { testScaleDown(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func installCouchDB(t *testing.T) { diff --git a/tests/scalers/cpu/cpu_test.go b/tests/scalers/cpu/cpu_test.go index 7394cdbac69..6095185d42c 100644 --- a/tests/scalers/cpu/cpu_test.go +++ b/tests/scalers/cpu/cpu_test.go @@ -190,7 +190,7 @@ func TestCpuScaler(t *testing.T) { scaleToZero(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func scaleOut(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/cron/cron_test.go b/tests/scalers/cron/cron_test.go index d767d4453e5..fa990048bcd 100644 --- a/tests/scalers/cron/cron_test.go +++ b/tests/scalers/cron/cron_test.go @@ -107,7 +107,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/datadog/datadog_test.go b/tests/scalers/datadog/datadog_test.go index d9a1187640a..0d015507749 100644 --- a/tests/scalers/datadog/datadog_test.go +++ b/tests/scalers/datadog/datadog_test.go @@ -267,7 +267,7 @@ func TestDatadogScaler(t *testing.T) { testScaleIn(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/elasticsearch/elasticsearch_test.go b/tests/scalers/elasticsearch/elasticsearch_test.go index 2eb6e52b24a..c019c429f16 100644 --- a/tests/scalers/elasticsearch/elasticsearch_test.go +++ b/tests/scalers/elasticsearch/elasticsearch_test.go @@ -312,7 +312,7 @@ func TestElasticsearchScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func setupElasticsearch(t *testing.T, kc *kubernetes.Clientset) { diff --git a/tests/scalers/etcd/etcd_cluster/etcd_cluster_test.go b/tests/scalers/etcd/etcd_cluster/etcd_cluster_test.go index a9edb6cdedd..a2c0a065db1 100644 --- a/tests/scalers/etcd/etcd_cluster/etcd_cluster_test.go +++ b/tests/scalers/etcd/etcd_cluster/etcd_cluster_test.go @@ -130,7 +130,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/external_scaler_sj/external_scaler_sj_test.go b/tests/scalers/external_scaler_sj/external_scaler_sj_test.go index ae4431adcb7..595eb88a837 100644 --- a/tests/scalers/external_scaler_sj/external_scaler_sj_test.go +++ b/tests/scalers/external_scaler_sj/external_scaler_sj_test.go @@ -127,7 +127,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/external_scaler_so/external_scaler_so_test.go b/tests/scalers/external_scaler_so/external_scaler_so_test.go index ae93cce98f2..aec3c73b76f 100644 --- a/tests/scalers/external_scaler_so/external_scaler_so_test.go +++ b/tests/scalers/external_scaler_so/external_scaler_so_test.go @@ -146,7 +146,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/gcp/gcp_pubsub/gcp_pubsub_test.go b/tests/scalers/gcp/gcp_pubsub/gcp_pubsub_test.go index cc69e222200..bfb943453dd 100644 --- a/tests/scalers/gcp/gcp_pubsub/gcp_pubsub_test.go +++ b/tests/scalers/gcp/gcp_pubsub/gcp_pubsub_test.go @@ -196,7 +196,7 @@ func TestScaler(t *testing.T) { } } - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func createPubsub(t *testing.T) error { diff --git a/tests/scalers/gcp/gcp_pubsub_workload_identity/gcp_pubsub_workload_identity_test.go b/tests/scalers/gcp/gcp_pubsub_workload_identity/gcp_pubsub_workload_identity_test.go index 28ce57f55c5..afec8bdae2e 100644 --- a/tests/scalers/gcp/gcp_pubsub_workload_identity/gcp_pubsub_workload_identity_test.go +++ b/tests/scalers/gcp/gcp_pubsub_workload_identity/gcp_pubsub_workload_identity_test.go @@ -206,7 +206,7 @@ func TestScaler(t *testing.T) { } } - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func createPubsub(t *testing.T) error { diff --git a/tests/scalers/gcp/gcp_stackdriver/gcp_stackdriver_test.go b/tests/scalers/gcp/gcp_stackdriver/gcp_stackdriver_test.go index 7bd749714c8..304ec69c747 100644 --- a/tests/scalers/gcp/gcp_stackdriver/gcp_stackdriver_test.go +++ b/tests/scalers/gcp/gcp_stackdriver/gcp_stackdriver_test.go @@ -202,7 +202,7 @@ func TestScaler(t *testing.T) { } } - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func createPubsub(t *testing.T) error { diff --git a/tests/scalers/gcp/gcp_stackdriver_workload_identity/gcp_stackdriver_workload_identity_test.go b/tests/scalers/gcp/gcp_stackdriver_workload_identity/gcp_stackdriver_workload_identity_test.go index 32c931fc036..bf5687bc0e5 100644 --- a/tests/scalers/gcp/gcp_stackdriver_workload_identity/gcp_stackdriver_workload_identity_test.go +++ b/tests/scalers/gcp/gcp_stackdriver_workload_identity/gcp_stackdriver_workload_identity_test.go @@ -211,7 +211,7 @@ func TestScaler(t *testing.T) { } } - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func createPubsub(t *testing.T) error { diff --git a/tests/scalers/gcp/gcp_storage/gcp_storage_test.go b/tests/scalers/gcp/gcp_storage/gcp_storage_test.go index 53f52b3d37f..0c3ee91f8b6 100644 --- a/tests/scalers/gcp/gcp_storage/gcp_storage_test.go +++ b/tests/scalers/gcp/gcp_storage/gcp_storage_test.go @@ -173,7 +173,7 @@ func TestScaler(t *testing.T) { // cleanup t.Log("--- cleanup ---") cleanupBucket(t) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func createBucket(t *testing.T) error { diff --git a/tests/scalers/gcp/gcp_storage_workload_identity/gcp_storage_workload_identity_test.go b/tests/scalers/gcp/gcp_storage_workload_identity/gcp_storage_workload_identity_test.go index e57d9cd52bd..c1b56e4e17b 100644 --- a/tests/scalers/gcp/gcp_storage_workload_identity/gcp_storage_workload_identity_test.go +++ b/tests/scalers/gcp/gcp_storage_workload_identity/gcp_storage_workload_identity_test.go @@ -183,7 +183,7 @@ func TestScaler(t *testing.T) { // cleanup t.Log("--- cleanup ---") cleanupBucket(t) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func createBucket(t *testing.T) error { diff --git a/tests/scalers/github_runner/github_runner_test.go b/tests/scalers/github_runner/github_runner_test.go index e16fc8d62cd..5bd19c8333c 100644 --- a/tests/scalers/github_runner/github_runner_test.go +++ b/tests/scalers/github_runner/github_runner_test.go @@ -238,7 +238,7 @@ func TestScaler(t *testing.T) { testSOScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func queueRun(t *testing.T, ghClient *github.Client, flowID string) { diff --git a/tests/scalers/graphite/graphite_test.go b/tests/scalers/graphite/graphite_test.go index b93d2d4d7d3..494fa49a074 100644 --- a/tests/scalers/graphite/graphite_test.go +++ b/tests/scalers/graphite/graphite_test.go @@ -532,7 +532,7 @@ func TestGraphiteScaler(t *testing.T) { testScaleIn(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/influxdb/influxdb_test.go b/tests/scalers/influxdb/influxdb_test.go index 7091ef96cd8..03f45e8b321 100644 --- a/tests/scalers/influxdb/influxdb_test.go +++ b/tests/scalers/influxdb/influxdb_test.go @@ -202,7 +202,7 @@ func TestInfluxScaler(t *testing.T) { testScaleFloat(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func runWriteJob(t *testing.T, kc *kubernetes.Clientset) templateData { diff --git a/tests/scalers/kafka/kafka_test.go b/tests/scalers/kafka/kafka_test.go index 26acfa52285..7dc6901dd77 100644 --- a/tests/scalers/kafka/kafka_test.go +++ b/tests/scalers/kafka/kafka_test.go @@ -314,7 +314,7 @@ func TestScaler(t *testing.T) { // cleanup uninstallKafkaOperator(t) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testEarliestPolicy(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/kubernetes_workload/kubernetes_workload_test.go b/tests/scalers/kubernetes_workload/kubernetes_workload_test.go index 07255ad126e..8c17a711669 100644 --- a/tests/scalers/kubernetes_workload/kubernetes_workload_test.go +++ b/tests/scalers/kubernetes_workload/kubernetes_workload_test.go @@ -119,7 +119,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset) { diff --git a/tests/scalers/loki/loki_test.go b/tests/scalers/loki/loki_test.go index 376eadd9111..6bf98006a19 100644 --- a/tests/scalers/loki/loki_test.go +++ b/tests/scalers/loki/loki_test.go @@ -161,7 +161,7 @@ func TestLokiScaler(t *testing.T) { // cleanup KubectlDeleteMultipleWithTemplate(t, data, templates) - uninstallLoki(t, kc, testNamespace) + uninstallLoki(t, testNamespace) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { @@ -210,9 +210,9 @@ func installLoki(t *testing.T, kc *kubernetes.Clientset, namespace string) { assert.NoErrorf(t, err, "cannot execute command - %s", err) } -func uninstallLoki(t *testing.T, kc *kubernetes.Clientset, namespace string) { +func uninstallLoki(t *testing.T, namespace string) { _, err := ExecuteCommand(fmt.Sprintf("helm uninstall loki --wait --namespace=%s", namespace)) assert.NoErrorf(t, err, "cannot execute command - %s", err) - DeleteNamespace(t, kc, namespace) - WaitForNamespaceDeletion(t, kc, namespace) + DeleteNamespace(t, namespace) + WaitForNamespaceDeletion(t, namespace) } diff --git a/tests/scalers/memory/memory_test.go b/tests/scalers/memory/memory_test.go index 87c5ddb8c05..c977064b8d7 100644 --- a/tests/scalers/memory/memory_test.go +++ b/tests/scalers/memory/memory_test.go @@ -170,7 +170,7 @@ func TestMemoryScaler(t *testing.T) { scaleToZero(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func scaleOut(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/metrics_api/metrics_api_test.go b/tests/scalers/metrics_api/metrics_api_test.go index 0a6d2bc71e0..2455bfd420f 100644 --- a/tests/scalers/metrics_api/metrics_api_test.go +++ b/tests/scalers/metrics_api/metrics_api_test.go @@ -202,7 +202,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/mongodb/mongodb_test.go b/tests/scalers/mongodb/mongodb_test.go index 3be3287255b..58c4c11cc81 100644 --- a/tests/scalers/mongodb/mongodb_test.go +++ b/tests/scalers/mongodb/mongodb_test.go @@ -126,8 +126,8 @@ func TestScaler(t *testing.T) { testScaleOut(t, kc, mongoPod) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) - cleanupMongo(t, kc) + DeleteKubernetesResources(t, testNamespace, data, templates) + cleanupMongo(t) } func getTemplateData() (templateData, []Template) { @@ -214,8 +214,8 @@ func testScaleOut(t *testing.T, kc *kubernetes.Clientset, mongoPod string) { "job count should be 5 after 1 minute") } -func cleanupMongo(t *testing.T, kc *kubernetes.Clientset) { +func cleanupMongo(t *testing.T) { _, err := ExecuteCommand(fmt.Sprintf("helm uninstall mongodb --namespace %s", mongoNamespace)) assert.NoErrorf(t, err, "cannot execute command - %s", err) - DeleteNamespace(t, kc, mongoNamespace) + DeleteNamespace(t, mongoNamespace) } diff --git a/tests/scalers/mssql/mssql_test.go b/tests/scalers/mssql/mssql_test.go index cc4ca67e782..f6a3e8e86f8 100644 --- a/tests/scalers/mssql/mssql_test.go +++ b/tests/scalers/mssql/mssql_test.go @@ -276,7 +276,7 @@ func TestMssqlScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } // insert 10 records in the table -> activation should not happen (activationTargetValue = 15) diff --git a/tests/scalers/mysql/mysql_test.go b/tests/scalers/mysql/mysql_test.go index d264bca224d..7ec7dd363d3 100644 --- a/tests/scalers/mysql/mysql_test.go +++ b/tests/scalers/mysql/mysql_test.go @@ -241,7 +241,7 @@ func TestMySQLScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func setupMySQL(t *testing.T, kc *kubernetes.Clientset, data templateData, templates []Template) { diff --git a/tests/scalers/nats_jetstream/nats_jetstream_cluster/nats_jetstream_cluster_test.go b/tests/scalers/nats_jetstream/nats_jetstream_cluster/nats_jetstream_cluster_test.go index ee37378ca4e..23e05124d6d 100644 --- a/tests/scalers/nats_jetstream/nats_jetstream_cluster/nats_jetstream_cluster_test.go +++ b/tests/scalers/nats_jetstream/nats_jetstream_cluster/nats_jetstream_cluster_test.go @@ -93,12 +93,12 @@ func TestNATSJetStreamScalerClusterWithStreamReplicas(t *testing.T) { // Cleanup test namespace removeStreamAndConsumer(t, 1, testData.NatsStream, testNamespace, natsAddress) - DeleteKubernetesResources(t, kc, testNamespace, testData, testTemplates) + DeleteKubernetesResources(t, testNamespace, testData, testTemplates) // Cleanup nats namespace removeClusterWithJetStream(t) - DeleteNamespace(t, kc, natsNamespace) - deleted := WaitForNamespaceDeletion(t, kc, natsNamespace) + DeleteNamespace(t, natsNamespace) + deleted := WaitForNamespaceDeletion(t, natsNamespace) assert.Truef(t, deleted, "%s namespace not deleted", natsNamespace) } diff --git a/tests/scalers/nats_jetstream/nats_jetstream_standalone/nats_jetstream_standalone_test.go b/tests/scalers/nats_jetstream/nats_jetstream_standalone/nats_jetstream_standalone_test.go index e60762c0cb3..dd8ab0cdf07 100644 --- a/tests/scalers/nats_jetstream/nats_jetstream_standalone/nats_jetstream_standalone_test.go +++ b/tests/scalers/nats_jetstream/nats_jetstream_standalone/nats_jetstream_standalone_test.go @@ -205,12 +205,12 @@ func TestNATSJetStreamScaler(t *testing.T) { testScaleIn(t, kc) // Cleanup nats namespace - removeServerWithJetStream(t, kc, natsNamespace) - DeleteNamespace(t, kc, natsNamespace) - deleted := WaitForNamespaceDeletion(t, kc, natsNamespace) + removeServerWithJetStream(t, natsNamespace) + DeleteNamespace(t, natsNamespace) + deleted := WaitForNamespaceDeletion(t, natsNamespace) assert.Truef(t, deleted, "%s namespace not deleted", natsNamespace) // Cleanup test namespace - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } // installStreamAndConsumer creates stream and consumer. @@ -238,14 +238,14 @@ func installServerWithJetStream(t *testing.T, kc *k8s.Clientset, namespace strin } // removeServerWithJetStream will remove the NATS server and delete the namespace. -func removeServerWithJetStream(t *testing.T, kc *k8s.Clientset, namespace string) { +func removeServerWithJetStream(t *testing.T, namespace string) { data := nats.JetStreamTemplateData{ NatsNamespace: namespace, NatsVersion: nats.NatsJetStreamServerVersion, } KubectlDeleteWithTemplate(t, data, "natsServerTemplate", natsServerTemplate) - DeleteNamespace(t, kc, namespace) + DeleteNamespace(t, namespace) } func testActivation(t *testing.T, kc *k8s.Clientset, data nats.JetStreamDeploymentTemplateData) { diff --git a/tests/scalers/newrelic/newrelic_test.go b/tests/scalers/newrelic/newrelic_test.go index ebfef7fe71e..2a16e2a4c61 100644 --- a/tests/scalers/newrelic/newrelic_test.go +++ b/tests/scalers/newrelic/newrelic_test.go @@ -230,7 +230,7 @@ func TestNewRelicScaler(t *testing.T) { testScaleIn(t, kc, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/openstack_swift/openstack_swift_test.go b/tests/scalers/openstack_swift/openstack_swift_test.go index a4f06c43efb..b38fbc27ff1 100644 --- a/tests/scalers/openstack_swift/openstack_swift_test.go +++ b/tests/scalers/openstack_swift/openstack_swift_test.go @@ -171,7 +171,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, client) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) // delete openstack resources helper.DeleteContainer(t, client, containerName) diff --git a/tests/scalers/postgresql/postgresql_test.go b/tests/scalers/postgresql/postgresql_test.go index f5a1a566920..57e9d63576f 100644 --- a/tests/scalers/postgresql/postgresql_test.go +++ b/tests/scalers/postgresql/postgresql_test.go @@ -275,7 +275,7 @@ func TestPostreSQLScaler(t *testing.T) { // cleanup KubectlDeleteMultipleWithTemplate(t, data, templates) - DeleteKubernetesResources(t, kc, testNamespace, data, postgreSQLtemplates) + DeleteKubernetesResources(t, testNamespace, data, postgreSQLtemplates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/predictkube/predictkube_test.go b/tests/scalers/predictkube/predictkube_test.go index 3308ab873b8..319a640d57c 100644 --- a/tests/scalers/predictkube/predictkube_test.go +++ b/tests/scalers/predictkube/predictkube_test.go @@ -228,7 +228,7 @@ func TestScaler(t *testing.T) { // cleanup KubectlDeleteMultipleWithTemplate(t, data, templates) - prometheus.Uninstall(t, kc, prometheusServerName, testNamespace) + prometheus.Uninstall(t, prometheusServerName, testNamespace) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/prometheus/prometheus_helper.go b/tests/scalers/prometheus/prometheus_helper.go index 81fb705f8ba..bba356d60c8 100644 --- a/tests/scalers/prometheus/prometheus_helper.go +++ b/tests/scalers/prometheus/prometheus_helper.go @@ -498,11 +498,11 @@ func Install(t *testing.T, kc *kubernetes.Clientset, name, namespace string) { "replica count should be 1 after 3 minutes") } -func Uninstall(t *testing.T, kc *kubernetes.Clientset, name, namespace string) { +func Uninstall(t *testing.T, name, namespace string) { var data = templateData{ Namespace: namespace, PrometheusServerName: name, } helper.KubectlDeleteMultipleWithTemplate(t, data, prometheusTemplates) - helper.DeleteNamespace(t, kc, namespace) + helper.DeleteNamespace(t, namespace) } diff --git a/tests/scalers/prometheus/prometheus_test.go b/tests/scalers/prometheus/prometheus_test.go index a8b71e5706d..432b41d66f0 100644 --- a/tests/scalers/prometheus/prometheus_test.go +++ b/tests/scalers/prometheus/prometheus_test.go @@ -227,7 +227,7 @@ func TestPrometheusScaler(t *testing.T) { // cleanup KubectlDeleteMultipleWithTemplate(t, data, templates) - prometheus.Uninstall(t, kc, prometheusServerName, testNamespace) + prometheus.Uninstall(t, prometheusServerName, testNamespace) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/pulsar/helper/helper.go b/tests/scalers/pulsar/helper/helper.go index f1e8751eae1..25c902dd9b2 100644 --- a/tests/scalers/pulsar/helper/helper.go +++ b/tests/scalers/pulsar/helper/helper.go @@ -319,7 +319,7 @@ func TestScalerWithConfig(t *testing.T, testName string, numPartitions int) { helper.KubectlDeleteWithTemplate(t, data, "publishJobTemplate", topicPublishJobTemplate) helper.KubectlDeleteWithTemplate(t, data, "topicInitJobTemplate", topicInitJobTemplate) - helper.DeleteKubernetesResources(t, kc, testName, data, templates) + helper.DeleteKubernetesResources(t, testName, data, templates) } func getTemplateData(testName string, numPartitions int) (templateData, []helper.Template) { diff --git a/tests/scalers/rabbitmq/rabbitmq_helper.go b/tests/scalers/rabbitmq/rabbitmq_helper.go index 1f94e636b94..a3ad2e2d6e2 100644 --- a/tests/scalers/rabbitmq/rabbitmq_helper.go +++ b/tests/scalers/rabbitmq/rabbitmq_helper.go @@ -179,7 +179,7 @@ func RMQInstall(t *testing.T, kc *kubernetes.Clientset, namespace, user, passwor helper.KubectlApplyWithTemplate(t, data, "rmqDeploymentTemplate", deploymentTemplate) } -func RMQUninstall(t *testing.T, kc *kubernetes.Clientset, namespace, user, password, vhost string) { +func RMQUninstall(t *testing.T, namespace, user, password, vhost string) { data := templateData{ Namespace: namespace, VHostName: vhost, @@ -188,7 +188,7 @@ func RMQUninstall(t *testing.T, kc *kubernetes.Clientset, namespace, user, passw } helper.KubectlDeleteWithTemplate(t, data, "rmqDeploymentTemplate", deploymentTemplate) - helper.DeleteNamespace(t, kc, namespace) + helper.DeleteNamespace(t, namespace) } func RMQPublishMessages(t *testing.T, namespace, connectionString, queueName string, messageCount int) { diff --git a/tests/scalers/rabbitmq/rabbitmq_queue_amqp/rabbitmq_queue_amqp_test.go b/tests/scalers/rabbitmq/rabbitmq_queue_amqp/rabbitmq_queue_amqp_test.go index 5696dad5b5a..fd3fc89ffc6 100644 --- a/tests/scalers/rabbitmq/rabbitmq_queue_amqp/rabbitmq_queue_amqp_test.go +++ b/tests/scalers/rabbitmq/rabbitmq_queue_amqp/rabbitmq_queue_amqp_test.go @@ -91,8 +91,8 @@ func TestScaler(t *testing.T) { // cleanup t.Log("--- cleaning up ---") - DeleteKubernetesResources(t, kc, testNamespace, data, templates) - RMQUninstall(t, kc, rmqNamespace, user, password, vhost) + DeleteKubernetesResources(t, testNamespace, data, templates) + RMQUninstall(t, rmqNamespace, user, password, vhost) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/rabbitmq/rabbitmq_queue_amqp_vhost/rabbitmq_queue_amqp_vhost_test.go b/tests/scalers/rabbitmq/rabbitmq_queue_amqp_vhost/rabbitmq_queue_amqp_vhost_test.go index 9722c24633b..299c9a6a74a 100644 --- a/tests/scalers/rabbitmq/rabbitmq_queue_amqp_vhost/rabbitmq_queue_amqp_vhost_test.go +++ b/tests/scalers/rabbitmq/rabbitmq_queue_amqp_vhost/rabbitmq_queue_amqp_vhost_test.go @@ -91,8 +91,8 @@ func TestScaler(t *testing.T) { // cleanup t.Log("--- cleaning up ---") - DeleteKubernetesResources(t, kc, testNamespace, data, templates) - RMQUninstall(t, kc, rmqNamespace, user, password, vhost) + DeleteKubernetesResources(t, testNamespace, data, templates) + RMQUninstall(t, rmqNamespace, user, password, vhost) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/rabbitmq/rabbitmq_queue_http/rabbitmq_queue_http_test.go b/tests/scalers/rabbitmq/rabbitmq_queue_http/rabbitmq_queue_http_test.go index 79140b5128d..26749ddd9af 100644 --- a/tests/scalers/rabbitmq/rabbitmq_queue_http/rabbitmq_queue_http_test.go +++ b/tests/scalers/rabbitmq/rabbitmq_queue_http/rabbitmq_queue_http_test.go @@ -90,8 +90,8 @@ func TestScaler(t *testing.T) { // cleanup t.Log("--- cleaning up ---") - DeleteKubernetesResources(t, kc, testNamespace, data, templates) - RMQUninstall(t, kc, rmqNamespace, user, password, vhost) + DeleteKubernetesResources(t, testNamespace, data, templates) + RMQUninstall(t, rmqNamespace, user, password, vhost) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/rabbitmq/rabbitmq_queue_http_regex/rabbitmq_queue_http_regex_test.go b/tests/scalers/rabbitmq/rabbitmq_queue_http_regex/rabbitmq_queue_http_regex_test.go index 4f898feeac2..16551e57655 100644 --- a/tests/scalers/rabbitmq/rabbitmq_queue_http_regex/rabbitmq_queue_http_regex_test.go +++ b/tests/scalers/rabbitmq/rabbitmq_queue_http_regex/rabbitmq_queue_http_regex_test.go @@ -93,8 +93,8 @@ func TestScaler(t *testing.T) { // cleanup t.Log("--- cleaning up ---") - DeleteKubernetesResources(t, kc, testNamespace, data, templates) - RMQUninstall(t, kc, rmqNamespace, user, password, vhost) + DeleteKubernetesResources(t, testNamespace, data, templates) + RMQUninstall(t, rmqNamespace, user, password, vhost) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/rabbitmq/rabbitmq_queue_http_regex_vhost/rabbitmq_queue_http_regex_vhost_test.go b/tests/scalers/rabbitmq/rabbitmq_queue_http_regex_vhost/rabbitmq_queue_http_regex_vhost_test.go index adaa12ed618..5e8a7f932bd 100644 --- a/tests/scalers/rabbitmq/rabbitmq_queue_http_regex_vhost/rabbitmq_queue_http_regex_vhost_test.go +++ b/tests/scalers/rabbitmq/rabbitmq_queue_http_regex_vhost/rabbitmq_queue_http_regex_vhost_test.go @@ -101,8 +101,8 @@ func TestScaler(t *testing.T) { // cleanup t.Log("--- cleaning up ---") - DeleteKubernetesResources(t, kc, testNamespace, data, templates) - RMQUninstall(t, kc, rmqNamespace, user, password, vhost) + DeleteKubernetesResources(t, testNamespace, data, templates) + RMQUninstall(t, rmqNamespace, user, password, vhost) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/rabbitmq/rabbitmq_queue_http_vhost/rabbitmq_queue_http_vhost_test.go b/tests/scalers/rabbitmq/rabbitmq_queue_http_vhost/rabbitmq_queue_http_vhost_test.go index e8c67845273..f7ed7c6a8e6 100644 --- a/tests/scalers/rabbitmq/rabbitmq_queue_http_vhost/rabbitmq_queue_http_vhost_test.go +++ b/tests/scalers/rabbitmq/rabbitmq_queue_http_vhost/rabbitmq_queue_http_vhost_test.go @@ -90,8 +90,8 @@ func TestScaler(t *testing.T) { // cleanup t.Log("--- cleaning up ---") - DeleteKubernetesResources(t, kc, testNamespace, data, templates) - RMQUninstall(t, kc, rmqNamespace, user, password, vhost) + DeleteKubernetesResources(t, testNamespace, data, templates) + RMQUninstall(t, rmqNamespace, user, password, vhost) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/redis/helper/helper.go b/tests/scalers/redis/helper/helper.go index 12d22a50716..69df98a9783 100644 --- a/tests/scalers/redis/helper/helper.go +++ b/tests/scalers/redis/helper/helper.go @@ -76,13 +76,13 @@ func InstallStandalone(t *testing.T, kc *kubernetes.Clientset, name, namespace, helper.KubectlApplyMultipleWithTemplate(t, data, redisStandaloneTemplates) } -func RemoveStandalone(t *testing.T, kc *kubernetes.Clientset, name, namespace string) { +func RemoveStandalone(t *testing.T, name, namespace string) { var data = templateData{ Namespace: namespace, RedisName: name, } helper.KubectlApplyMultipleWithTemplate(t, data, redisStandaloneTemplates) - helper.DeleteNamespace(t, kc, namespace) + helper.DeleteNamespace(t, namespace) } func InstallSentinel(t *testing.T, kc *kubernetes.Clientset, name, namespace, password string) { @@ -98,12 +98,12 @@ func InstallSentinel(t *testing.T, kc *kubernetes.Clientset, name, namespace, pa assert.NoErrorf(t, err, "cannot execute command - %s", err) } -func RemoveSentinel(t *testing.T, kc *kubernetes.Clientset, name, namespace string) { +func RemoveSentinel(t *testing.T, name, namespace string) { _, err := helper.ExecuteCommand(fmt.Sprintf(`helm uninstall --wait --timeout 900s %s --namespace %s`, name, namespace)) assert.NoErrorf(t, err, "cannot execute command - %s", err) - helper.DeleteNamespace(t, kc, namespace) + helper.DeleteNamespace(t, namespace) } func InstallCluster(t *testing.T, kc *kubernetes.Clientset, name, namespace, password string) { @@ -119,10 +119,10 @@ func InstallCluster(t *testing.T, kc *kubernetes.Clientset, name, namespace, pas assert.NoErrorf(t, err, "cannot execute command - %s", err) } -func RemoveCluster(t *testing.T, kc *kubernetes.Clientset, name, namespace string) { +func RemoveCluster(t *testing.T, name, namespace string) { _, err := helper.ExecuteCommand(fmt.Sprintf(`helm uninstall --wait --timeout 900s %s --namespace %s`, name, namespace)) assert.NoErrorf(t, err, "cannot execute command - %s", err) - helper.DeleteNamespace(t, kc, namespace) + helper.DeleteNamespace(t, namespace) } diff --git a/tests/scalers/redis/redis_cluster_lists/redis_cluster_lists_test.go b/tests/scalers/redis/redis_cluster_lists/redis_cluster_lists_test.go index 520afa4328e..fa983faa9d3 100644 --- a/tests/scalers/redis/redis_cluster_lists/redis_cluster_lists_test.go +++ b/tests/scalers/redis/redis_cluster_lists/redis_cluster_lists_test.go @@ -182,8 +182,8 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - redis.RemoveCluster(t, kc, testName, redisNamespace) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + redis.RemoveCluster(t, testName, redisNamespace) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/redis/redis_cluster_streams/redis_cluster_streams_test.go b/tests/scalers/redis/redis_cluster_streams/redis_cluster_streams_test.go index 9064e746d7a..a21574d71ab 100644 --- a/tests/scalers/redis/redis_cluster_streams/redis_cluster_streams_test.go +++ b/tests/scalers/redis/redis_cluster_streams/redis_cluster_streams_test.go @@ -189,8 +189,8 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - redis.RemoveCluster(t, kc, testName, redisNamespace) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + redis.RemoveCluster(t, testName, redisNamespace) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testScaleOut(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/redis/redis_cluster_streams_length/redis_cluster_streams_length_test.go b/tests/scalers/redis/redis_cluster_streams_length/redis_cluster_streams_length_test.go index 7f55cfc1b84..ce7909b36f9 100644 --- a/tests/scalers/redis/redis_cluster_streams_length/redis_cluster_streams_length_test.go +++ b/tests/scalers/redis/redis_cluster_streams_length/redis_cluster_streams_length_test.go @@ -190,8 +190,8 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - redis.RemoveCluster(t, kc, testName, redisNamespace) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + redis.RemoveCluster(t, testName, redisNamespace) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testScaleOut(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/redis/redis_sentinel_lists/redis_sentinel_lists_test.go b/tests/scalers/redis/redis_sentinel_lists/redis_sentinel_lists_test.go index 2aa1d88ab2a..b9092238c8d 100644 --- a/tests/scalers/redis/redis_sentinel_lists/redis_sentinel_lists_test.go +++ b/tests/scalers/redis/redis_sentinel_lists/redis_sentinel_lists_test.go @@ -190,8 +190,8 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - redis.RemoveSentinel(t, kc, testName, redisNamespace) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + redis.RemoveSentinel(t, testName, redisNamespace) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/redis/redis_sentinel_streams/redis_sentinel_streams_test.go b/tests/scalers/redis/redis_sentinel_streams/redis_sentinel_streams_test.go index 1aadb110d7a..8918609dafe 100644 --- a/tests/scalers/redis/redis_sentinel_streams/redis_sentinel_streams_test.go +++ b/tests/scalers/redis/redis_sentinel_streams/redis_sentinel_streams_test.go @@ -203,8 +203,8 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - redis.RemoveSentinel(t, kc, testName, redisNamespace) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + redis.RemoveSentinel(t, testName, redisNamespace) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testScaleOut(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/redis/redis_sentinel_streams_length/redis_sentinel_streams_length_test.go b/tests/scalers/redis/redis_sentinel_streams_length/redis_sentinel_streams_length_test.go index f241b7142af..b68d7df2f77 100644 --- a/tests/scalers/redis/redis_sentinel_streams_length/redis_sentinel_streams_length_test.go +++ b/tests/scalers/redis/redis_sentinel_streams_length/redis_sentinel_streams_length_test.go @@ -204,8 +204,8 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - redis.RemoveSentinel(t, kc, testName, redisNamespace) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + redis.RemoveSentinel(t, testName, redisNamespace) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testScaleOut(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/redis/redis_standalone_lists/redis_standalone_lists_test.go b/tests/scalers/redis/redis_standalone_lists/redis_standalone_lists_test.go index c173b20e02e..40c22fb7c80 100644 --- a/tests/scalers/redis/redis_standalone_lists/redis_standalone_lists_test.go +++ b/tests/scalers/redis/redis_standalone_lists/redis_standalone_lists_test.go @@ -178,8 +178,8 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - redis.RemoveStandalone(t, kc, testName, redisNamespace) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + redis.RemoveStandalone(t, testName, redisNamespace) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/redis/redis_standalone_streams/redis_standalone_streams_test.go b/tests/scalers/redis/redis_standalone_streams/redis_standalone_streams_test.go index 7404ace6437..23d81e6b524 100644 --- a/tests/scalers/redis/redis_standalone_streams/redis_standalone_streams_test.go +++ b/tests/scalers/redis/redis_standalone_streams/redis_standalone_streams_test.go @@ -186,8 +186,8 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - redis.RemoveStandalone(t, kc, testName, redisNamespace) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + redis.RemoveStandalone(t, testName, redisNamespace) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testScaleOut(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/redis/redis_standalone_streams_length/redis_standalone_streams_length_test.go b/tests/scalers/redis/redis_standalone_streams_length/redis_standalone_streams_length_test.go index 15da8912c25..ed50916587a 100644 --- a/tests/scalers/redis/redis_standalone_streams_length/redis_standalone_streams_length_test.go +++ b/tests/scalers/redis/redis_standalone_streams_length/redis_standalone_streams_length_test.go @@ -187,8 +187,8 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - redis.RemoveStandalone(t, kc, testName, redisNamespace) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + redis.RemoveStandalone(t, testName, redisNamespace) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testScaleOut(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/selenium/selenium_test.go b/tests/scalers/selenium/selenium_test.go index 44d59ec3820..03ce4d9cf08 100644 --- a/tests/scalers/selenium/selenium_test.go +++ b/tests/scalers/selenium/selenium_test.go @@ -476,7 +476,7 @@ func TestSeleniumScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/scalers/solace/solace_test.go b/tests/scalers/solace/solace_test.go index 0b6292068a5..0fb16c51240 100644 --- a/tests/scalers/solace/solace_test.go +++ b/tests/scalers/solace/solace_test.go @@ -176,7 +176,7 @@ func TestStanScaler(t *testing.T) { // cleanup KubectlDeleteWithTemplate(t, data, "scaledObjectTemplate", scaledObjectTemplate) uninstallSolace(t) - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func installSolace(t *testing.T) { diff --git a/tests/scalers/solr/solr_test.go b/tests/scalers/solr/solr_test.go index ffbf6c5d44e..f6195bd4a62 100644 --- a/tests/scalers/solr/solr_test.go +++ b/tests/scalers/solr/solr_test.go @@ -194,7 +194,7 @@ func TestSolrScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func setupSolr(t *testing.T, kc *kubernetes.Clientset) { diff --git a/tests/scalers/stan/stan_test.go b/tests/scalers/stan/stan_test.go index 2e914f4b4b1..46779a2a53f 100644 --- a/tests/scalers/stan/stan_test.go +++ b/tests/scalers/stan/stan_test.go @@ -249,7 +249,7 @@ func TestStanScaler(t *testing.T) { testScaleIn(t, kc) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/secret-providers/azure_keyvault/azure_keyvault_test.go b/tests/secret-providers/azure_keyvault/azure_keyvault_test.go index 257199117b3..9687f8b42fb 100644 --- a/tests/secret-providers/azure_keyvault/azure_keyvault_test.go +++ b/tests/secret-providers/azure_keyvault/azure_keyvault_test.go @@ -171,7 +171,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, messageURL) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupQueue(t, queueURL) } diff --git a/tests/secret-providers/azure_keyvault_workload_identity/azure_keyvault_workload_identity_test.go b/tests/secret-providers/azure_keyvault_workload_identity/azure_keyvault_workload_identity_test.go index 6279e55d0a7..244334be537 100644 --- a/tests/secret-providers/azure_keyvault_workload_identity/azure_keyvault_workload_identity_test.go +++ b/tests/secret-providers/azure_keyvault_workload_identity/azure_keyvault_workload_identity_test.go @@ -155,7 +155,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, messageURL) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupQueue(t, queueURL) } diff --git a/tests/secret-providers/azure_workload_identity_user_assigned/azure_workload_identity_user_assigned_test.go b/tests/secret-providers/azure_workload_identity_user_assigned/azure_workload_identity_user_assigned_test.go index 182d5571298..e60f0efb431 100644 --- a/tests/secret-providers/azure_workload_identity_user_assigned/azure_workload_identity_user_assigned_test.go +++ b/tests/secret-providers/azure_workload_identity_user_assigned/azure_workload_identity_user_assigned_test.go @@ -139,7 +139,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, adminClient) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupServiceBusQueue(t, adminClient) } diff --git a/tests/secret-providers/hashicorp_vault/hashicorp_vault_test.go b/tests/secret-providers/hashicorp_vault/hashicorp_vault_test.go index 0b8a05bf614..6c61b8b30f4 100644 --- a/tests/secret-providers/hashicorp_vault/hashicorp_vault_test.go +++ b/tests/secret-providers/hashicorp_vault/hashicorp_vault_test.go @@ -318,8 +318,8 @@ func TestPostreSQLScaler(t *testing.T) { // cleanup KubectlDeleteMultipleWithTemplate(t, data, templates) - cleanupHashiCorpVault(t, kc) - DeleteKubernetesResources(t, kc, testNamespace, data, postgreSQLtemplates) + cleanupHashiCorpVault(t) + DeleteKubernetesResources(t, testNamespace, data, postgreSQLtemplates) }) } } @@ -354,14 +354,14 @@ func setupHashiCorpVault(t *testing.T, kc *kubernetes.Clientset, kvVersion uint) return out } -func cleanupHashiCorpVault(t *testing.T, kc *kubernetes.Clientset) { +func cleanupHashiCorpVault(t *testing.T) { _, err := ExecuteCommand(fmt.Sprintf("helm uninstall vault --namespace %s", vaultNamespace)) assert.NoErrorf(t, err, "cannot uninstall hashicorp vault - %s", err) _, err = ExecuteCommand("helm repo remove hashicorp") assert.NoErrorf(t, err, "cannot remove hashicorp repo - %s", err) - DeleteNamespace(t, kc, vaultNamespace) + DeleteNamespace(t, vaultNamespace) } func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { diff --git a/tests/secret-providers/trigger_auth_secret/trigger_auth_secret_test.go b/tests/secret-providers/trigger_auth_secret/trigger_auth_secret_test.go index 1f1ac9ad2ba..8d84ee3a13e 100644 --- a/tests/secret-providers/trigger_auth_secret/trigger_auth_secret_test.go +++ b/tests/secret-providers/trigger_auth_secret/trigger_auth_secret_test.go @@ -149,7 +149,7 @@ func TestScaler(t *testing.T) { testScaleIn(t, kc, messageURL) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) cleanupQueue(t, queueURL) } diff --git a/tests/sequential/disruption/disruption_test.go b/tests/sequential/disruption/disruption_test.go index 8da3bd8b216..bd6cf16f5e9 100644 --- a/tests/sequential/disruption/disruption_test.go +++ b/tests/sequential/disruption/disruption_test.go @@ -144,7 +144,7 @@ func TestScaler(t *testing.T) { KubectlDeleteMultipleWithTemplate(t, data, sutDeployment) KubectlDeleteMultipleWithTemplate(t, data, scaledObject) } - DeleteNamespace(t, kc, testNamespace) + DeleteNamespace(t, testNamespace) } func testScaleOut(t *testing.T, kc *kubernetes.Clientset) { diff --git a/tests/sequential/prometheus_metrics/prometheus_metrics_test.go b/tests/sequential/prometheus_metrics/prometheus_metrics_test.go index ca13df3b236..0c5fbaf6abd 100644 --- a/tests/sequential/prometheus_metrics/prometheus_metrics_test.go +++ b/tests/sequential/prometheus_metrics/prometheus_metrics_test.go @@ -267,7 +267,7 @@ func TestPrometheusMetrics(t *testing.T) { testWebhookMetrics(t, data) // cleanup - DeleteKubernetesResources(t, kc, testNamespace, data, templates) + DeleteKubernetesResources(t, testNamespace, data, templates) } func getTemplateData() (templateData, []Template) { diff --git a/tests/utils/cleanup_test.go b/tests/utils/cleanup_test.go index 14766cb886e..87e718bd318 100644 --- a/tests/utils/cleanup_test.go +++ b/tests/utils/cleanup_test.go @@ -31,7 +31,7 @@ func TestRemoveAadPodIdentityComponents(t *testing.T) { KubeClient = GetKubernetesClient(t) - DeleteNamespace(t, KubeClient, AzureAdPodIdentityNamespace) + DeleteNamespace(t, AzureAdPodIdentityNamespace) } func TestRemoveWorkloadIdentityComponents(t *testing.T) { @@ -44,7 +44,7 @@ func TestRemoveWorkloadIdentityComponents(t *testing.T) { KubeClient = GetKubernetesClient(t) - DeleteNamespace(t, KubeClient, AzureWorkloadIdentityNamespace) + DeleteNamespace(t, AzureWorkloadIdentityNamespace) } func TestRemoveAwsIdentityComponents(t *testing.T) { @@ -57,7 +57,7 @@ func TestRemoveAwsIdentityComponents(t *testing.T) { KubeClient = GetKubernetesClient(t) - DeleteNamespace(t, KubeClient, AwsIdentityNamespace) + DeleteNamespace(t, AwsIdentityNamespace) } func TestRemoveGcpIdentityComponents(t *testing.T) { @@ -70,7 +70,7 @@ func TestRemoveGcpIdentityComponents(t *testing.T) { KubeClient = GetKubernetesClient(t) - DeleteNamespace(t, KubeClient, GcpIdentityNamespace) + DeleteNamespace(t, GcpIdentityNamespace) } func TestRemoveCertManager(t *testing.T) { @@ -83,7 +83,7 @@ func TestRemoveCertManager(t *testing.T) { KubeClient = GetKubernetesClient(t) - DeleteNamespace(t, KubeClient, CertManagerNamespace) + DeleteNamespace(t, CertManagerNamespace) } func TestRemoveAzureManagedPrometheusComponents(t *testing.T) {