Skip to content

Commit

Permalink
empty proxy signers unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
usmansaleem committed Oct 21, 2024
1 parent cd20c6c commit 94d9be4
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,32 @@ void proxySignersAreLoadedCorrectly() throws IOException {
.containsExactlyInAnyOrder(getSecpPublicKeysArray(key2SecpKeyPairs));
}

@Test
void emptyProxySignersAreLoadedSuccessfully() {
// enable commit boose without existing proxy keys
final KeystoresParameters commitBoostParameters =
new TestCommitBoostParameters(commitBoostKeystoresPath, commitBoostPasswordDir);

// set up mock signers
final ArtifactSigner mockSigner1 = mock(ArtifactSigner.class);
when(mockSigner1.getIdentifier()).thenReturn(PUBLIC_KEY1);
final ArtifactSigner mockSigner2 = mock(ArtifactSigner.class);
when(mockSigner2.getIdentifier()).thenReturn(PUBLIC_KEY2);

signerProvider =
new DefaultArtifactSignerProvider(
() -> List.of(mockSigner1, mockSigner2), Optional.of(commitBoostParameters));

// methods under test
assertThatCode(() -> signerProvider.load().get()).doesNotThrowAnyException();

for (String identifier : List.of(PUBLIC_KEY1, PUBLIC_KEY2)) {
final Map<KeyType, List<String>> keyProxyPublicKeys =
signerProvider.getProxyIdentifiers(identifier);
assertThat(keyProxyPublicKeys).isEmpty();
}
}

private List<BLSKeyPair> randomBLSV4Keystores(SecureRandom secureRandom, String identifier)
throws IOException {
final Path v4Dir =
Expand Down

0 comments on commit 94d9be4

Please sign in to comment.