Skip to content

Commit 3623654

Browse files
committed
Update test
1 parent 3fd1252 commit 3623654

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

Diff for: validator/remote/src/integration-test/java/tech/pegasys/teku/validator/remote/typedef/OkHttpValidatorTypeDefClientTest.java

+20-8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT;
2525
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK;
2626
import static tech.pegasys.teku.infrastructure.json.JsonUtil.serialize;
27+
import static tech.pegasys.teku.spec.config.SpecConfig.FAR_FUTURE_EPOCH;
2728

2829
import com.fasterxml.jackson.core.JsonProcessingException;
2930
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -39,6 +40,7 @@
3940
import org.junit.jupiter.params.provider.ValueSource;
4041
import tech.pegasys.teku.api.exceptions.RemoteServiceNotAvailableException;
4142
import tech.pegasys.teku.api.response.v1.beacon.ValidatorStatus;
43+
import tech.pegasys.teku.api.schema.BLSPubKey;
4244
import tech.pegasys.teku.ethereum.json.types.beacon.StateValidatorData;
4345
import tech.pegasys.teku.infrastructure.ssz.SszDataAssert;
4446
import tech.pegasys.teku.infrastructure.ssz.SszList;
@@ -51,6 +53,7 @@
5153
import tech.pegasys.teku.spec.datastructures.builder.SignedValidatorRegistration;
5254
import tech.pegasys.teku.spec.datastructures.metadata.BlockContainerAndMetaData;
5355
import tech.pegasys.teku.spec.datastructures.metadata.ObjectAndMetaData;
56+
import tech.pegasys.teku.spec.datastructures.state.Validator;
5457
import tech.pegasys.teku.spec.networks.Eth2Network;
5558
import tech.pegasys.teku.spec.schemas.ApiSchemas;
5659
import tech.pegasys.teku.validator.api.SendSignedBlockResult;
@@ -375,10 +378,8 @@ public void postValidators_WhenSuccess_ReturnsResponse() throws JsonProcessingEx
375378
final ObjectAndMetaData<List<StateValidatorData>> response =
376379
new ObjectAndMetaData<>(expected, specMilestone, false, true, false);
377380

378-
mockWebServer.enqueue(
379-
new MockResponse()
380-
.setResponseCode(SC_OK)
381-
.setBody(serialize(response, STATE_VALIDATORS_RESPONSE_TYPE)));
381+
final String body = serialize(response, STATE_VALIDATORS_RESPONSE_TYPE);
382+
mockWebServer.enqueue(new MockResponse().setResponseCode(SC_OK).setBody(body));
382383

383384
Optional<List<StateValidatorData>> result =
384385
okHttpValidatorTypeDefClient.postStateValidators(List.of("1", "2"));
@@ -388,11 +389,22 @@ public void postValidators_WhenSuccess_ReturnsResponse() throws JsonProcessingEx
388389
}
389390

390391
private StateValidatorData generateStateValidatorData() {
392+
final long index = dataStructureUtil.randomLong();
393+
final Validator validator =
394+
new Validator(
395+
dataStructureUtil.randomPublicKey(),
396+
dataStructureUtil.randomBytes32(),
397+
dataStructureUtil.randomUInt64(),
398+
false,
399+
UInt64.ZERO,
400+
UInt64.ZERO,
401+
FAR_FUTURE_EPOCH,
402+
FAR_FUTURE_EPOCH);
391403
return new StateValidatorData(
392-
dataStructureUtil.randomValidatorIndex(),
393-
dataStructureUtil.randomUInt64(),
394-
ValidatorStatus.active_ongoing,
395-
dataStructureUtil.randomValidator());
404+
UInt64.valueOf(index),
405+
dataStructureUtil.randomUInt64(),
406+
ValidatorStatus.active_ongoing,
407+
validator);
396408
}
397409

398410
private void verifyRegisterValidatorsPostRequest(

0 commit comments

Comments
 (0)