Skip to content

Commit

Permalink
chore: Improve azure pipelines e2e error messages
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>
  • Loading branch information
JorTurFer committed Feb 8, 2025
1 parent 28366eb commit cbc7071
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions tests/scalers/azure/azure_pipelines/azure_pipelines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"encoding/base64"
"fmt"
"math"
"os"
"strconv"
"testing"
Expand Down Expand Up @@ -158,6 +159,17 @@ spec:
`
)

func inject(src string) string {
l := len(src)
if l == 1 {
return src
}
mid := l / 2
left := int(math.Round(float64(mid)))
right := l - left
return src[:left] + "__" + src[right:]
}

func TestScaler(t *testing.T) {
// setup
t.Log("--- setting up ---")
Expand All @@ -167,11 +179,11 @@ func TestScaler(t *testing.T) {
require.NotEmpty(t, buildID, "AZURE_DEVOPS_BUILD_DEFINITION_ID env variable is required for azure blob test")
require.NotEmpty(t, poolName, "AZURE_DEVOPS_POOL_NAME env variable is required for azure blob test")

t.Logf("AZURE_DEVOPS_ORGANIZATION_URL=%s", base64.StdEncoding.EncodeToString([]byte(organizationURL)))
t.Logf("AZURE_DEVOPS_PAT=%s", base64.StdEncoding.EncodeToString([]byte(personalAccessToken)))
t.Logf("AZURE_DEVOPS_PROJECT=%s", base64.StdEncoding.EncodeToString([]byte(project)))
t.Logf("AZURE_DEVOPS_BUILD_DEFINITION_ID=%s", base64.StdEncoding.EncodeToString([]byte(buildID)))
t.Logf("AZURE_DEVOPS_POOL_NAME=%s", base64.StdEncoding.EncodeToString([]byte(poolName)))
t.Logf("AZURE_DEVOPS_ORGANIZATION_URL=%s", inject(organizationURL))
t.Logf("AZURE_DEVOPS_PAT=%s", inject(personalAccessToken))
t.Logf("AZURE_DEVOPS_PROJECT=%s", inject(project))
t.Logf("AZURE_DEVOPS_BUILD_DEFINITION_ID=%s", inject(buildID))
t.Logf("AZURE_DEVOPS_POOL_NAME=%s", inject(poolName))

connection := azuredevops.NewPatConnection(organizationURL, personalAccessToken)
clearAllBuilds(t, connection)
Expand Down

0 comments on commit cbc7071

Please # to comment.