Skip to content

Commit 57e6e4e

Browse files
committed
Small fixes
1 parent e1e2602 commit 57e6e4e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

validator/client/src/main/java/tech/pegasys/teku/validator/client/loader/ExternalUrlKeyReader.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import static tech.pegasys.teku.infrastructure.logging.StatusLogger.STATUS_LOG;
1717

1818
import com.fasterxml.jackson.databind.ObjectMapper;
19+
import com.google.common.annotations.VisibleForTesting;
1920
import java.io.IOException;
2021
import java.net.MalformedURLException;
2122
import java.net.URL;
@@ -58,15 +59,16 @@ public Stream<BLSPublicKey> readKeys() {
5859
return Arrays.stream(keys).map(key -> BLSPublicKey.fromSSZBytes(Bytes.fromHexString(key)));
5960
}
6061

61-
public SafeFuture<String[]> readUrl() {
62+
private SafeFuture<String[]> readUrl() {
6263
try {
6364
return SafeFuture.completedFuture(mapper.readValue(new URL(url), String[].class));
6465
} catch (IOException e) {
6566
return SafeFuture.failedFuture(e);
6667
}
6768
}
6869

69-
public SafeFuture<String[]> retry() {
70+
@VisibleForTesting
71+
SafeFuture<String[]> retry() {
7072
return asyncRunner
7173
.runWithRetry(
7274
() -> {

validator/client/src/test/java/tech/pegasys/teku/validator/client/loader/ExternalUrlKeyReaderTest.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,18 @@
4444
class ExternalUrlKeyReaderTest {
4545
private static final Duration DELAY = Duration.ofSeconds(5);
4646
private static final String VALID_URL = "http://test:0000/api/v1/eth2/publicKeys";
47-
private final ObjectMapper mapper = mock(ObjectMapper.class);
4847

48+
private final ObjectMapper mapper = mock(ObjectMapper.class);
4949
private final StubTimeProvider timeProvider = StubTimeProvider.withTimeInMillis(0);
5050
private final StubAsyncRunner asyncRunner = new StubAsyncRunner(timeProvider);
5151

5252
private final DataStructureUtil dataStructureUtil =
5353
new DataStructureUtil(TestSpecFactory.createDefault());
5454

55-
final BLSPublicKey publicKey1 = dataStructureUtil.randomPublicKey();
56-
final BLSPublicKey publicKey2 = dataStructureUtil.randomPublicKey();
57-
final String[] expectedKeys = new String[] {publicKey1.toHexString(), publicKey2.toHexString()};
55+
private final BLSPublicKey publicKey1 = dataStructureUtil.randomPublicKey();
56+
private final BLSPublicKey publicKey2 = dataStructureUtil.randomPublicKey();
57+
private final String[] expectedKeys =
58+
new String[] {publicKey1.toHexString(), publicKey2.toHexString()};
5859

5960
@Test
6061
void readKeys_validUrlReturnsValidKeys() throws IOException {

0 commit comments

Comments
 (0)