Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
4gust committed Feb 11, 2025
1 parent b955ede commit c5393f5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions apps/confidential/confidential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -825,8 +825,8 @@ func TestRefreshInMultipleRequests(t *testing.T) {
Token string
Tenant string
}
tokenOneCchecker := false
tokenTwoCchecker := false
firstTenantChecker := false
secondTenantChecker := false

ch := make(chan tokenResult, 14)
var mu sync.Mutex // Mutex to protect access to expectedResponse
Expand Down Expand Up @@ -855,10 +855,10 @@ func TestRefreshInMultipleRequests(t *testing.T) {
return
}
if ar.AccessToken == secondToken+"firstTenant" && ar.Metadata.TokenSource == base.IdentityProvider {
if tokenOneCchecker {
if firstTenantChecker {
t.Error("Error can only call this once")
} else {
tokenOneCchecker = true
firstTenantChecker = true
}
}
ch <- tokenResult{Token: ar.AccessToken, Tenant: "firstTentant"} // Send result to channel
Expand All @@ -872,10 +872,10 @@ func TestRefreshInMultipleRequests(t *testing.T) {
return
}
if ar.AccessToken == secondToken+"secondTenant" && ar.Metadata.TokenSource == base.IdentityProvider {
if tokenTwoCchecker {
if secondTenantChecker {
t.Error("Error can only call this once")
} else {
tokenTwoCchecker = true
secondTenantChecker = true
}
}
ch <- tokenResult{Token: ar.AccessToken, Tenant: "secondTentant"} // Send result to channel
Expand All @@ -888,7 +888,7 @@ func TestRefreshInMultipleRequests(t *testing.T) {
gotResponse = append(gotResponse, s)
mu.Unlock() // Release lock after modifying expectedResponse
}
if !tokenOneCchecker && !tokenTwoCchecker {
if !firstTenantChecker && !secondTenantChecker {
t.Error("Error should be called at least once")
}
}()
Expand Down

0 comments on commit c5393f5

Please sign in to comment.