Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate old Azure SDKs into to use github.com/Azure/azure-sdk-for-go/sdk/azidentity #5471

Merged
merged 26 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix e2e tests
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>
  • Loading branch information
JorTurFer committed Jul 24, 2024
commit c4f32f98067f9532f168e3755f745430430c2cb1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"k8s.io/client-go/kubernetes"

. "github.com/kedacore/keda/v2/tests/helper"
azurehelper "github.com/kedacore/keda/v2/tests/scalers/azure/helper"
)

// Load environment variables from .env file
Expand Down Expand Up @@ -139,6 +140,7 @@ func TestScaler(t *testing.T) {
ctx := context.Background()
t.Log("--- setting up ---")
require.NotEmpty(t, connectionString, "TF_AZURE_STORAGE_CONNECTION_STRING env variable is required for azure blob test")
accountName = azurehelper.GetAccountFromStorageConnectionString(connectionString)

blobClient, err := azblob.NewClientFromConnectionString(connectionString, nil)
assert.NoErrorf(t, err, "cannot create the queue client - %s", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func TestScaler(t *testing.T) {
ctx := context.Background()
t.Log("--- setting up ---")
require.NotEmpty(t, storageConnectionString, "TF_AZURE_STORAGE_CONNECTION_STRING env variable is required for azure eventhub test")
accountName = azurehelper.GetAccountFromStorageConnectionString(storageConnectionString)

eventHubHelper := azurehelper.NewEventHubHelper(t)
eventHubHelper.CreateEventHub(ctx, t)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"k8s.io/client-go/kubernetes"

. "github.com/kedacore/keda/v2/tests/helper"
azurehelper "github.com/kedacore/keda/v2/tests/scalers/azure/helper"
)

// Load environment variables from .env file
Expand Down Expand Up @@ -128,6 +129,7 @@ func TestScaler(t *testing.T) {
ctx := context.Background()
t.Log("--- setting up ---")
require.NotEmpty(t, connectionString, "TF_AZURE_STORAGE_CONNECTION_STRING env variable is required for azure queue test")
accountName = azurehelper.GetAccountFromStorageConnectionString(connectionString)

queueClient, err := azqueue.NewQueueClientFromConnectionString(connectionString, queueName, nil)
assert.NoErrorf(t, err, "cannot create the queue client - %s", err)
Expand Down
27 changes: 27 additions & 0 deletions tests/scalers/azure/helper/StorageHelper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//go:build e2e
// +build e2e

package helper

import (
"strings"
)

func GetAccountFromStorageConnectionString(connection string) string {
parts := strings.Split(connection, ";")

getValue := func(pair string) string {
parts := strings.SplitN(pair, "=", 2)
if len(parts) == 2 {
return parts[1]
}
return ""
}
for _, v := range parts {
switch {
case strings.HasPrefix(v, "AccountName"):
return getValue(v)
}
}
return ""
}