From: PatrikBuhr Date: Mon, 21 Mar 2022 08:25:27 +0000 (+0100) Subject: Fetch of authorization token X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=f7ac7674cdb0834946a222cabfdd154486119069;p=nonrtric.git Fetch of authorization token Trying to fix unstable unittest. Timing issue. Signed-off-by: PatrikBuhr Issue-ID: NONRTRIC-735 Change-Id: I73869638e0c2ef1d5f7bd627eeb2de44dd53a0e5 --- diff --git a/auth-token-fetch/main_test.go b/auth-token-fetch/main_test.go index 1b0a87e9..c5756142 100644 --- a/auth-token-fetch/main_test.go +++ b/auth-token-fetch/main_test.go @@ -68,6 +68,7 @@ func TestFetchAndStoreToken(t *testing.T) { configuration.AuthTokenOutputFileName = "/tmp/authToken" + fmt.Sprint(time.Now().UnixNano()) configuration.ClientId = "testClientId" configuration.ClientSecret = "testClientSecret" + configuration.RefreshMarginSeconds = 1 context := NewContext(configuration) t.Cleanup(func() { @@ -75,7 +76,7 @@ func TestFetchAndStoreToken(t *testing.T) { }) accessToken := "Access_token" + fmt.Sprint(time.Now().UnixNano()) - token := JwtToken{Access_token: accessToken, Expires_in: 10, Token_type: "Token_type"} + token := JwtToken{Access_token: accessToken, Expires_in: 7, Token_type: "Token_type"} wg := sync.WaitGroup{} wg.Add(2) // Get token two times @@ -83,7 +84,7 @@ func TestFetchAndStoreToken(t *testing.T) { go periodicRefreshIwtToken(clientMock, context) - if waitTimeout(&wg, 7*time.Second) { + if waitTimeout(&wg, 12*time.Second) { t.Error("Not all calls to server were made") t.Fail() }