Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
Expand Down Expand Up @@ -1744,7 +1745,9 @@ public void testNoopUpdateApiKey() throws ExecutionException, InterruptedExcepti
final var initialRequest = new UpdateApiKeyRequest(
apiKeyId,
List.of(new RoleDescriptor(randomAlphaOfLength(10), new String[] { "all" }, null, null)),
ApiKeyTests.randomMetadata()
// Ensure not `null` to set metadata since we use the initialRequest further down in the test to ensure that
// metadata updates are non-noops
randomValueOtherThanMany(Objects::isNull, ApiKeyTests::randomMetadata)
);
UpdateApiKeyResponse response = executeUpdateApiKey(TEST_USER_NAME, initialRequest);
assertNotNull(response);
Expand Down Expand Up @@ -1772,11 +1775,11 @@ public void testNoopUpdateApiKey() throws ExecutionException, InterruptedExcepti
// Update with different role descriptors is not a noop
final List<RoleDescriptor> newRoleDescriptors = List.of(
randomValueOtherThanMany(
rd -> (RoleDescriptorRequestValidator.validate(rd) != null) && initialRequest.getRoleDescriptors().contains(rd) == false,
rd -> RoleDescriptorRequestValidator.validate(rd) != null || initialRequest.getRoleDescriptors().contains(rd),
() -> RoleDescriptorTests.randomRoleDescriptor(false)
),
randomValueOtherThanMany(
rd -> (RoleDescriptorRequestValidator.validate(rd) != null) && initialRequest.getRoleDescriptors().contains(rd) == false,
rd -> RoleDescriptorRequestValidator.validate(rd) != null || initialRequest.getRoleDescriptors().contains(rd),
() -> RoleDescriptorTests.randomRoleDescriptor(false)
)
);
Expand Down