Skip to content

Commit 539b605

Browse files
committed
use tokenapi const instead of magic strings
1 parent a0d4499 commit 539b605

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/clients/key_flow_continuous_refresh_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"io"
99
"net/http"
10+
"net/url"
1011
"testing"
1112
"time"
1213

@@ -245,14 +246,18 @@ func TestContinuousRefreshTokenConcurrency(t *testing.T) {
245246
ctx, cancel := context.WithCancel(ctx)
246247
defer cancel() // This cancels the refresher goroutine
247248

249+
// Extract host from tokenAPI constant for consistency
250+
tokenURL, _ := url.Parse(tokenAPI)
251+
tokenHost := tokenURL.Host
252+
248253
// The Do() routine, that both the keyFlow and continuousRefreshToken() use to make their requests
249254
// The bools are used to make sure only one request goes through on each test phase
250255
doTestPhase1RequestDone := false
251256
doTestPhase2RequestDone := false
252257
doTestPhase4RequestDone := false
253258
mockDo := func(req *http.Request) (resp *http.Response, err error) {
254259
// Handle auth requests (token refresh)
255-
if req.URL.Host == "service-account.api.stackit.cloud" {
260+
if req.URL.Host == tokenHost {
256261
switch currentTestPhase {
257262
default:
258263
// After phase 1, allow additional auth requests but don't fail the test

0 commit comments

Comments
 (0)