Don't faff about with waiting

This commit is contained in:
David Robertson 2023-09-05 19:22:03 +01:00
parent e67a945a5e
commit eb4c152952
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD
2 changed files with 7 additions and 1 deletions

View File

@ -452,7 +452,7 @@ func TestPollerExpiryEnsurePollingRace(t *testing.T) {
}
// Expire the token before we process the request.
t.Log("Alice's token expires.")
v2.invalidateToken(token)
v2.invalidateTokenImmediately(token)
})
v3.mustDoV3Request(t, aliceToken, sync3.Request{})

View File

@ -97,6 +97,12 @@ func (s *testV2Server) addAccountWithDeviceID(userID, deviceID, token string) {
}
}
// like invalidateToken, but doesn't do any waiting.
func (s *testV2Server) invalidateTokenImmediately(token string) {
delete(s.tokenToUser, token)
delete(s.tokenToDevice, token)
}
// remove the token and wait until the proxy sends a request with this token, then 401 it and return.
func (s *testV2Server) invalidateToken(token string) {
var wg sync.WaitGroup