This test was fixed as part of #49736 so that it used a TokenService mock instance that was enabled, so that token verification fails because the token is invalid and not because the token service is not enabled. When the randomly generated token we send, decodes to being of version > 7.2 , we need to have mocked a GetResponse for the call that TokenService#getUserTokenFromId will make, otherwise this hangs and times out.
This commit is contained in:
parent
8f36bfa37f
commit
46376100b1
|
@ -601,7 +601,9 @@ public class TokenServiceTests extends ESTestCase {
|
|||
final byte[] randomBytes = new byte[numBytes];
|
||||
random().nextBytes(randomBytes);
|
||||
TokenService tokenService = createTokenService(tokenServiceEnabledSettings, systemUTC());
|
||||
|
||||
// mock another random token so that we don't find a token in TokenService#getUserTokenFromId
|
||||
Authentication authentication = new Authentication(new User("joe", "admin"), new RealmRef("native_realm", "native", "node1"), null);
|
||||
mockGetTokenFromId(tokenService, UUIDs.randomBase64UUID(), authentication, false);
|
||||
ThreadContext requestContext = new ThreadContext(Settings.EMPTY);
|
||||
storeTokenHeader(requestContext, Base64.getEncoder().encodeToString(randomBytes));
|
||||
|
||||
|
|
Loading…
Reference in New Issue