diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/security/TestRMDelegationTokens.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/security/TestRMDelegationTokens.java index 2c52377995..aae86b0bd5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/security/TestRMDelegationTokens.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/security/TestRMDelegationTokens.java @@ -97,7 +97,17 @@ public void testRMDTMasterKeyStateOnRollingMasterKey() throws Exception { RMDelegationTokenSecretManager dtSecretManager = rm1.getRMContext().getRMDelegationTokenSecretManager(); // assert all master keys are saved - Assert.assertEquals(dtSecretManager.getAllMasterKeys(), rmDTMasterKeyState); + dtSecretManager.getAllMasterKeys().forEach(managerKey -> { + int keyId = managerKey.getKeyId(); + boolean found = false; + for (DelegationKey stateKey: rmDTMasterKeyState) { + if (stateKey.getKeyId() == keyId) { + found = true; + break; + } + } + Assert.assertTrue("Master key not found: " + keyId, found); + }); // request to generate a RMDelegationToken GetDelegationTokenRequest request = mock(GetDelegationTokenRequest.class);