From ea3b2e10d6386e5da50558a420c45c1c6bc1d7b0 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Ferrero Date: Tue, 3 May 2022 21:17:07 +0200 Subject: [PATCH] chore: update data explorer scaler to fix deprecation (#2991) --- .golangci.yml | 4 ---- CHANGELOG.md | 1 + pkg/mock/mock_client/mock_interfaces.go | 2 +- pkg/mock/mock_scale/mock_interfaces.go | 2 +- pkg/scalers/azure/azure_data_explorer.go | 7 +++++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index b0f04d8704c..e96dfc55c8b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -75,10 +75,6 @@ issues: - path: azure/azure_app_insights.go linters: - bodyclose - # remove once https://github.com/kedacore/keda/issues/2989 is fixed - - path: azure/azure_data_explorer.go - linters: - - staticcheck linters-settings: funlen: diff --git a/CHANGELOG.md b/CHANGELOG.md index ecf5b6c0b2a..f418cf7863a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -94,6 +94,7 @@ To learn more about our roadmap, we recommend reading [this document](ROADMAP.md - **AWS Kinesis Stream:** Adding e2e test ([#1526](https://github.com/kedacore/keda/issues/1526)) - **AWS SQS Queue:** Adding e2e test ([#1527](https://github.com/kedacore/keda/issues/1527)) - **Azure Data Explorer:** Adding e2e test ([#2841](https://github.com/kedacore/keda/issues/2841)) +- **Azure Data Explorer:** Replace deprecated function `iter.Next()` in favour of `iter.NextRowOrError()` ([#2989](https://github.com/kedacore/keda/issues/2989)) - **Azure Service Bus:** Adding e2e test ([#2731](https://github.com/kedacore/keda/issues/2731)|[#2732](https://github.com/kedacore/keda/issues/2732)) - **External Scaler:** Adding e2e test. ([#2697](https://github.com/kedacore/keda/issues/2697)) - **External Scaler:** Fix issue with internal KEDA core prefix being passed to external scaler. ([#2640](https://github.com/kedacore/keda/issues/2640)) diff --git a/pkg/mock/mock_client/mock_interfaces.go b/pkg/mock/mock_client/mock_interfaces.go index 0521f858838..1a8ba73ea73 100644 --- a/pkg/mock/mock_client/mock_interfaces.go +++ b/pkg/mock/mock_client/mock_interfaces.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/client/interfaces.go +// Source: /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.2/pkg/client/interfaces.go // Package mock_client is a generated GoMock package. package mock_client diff --git a/pkg/mock/mock_scale/mock_interfaces.go b/pkg/mock/mock_scale/mock_interfaces.go index 651bd55f7fd..47e507c92a1 100644 --- a/pkg/mock/mock_scale/mock_interfaces.go +++ b/pkg/mock/mock_scale/mock_interfaces.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: /go/pkg/mod/k8s.io/client-go@v0.23.3/scale/interfaces.go +// Source: /go/pkg/mod/k8s.io/client-go@v0.23.6/scale/interfaces.go // Package mock_scale is a generated GoMock package. package mock_scale diff --git a/pkg/scalers/azure/azure_data_explorer.go b/pkg/scalers/azure/azure_data_explorer.go index 65102c0dca3..9d1e0e8f1b2 100644 --- a/pkg/scalers/azure/azure_data_explorer.go +++ b/pkg/scalers/azure/azure_data_explorer.go @@ -92,7 +92,10 @@ func GetAzureDataExplorerMetricValue(ctx context.Context, client *kusto.Client, } defer iter.Stop() - row, err := iter.Next() + row, inlineError, err := iter.NextRowOrError() + if inlineError != nil { + return -1, fmt.Errorf("failed to get query %s result: %v", query, inlineError) + } if err != nil { return -1, fmt.Errorf("failed to get query %s result: %v", query, err) } @@ -102,7 +105,7 @@ func GetAzureDataExplorerMetricValue(ctx context.Context, client *kusto.Client, } // Return error if there is more than one row. - _, err = iter.Next() + _, _, err = iter.NextRowOrError() if err != io.EOF { return -1, fmt.Errorf("query %s result had more than a single result row", query) }