diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlobSidecarsAtSlot.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlobSidecarsAtSlot.java index b055c433016..3df8ad059e3 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlobSidecarsAtSlot.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlobSidecarsAtSlot.java @@ -68,6 +68,7 @@ private static EndpointMetadata createEndpointMetadata(final SchemaDefinitionCac .queryListParam(BLOB_INDICES_PARAMETER) .response(SC_OK, "Request successful", getResponseType(schemaCache), getSszResponseType()) .withNotFoundResponse() + .withChainDataResponses() .build(); } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlocksAtSlot.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlocksAtSlot.java index e14b1bcefbf..f799e76a2a0 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlocksAtSlot.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlocksAtSlot.java @@ -66,6 +66,7 @@ public GetAllBlocksAtSlot( .response(SC_OK, "Request successful", getResponseType(schemaDefinitionCache)) .withServiceUnavailableResponse() .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1Data.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1Data.java index 46131c57410..fb81f703b67 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1Data.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1Data.java @@ -51,6 +51,7 @@ public GetEth1Data(final DataProvider dataProvider, final Eth1DataProvider eth1D .tags(TAG_TEKU) .response(SC_OK, "Request successful", ETH1DATA_RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = dataProvider.getChainDataProvider(); this.eth1DataProvider = eth1DataProvider; diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1VotingSummary.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1VotingSummary.java index 14dd49860f5..a28f4fe0f1e 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1VotingSummary.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1VotingSummary.java @@ -89,6 +89,7 @@ public GetEth1VotingSummary( .tags(TAG_TEKU) .response(SC_OK, "Request successful", ETH1VOTING_SUMMARY_RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = dataProvider.getChainDataProvider(); this.eth1DataProvider = eth1DataProvider; diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetFinalizedStateSlotBefore.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetFinalizedStateSlotBefore.java index eb8f48a0903..578e4c5d3e4 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetFinalizedStateSlotBefore.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetFinalizedStateSlotBefore.java @@ -55,6 +55,7 @@ public GetFinalizedStateSlotBefore(final ChainDataProvider chainDataProvider) { .response(SC_OK, "Request successful", UINT64_RESPONSE) .withServiceUnavailableResponse() .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetStateByBlockRoot.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetStateByBlockRoot.java index 02bd129e657..34c5dc98b28 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetStateByBlockRoot.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetStateByBlockRoot.java @@ -60,6 +60,7 @@ public GetStateByBlockRoot(final ChainDataProvider chainDataProvider, final Spec spec.getForkSchedule() .getSpecMilestoneAtSlot(((BeaconState) beaconState).getSlot()))) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetGlobalValidatorInclusion.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetGlobalValidatorInclusion.java index dba3f57bcf5..aeb6fff91b8 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetGlobalValidatorInclusion.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetGlobalValidatorInclusion.java @@ -62,6 +62,7 @@ public GetGlobalValidatorInclusion(final ChainDataProvider chainDataProvider) { .build()) .withNotFoundResponse() .withServiceUnavailableResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetValidatorInclusion.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetValidatorInclusion.java index aef36a8b8db..895e7ac7a44 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetValidatorInclusion.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetValidatorInclusion.java @@ -71,6 +71,7 @@ public GetValidatorInclusion(final DataProvider dataProvider) { .build()) .withNotFoundResponse() .withServiceUnavailableResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlindedBlock.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlindedBlock.java index bbdef75a84e..3029cc471a6 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlindedBlock.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlindedBlock.java @@ -67,6 +67,7 @@ public GetBlindedBlock( getResponseType(schemaDefinitionCache), sszResponseType()) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlobSidecars.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlobSidecars.java index 6d88fc1323e..30da351fcca 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlobSidecars.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlobSidecars.java @@ -75,6 +75,7 @@ private static EndpointMetadata createEndpointMetadata(final SchemaDefinitionCac .queryListParam(BLOB_INDICES_PARAMETER) .response(SC_OK, "Request successful", getResponseType(schemaCache), getSszResponseType()) .withNotFoundResponse() + .withChainDataResponses() .build(); } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockAttestations.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockAttestations.java index 3e645749ef8..a647995b0a1 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockAttestations.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockAttestations.java @@ -55,6 +55,7 @@ public GetBlockAttestations(final ChainDataProvider chainDataProvider, final Spe .pathParam(PARAMETER_BLOCK_ID) .response(SC_OK, "Request successful", getResponseType(spec)) .withNotFoundResponse() + .withChainDataResponses() .deprecated(true) .build()); this.chainDataProvider = chainDataProvider; diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeader.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeader.java index 3c2e3a735be..8726b892767 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeader.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeader.java @@ -61,6 +61,7 @@ public GetBlockHeader(final ChainDataProvider chainDataProvider) { .pathParam(PARAMETER_BLOCK_ID) .response(SC_OK, "Request successful", RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeaders.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeaders.java index f5eef3a6d26..80cba132698 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeaders.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeaders.java @@ -68,6 +68,7 @@ public GetBlockHeaders(final ChainDataProvider chainDataProvider) { .queryParam(SLOT_PARAMETER.withDescription(SLOT_QUERY_DESCRIPTION)) .queryParam(PARENT_ROOT_PARAMETER) .response(SC_OK, "Request successful", RESPONSE_TYPE) + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockRoot.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockRoot.java index e69a56c84d5..1eda82b9563 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockRoot.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockRoot.java @@ -60,6 +60,7 @@ public GetBlockRoot(final ChainDataProvider chainDataProvider) { .pathParam(PARAMETER_BLOCK_ID) .response(SC_OK, "Request successful", RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedBlockRoot.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedBlockRoot.java index 8d5521aecb7..ffa0409bd07 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedBlockRoot.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedBlockRoot.java @@ -59,6 +59,7 @@ public GetFinalizedBlockRoot(final ChainDataProvider chainDataProvider) { .pathParam(SLOT_PARAMETER) .response(SC_OK, "Request successful", RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedCheckpointState.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedCheckpointState.java index 2394120c7bc..e22caf5bf13 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedCheckpointState.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedCheckpointState.java @@ -59,6 +59,7 @@ public GetFinalizedCheckpointState(final ChainDataProvider chainDataProvider, fi spec.getForkSchedule() .getSpecMilestoneAtSlot(((BeaconState) beaconState).getSlot()))) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetGenesis.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetGenesis.java index 8532f97153d..6220a635ecf 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetGenesis.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetGenesis.java @@ -47,6 +47,7 @@ public GetGenesis(final DataProvider dataProvider) { .tags(TAG_BEACON, TAG_VALIDATOR_REQUIRED) .response(SC_OK, "Request successful", GET_GENESIS_API_DATA_TYPE) .response(SC_NOT_FOUND, "Chain genesis info is not yet known") + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateCommittees.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateCommittees.java index 61ad5867895..9a0e5d9d061 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateCommittees.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateCommittees.java @@ -84,6 +84,7 @@ public GetStateCommittees(final DataProvider dataProvider) { .tags(TAG_BEACON) .response(SC_OK, "Request successful", RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateFinalityCheckpoints.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateFinalityCheckpoints.java index c139a3b8672..d98449ff9b5 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateFinalityCheckpoints.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateFinalityCheckpoints.java @@ -70,6 +70,7 @@ public GetStateFinalityCheckpoints(final DataProvider dataProvider) { .pathParam(PARAMETER_STATE_ID) .response(SC_OK, "Request successful", RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build(), chainDataProvider); } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateFork.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateFork.java index 3ff9bbfb0ac..7d6c9c66754 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateFork.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateFork.java @@ -59,6 +59,7 @@ public GetStateFork(final DataProvider dataProvider) { .pathParam(PARAMETER_STATE_ID) .response(SC_OK, "Request successful", RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build(), chainDataProvider); } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRandao.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRandao.java index 08f65303b32..29411997810 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRandao.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRandao.java @@ -80,6 +80,7 @@ private static EndpointMetadata createMetadata() { .queryParam(EPOCH_PARAMETER) .withNotFoundResponse() .response(SC_OK, "Request successful", responseType) + .withChainDataResponses() .build(); } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRoot.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRoot.java index 9a225284082..4843d7320e6 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRoot.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRoot.java @@ -55,6 +55,7 @@ public GetStateRoot(final DataProvider dataProvider) { .pathParam(PARAMETER_STATE_ID) .response(SC_OK, "Request successful", RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build(), chainDataProvider); } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateSyncCommittees.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateSyncCommittees.java index 92f0a0349c5..61dda4244a9 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateSyncCommittees.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateSyncCommittees.java @@ -78,6 +78,7 @@ public GetStateSyncCommittees(final ChainDataProvider chainDataProvider) { .queryParam(EPOCH_PARAMETER) .response(HttpStatusCodes.SC_OK, "Request successful", RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidator.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidator.java index a3cb1eaaf5f..cf77fae9400 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidator.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidator.java @@ -67,6 +67,7 @@ public GetStateValidator(final DataProvider dataProvider) { .tags(TAG_BEACON, TAG_VALIDATOR_REQUIRED) .response(SC_OK, "Request successful", RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = provider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorBalances.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorBalances.java index e8f9ca66e61..95a478d8902 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorBalances.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorBalances.java @@ -69,6 +69,7 @@ public GetStateValidatorBalances(final DataProvider dataProvider) { .queryListParam(ID_PARAMETER) .response(SC_OK, "Request successful", RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidators.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidators.java index b65dbb7116f..e6069ca1f8e 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidators.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidators.java @@ -59,6 +59,7 @@ public GetStateValidators(final DataProvider dataProvider) { .tags(TAG_BEACON) .response(SC_OK, "Request successful", STATE_VALIDATORS_RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = provider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidatorBalances.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidatorBalances.java index addd20d71da..dc081b53afb 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidatorBalances.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidatorBalances.java @@ -51,6 +51,7 @@ public PostStateValidatorBalances(final DataProvider dataProvider) { .requestBodyType(DeserializableTypeDefinition.listOf(STRING_TYPE)) .response(SC_OK, "Request successful", GetStateValidatorBalances.RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidators.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidators.java index af6274e8372..8ac822bd9b1 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidators.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidators.java @@ -59,6 +59,7 @@ public PostStateValidators(final DataProvider dataProvider) { .tags(TAG_BEACON) .response(SC_OK, "Request successful", STATE_VALIDATORS_RESPONSE_TYPE) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = provider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/lightclient/GetLightClientBootstrap.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/lightclient/GetLightClientBootstrap.java index f1e8d84bfc1..03c61594361 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/lightclient/GetLightClientBootstrap.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/lightclient/GetLightClientBootstrap.java @@ -67,6 +67,7 @@ public GetLightClientBootstrap( .withNotFoundResponse() .withNotAcceptedResponse() .withNotImplementedResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/builder/GetExpectedWithdrawals.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/builder/GetExpectedWithdrawals.java index b43ed1f218c..e6a6c2d3638 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/builder/GetExpectedWithdrawals.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/builder/GetExpectedWithdrawals.java @@ -74,6 +74,7 @@ protected GetExpectedWithdrawals( .response(SC_OK, "Request successful", getResponseType(schemaDefinitionCache)) .withNotFoundResponse() .withNotImplementedResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/debug/GetState.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/debug/GetState.java index 69fce29776a..64cf1df4b59 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/debug/GetState.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/debug/GetState.java @@ -80,6 +80,7 @@ public GetState( beaconState -> spec.getForkSchedule().getSpecMilestoneAtSlot(beaconState.getSlot()))) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/events/GetEvents.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/events/GetEvents.java index c075742dcda..44f13b3044a 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/events/GetEvents.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/events/GetEvents.java @@ -79,6 +79,7 @@ public GetEvents( .tags(TAG_EVENTS, TAG_VALIDATOR_REQUIRED) .queryParam(TOPICS_PARAMETER) .response(SC_OK, "Request successful", new EventStreamResponseContentTypeDefinition()) + .withChainDataResponses() .build()); eventSubscriptionManager = new EventSubscriptionManager( diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetAttestationRewards.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetAttestationRewards.java index ed3336545fe..d2ad41e971d 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetAttestationRewards.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetAttestationRewards.java @@ -107,6 +107,7 @@ public GetAttestationRewards(final ChainDataProvider chainDataProvider) { .withNotImplementedResponse() .withNotFoundResponse() .withInternalErrorResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetBlockRewards.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetBlockRewards.java index 231076c0266..39f84030f76 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetBlockRewards.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetBlockRewards.java @@ -73,6 +73,7 @@ public GetBlockRewards(final ChainDataProvider chainDataProvider) { .response(SC_OK, "Request successful", RESPONSE_TYPE) .withNotFoundResponse() .withInternalErrorResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetSyncCommitteeRewards.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetSyncCommitteeRewards.java index 78c350c8364..6696e737374 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetSyncCommitteeRewards.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetSyncCommitteeRewards.java @@ -86,6 +86,7 @@ public GetSyncCommitteeRewards(final ChainDataProvider chainDataProvider) { .response(SC_OK, "Request successful", RESPONSE_TYPE) .withNotFoundResponse() .withInternalErrorResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/PostValidatorLiveness.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/PostValidatorLiveness.java index 2aa42346952..962753deb9a 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/PostValidatorLiveness.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/PostValidatorLiveness.java @@ -79,6 +79,7 @@ public PostValidatorLiveness( .requestBodyType(DeserializableTypeDefinition.listOf(UINT64_TYPE, 1)) .response(SC_OK, "Successful Response", RESPONSE_TYPE) .withServiceUnavailableResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; this.nodeDataProvider = nodeDataProvider; diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlock.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlock.java index 677ee89e734..cac0ebdc4dc 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlock.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlock.java @@ -65,6 +65,7 @@ public GetBlock( getResponseType(schemaDefinitionCache), sszResponseType()) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlockAttestationsV2.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlockAttestationsV2.java index 81b15809640..a5e024cff12 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlockAttestationsV2.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlockAttestationsV2.java @@ -65,6 +65,7 @@ public GetBlockAttestationsV2( .pathParam(PARAMETER_BLOCK_ID) .response(SC_OK, "Request successful", getResponseType(schemaDefinitionCache)) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetChainHeadsV2.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetChainHeadsV2.java index 45304776547..cdefcf45dc2 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetChainHeadsV2.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetChainHeadsV2.java @@ -49,6 +49,7 @@ public GetChainHeadsV2(final ChainDataProvider chainDataProvider) { .description("Retrieves all possible chain heads (leaves of fork choice tree).") .tags(TAG_DEBUG) .response(SC_OK, "Success", responseType(CHAIN_HEAD_TYPE_V2)) + .withChainDataResponses() .build()); } } diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetState.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetState.java index 08e8295ae3d..b3de4e17916 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetState.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetState.java @@ -67,6 +67,7 @@ public GetState( getResponseType(schemaDefinitionCache), sszResponseType()) .withNotFoundResponse() + .withChainDataResponses() .build()); this.chainDataProvider = chainDataProvider; } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlobSidecarsAtSlotTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlobSidecarsAtSlotTest.java index 937357352ca..34324cc12e6 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlobSidecarsAtSlotTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlobSidecarsAtSlotTest.java @@ -20,9 +20,12 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.http.RestApiConstants.SLOT; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -94,4 +97,14 @@ void metadata_shouldHandle200() throws IOException { UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlocksAtSlotTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlocksAtSlotTest.java index 453503415e5..657302bc2d7 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlocksAtSlotTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetAllBlocksAtSlotTest.java @@ -20,10 +20,12 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.http.RestApiConstants.SLOT; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -93,4 +95,9 @@ void metadata_shouldHandle200() throws IOException { Resources.getResource(GetAllBlocksAtSlotTest.class, "getAllBlocksAtSlot.json"), UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1DataTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1DataTest.java index 5b3d06a1162..597a0d071a2 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1DataTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1DataTest.java @@ -20,8 +20,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -98,4 +101,14 @@ void metadata_shouldHandle200() throws JsonProcessingException { .isEqualTo( "{\"data\":{\"deposit_root\":\"0xd543a5c171f43007ec7a6871885a3faeb3fd8c4f5a810097508ffd301459aa22\",\"deposit_count\":\"20\",\"block_hash\":\"0xaf01b1c1315d727d01f5991ae1481614a7f78e2beeefae22f48c76a05f973b0d\"}}"); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1VotingSummaryTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1VotingSummaryTest.java index d5e94d948f1..d4433f06a6a 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1VotingSummaryTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetEth1VotingSummaryTest.java @@ -20,8 +20,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -116,4 +119,14 @@ void metadata_shouldHandle200() throws JsonProcessingException { .isEqualTo( "{\"data\":{\"state_eth1_data\":{\"deposit_root\":\"0xd543a5c171f43007ec7a6871885a3faeb3fd8c4f5a810097508ffd301459aa22\",\"deposit_count\":\"20\",\"block_hash\":\"0xaf01b1c1315d727d01f5991ae1481614a7f78e2beeefae22f48c76a05f973b0d\"},\"eth1_data_votes\":[{\"eth1_data\":{\"deposit_root\":\"0xd543a5c171f43007ec7a6871885a3faeb3fd8c4f5a810097508ffd301459aa22\",\"deposit_count\":\"20\",\"block_hash\":\"0xaf01b1c1315d727d01f5991ae1481614a7f78e2beeefae22f48c76a05f973b0d\"},\"votes\":\"20\"}],\"votes_required\":\"50\",\"voting_period_slots\":\"100\",\"voting_period_slots_left\":\"30\"}}"); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetFinalizedStateSlotBeforeTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetFinalizedStateSlotBeforeTest.java index 66ca751f557..e79b00dfded 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetFinalizedStateSlotBeforeTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetFinalizedStateSlotBeforeTest.java @@ -17,10 +17,12 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.http.RestApiConstants.SLOT; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -65,4 +67,9 @@ void metadata_shouldHandle200() throws IOException { final String expected = "{\"data\":\"1\"}"; assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetStateByBlockRootTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetStateByBlockRootTest.java index 83ad9d2c576..4e5faa2ee0c 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetStateByBlockRootTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/beacon/GetStateByBlockRootTest.java @@ -19,9 +19,12 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.http.RestApiConstants.PARAM_BLOCK_ID; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseSszFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -77,4 +80,14 @@ void metadata_shouldHandle200() throws IOException { final BeaconState expected = spec.deserializeBeaconState(Bytes.wrap(response)); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetGlobalValidatorInclusionTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetGlobalValidatorInclusionTest.java index 4aeb71d86f3..2c929f18fe9 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetGlobalValidatorInclusionTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetGlobalValidatorInclusionTest.java @@ -18,9 +18,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -87,4 +89,9 @@ void metadata_shouldHandle200() throws IOException { UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetValidatorInclusionTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetValidatorInclusionTest.java index a54d3334510..e9a625acffa 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetValidatorInclusionTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/tekuv1/validatorInclusion/GetValidatorInclusionTest.java @@ -18,9 +18,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -84,4 +86,9 @@ void metadata_shouldHandle200() throws IOException { UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlindedBlockTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlindedBlockTest.java index 98daf89144f..e276369273f 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlindedBlockTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlindedBlockTest.java @@ -18,8 +18,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -82,4 +85,14 @@ void metadata_shouldHandle200() throws IOException { Resources.getResource(GetBlindedBlockTest.class, "getBlindedBlock.json"), UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlobSidecarsTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlobSidecarsTest.java index 787dd4ef81f..2acdf9c00fe 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlobSidecarsTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlobSidecarsTest.java @@ -19,8 +19,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -96,4 +99,14 @@ void metadata_shouldHandle200() throws IOException { Resources.getResource(GetBlobSidecarsTest.class, "getBlobSidecars.json"), UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockAttestationsTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockAttestationsTest.java index 83ddf51ecda..9b41d858bf8 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockAttestationsTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockAttestationsTest.java @@ -18,8 +18,11 @@ import static org.mockito.Mockito.when; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -79,4 +82,14 @@ void metadata_shouldHandle200() throws IOException { UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeaderTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeaderTest.java index 6c39f0d66a4..86276eddf10 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeaderTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeaderTest.java @@ -17,8 +17,11 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -83,4 +86,14 @@ void metadata_shouldHandle200() throws IOException { Resources.getResource(GetBlockHeaderTest.class, "getBlockHeader.json"), UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeadersTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeadersTest.java index 00f253bf5ef..dd1673decde 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeadersTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockHeadersTest.java @@ -17,8 +17,11 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -82,4 +85,14 @@ private BlockAndMetaData generateBlockHeaderData() { return new BlockAndMetaData( dataStructureUtil.randomSignedBeaconBlock(1), SpecMilestone.PHASE0, true, true, false); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockRootTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockRootTest.java index 577407957a3..d998c1a6532 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockRootTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetBlockRootTest.java @@ -17,8 +17,11 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -83,4 +86,14 @@ void metadata_shouldHandle200() throws IOException { Resources.getResource(GetBlockRootTest.class, "getBlockRoot.json"), UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedBlockRootTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedBlockRootTest.java index 5a6df110be1..3a2d6e12a1b 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedBlockRootTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedBlockRootTest.java @@ -19,8 +19,11 @@ import static org.mockito.Mockito.when; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -73,4 +76,14 @@ void metadata_shouldHandle200() throws IOException { UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedCheckpointStateTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedCheckpointStateTest.java index ac4c0c5ce2f..b5077f4ae61 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedCheckpointStateTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetFinalizedCheckpointStateTest.java @@ -17,8 +17,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseSszFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -58,4 +61,14 @@ void metadata_shouldHandle200() throws IOException { final BeaconState expected = spec.deserializeBeaconState(Bytes.wrap(response)); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetGenesisTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetGenesisTest.java index 119753f8009..f0467aae3d0 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetGenesisTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetGenesisTest.java @@ -17,7 +17,9 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; @@ -96,4 +98,14 @@ void metadata_shouldHandle200() throws JsonProcessingException { "{\"data\":{\"genesis_time\":\"%s\",\"genesis_validators_root\":\"%s\",\"genesis_fork_version\":\"%s\"}}", genesisTime, genesisValidatorsRoot, fork)); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateFinalityCheckpointsTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateFinalityCheckpointsTest.java index 912150f44a3..7eb3f3c42d4 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateFinalityCheckpointsTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateFinalityCheckpointsTest.java @@ -17,8 +17,11 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -96,4 +99,14 @@ void metadata_shouldHandle200() throws IOException { assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateForkTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateForkTest.java index 7fe8dd34623..fe702ffc7f8 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateForkTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateForkTest.java @@ -17,8 +17,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -101,4 +104,14 @@ void metadata_shouldHandle200() throws JsonProcessingException { .isEqualTo( "{\"execution_optimistic\":false,\"finalized\":false,\"data\":{\"previous_version\":\"0x103ac940\",\"current_version\":\"0x6fdfab40\",\"epoch\":\"4658411424342975020\"}}"); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRandaoTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRandaoTest.java index 742879833d8..daf0ea36c4c 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRandaoTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRandaoTest.java @@ -17,8 +17,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -70,4 +73,14 @@ void metadata_shouldHandle200() throws IOException { randao); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRootTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRootTest.java index 332fe838cd5..a5f6bc758a0 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRootTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateRootTest.java @@ -16,8 +16,11 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -77,4 +80,14 @@ void metadata_shouldHandle200() throws IOException { responseData.getData().hashTreeRoot()); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateSyncCommitteesTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateSyncCommitteesTest.java index 1b1ca22d2e6..7ca0bed5632 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateSyncCommitteesTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateSyncCommitteesTest.java @@ -16,8 +16,11 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -96,4 +99,14 @@ void metadata_shouldHandle200() throws IOException { "{\"execution_optimistic\":false,\"finalized\":false,\"data\":{\"validators\":[\"2\",\"92\",\"37\"],\"validator_aggregates\":[[\"9\",\"89\"],[\"1\"]]}}"; assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorBalancesTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorBalancesTest.java index e735156d11c..4a0d54097e4 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorBalancesTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorBalancesTest.java @@ -18,8 +18,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -117,4 +120,14 @@ void metadata_shouldHandle200() throws IOException { UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorTest.java index 0e3106901a8..401307bec14 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorTest.java @@ -17,8 +17,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -114,4 +117,14 @@ void metadata_shouldHandle200() throws IOException { AssertionsForClassTypes.assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorsTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorsTest.java index 9d48b140a3d..e54c0740c27 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorsTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetStateValidatorsTest.java @@ -29,7 +29,9 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; @@ -208,4 +210,14 @@ private static Stream provideStatusParameters() { Arguments.of(List.of("exited"), Set.of(exited_slashed, exited_unslashed)), Arguments.of(List.of("withdrawal"), Set.of(withdrawal_done, withdrawal_possible))); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidatorBalancesTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidatorBalancesTest.java index ab78211cbda..a2e78f7e0fd 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidatorBalancesTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidatorBalancesTest.java @@ -18,8 +18,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -116,4 +119,14 @@ void metadata_shouldHandle200() throws IOException { UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidatorsTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidatorsTest.java index 065f237797f..69366db9f69 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidatorsTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/PostStateValidatorsTest.java @@ -29,7 +29,9 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; @@ -238,4 +240,14 @@ private static Stream provideStatusParameters() { Arguments.of(List.of("exited"), Set.of(exited_slashed, exited_unslashed)), Arguments.of(List.of("withdrawal"), Set.of(withdrawal_done, withdrawal_possible))); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/builder/GetExpectedWithdrawalsTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/builder/GetExpectedWithdrawalsTest.java index c7bafcb495a..b4a63c8b753 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/builder/GetExpectedWithdrawalsTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/builder/GetExpectedWithdrawalsTest.java @@ -19,8 +19,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_IMPLEMENTED; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -80,4 +83,14 @@ void metadata_shouldHandle200() throws IOException { UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/debug/GetStateTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/debug/GetStateTest.java index 957bdf1c0c1..baa6541ecf9 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/debug/GetStateTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/debug/GetStateTest.java @@ -20,8 +20,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -83,4 +86,14 @@ void metadata_shouldHandle200() throws IOException { Resources.toString(Resources.getResource(GetStateTest.class, "getState.json"), UTF_8); assertThat(data).isEqualTo(String.format(expected, responseData.getGenesisTime())); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetAttestationRewardsTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetAttestationRewardsTest.java index 9b87af01002..f28d673f2fb 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetAttestationRewardsTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetAttestationRewardsTest.java @@ -19,8 +19,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_IMPLEMENTED; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -94,4 +97,14 @@ void metadata_shouldHandle200() throws IOException { UTF_8); assertThat(data).isEqualTo(String.format(expected, responseData)); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetBlockRewardsTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetBlockRewardsTest.java index 790a2c35121..df35f4f41ad 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetBlockRewardsTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetBlockRewardsTest.java @@ -18,8 +18,11 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -88,4 +91,14 @@ void metadata_shouldHandle200() throws IOException { Resources.getResource(GetBlockRewardsTest.class, "blockRewardsData.json"), UTF_8); AssertionsForClassTypes.assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetSyncCommitteeRewardsTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetSyncCommitteeRewardsTest.java index 8c471d09808..dff45e47ceb 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetSyncCommitteeRewardsTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/rewards/GetSyncCommitteeRewardsTest.java @@ -18,8 +18,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -113,4 +116,14 @@ void metadata_shouldHandle200() throws IOException { UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/PostValidatorLivenessTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/PostValidatorLivenessTest.java index 83e218a063f..d670b6db96a 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/PostValidatorLivenessTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/PostValidatorLivenessTest.java @@ -17,10 +17,12 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getRequestBodyFromMetadata; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -73,4 +75,9 @@ void metadata_shouldHandle200() throws IOException { UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlockAttestationsV2Test.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlockAttestationsV2Test.java index b084ae0be2b..0379d57973c 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlockAttestationsV2Test.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlockAttestationsV2Test.java @@ -18,10 +18,13 @@ import static org.mockito.Mockito.when; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.http.RestApiConstants.HEADER_CONSENSUS_VERSION; import static tech.pegasys.teku.infrastructure.json.types.DeserializableTypeDefinition.listOf; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -170,4 +173,14 @@ private List parseAttestationsFromResponse( return List.of(); } } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlockTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlockTest.java index ed41dba15af..2afa215cbf6 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlockTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/GetBlockTest.java @@ -18,8 +18,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -81,4 +84,14 @@ void metadata_shouldHandle200() throws IOException { Resources.toString(Resources.getResource(GetBlockTest.class, "getBlock.json"), UTF_8); assertThat(data).isEqualTo(expected); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetChainHeadsV2Test.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetChainHeadsV2Test.java index cfddcf2dda2..e0162f148b3 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetChainHeadsV2Test.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetChainHeadsV2Test.java @@ -16,8 +16,11 @@ import static org.assertj.core.api.Assertions.assertThat; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; @@ -66,4 +69,14 @@ void shouldGetSuccessfulResponse() throws JsonProcessingException { assertThat(request.getResponseCode()).isEqualTo(SC_OK); assertThat(request.getResponseBody()).isEqualTo(protoNodeDataList); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } } diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetStateTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetStateTest.java index d4c0af892b8..ae46d432ec5 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetStateTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/debug/GetStateTest.java @@ -18,8 +18,11 @@ import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_FOUND; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; +import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.getResponseStringFromMetadata; +import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse; import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse; import static tech.pegasys.teku.spec.SpecMilestone.PHASE0; @@ -85,4 +88,14 @@ void metadata_shouldHandle200() throws IOException { Resources.toString(Resources.getResource(GetStateTest.class, "getState.json"), UTF_8); assertThat(data).isEqualTo(String.format(expected, responseData.getData().getGenesisTime())); } + + @Test + void metadata_shouldHandle204() { + verifyMetadataEmptyResponse(handler, SC_NO_CONTENT); + } + + @Test + void metadata_shouldHandle503() throws JsonProcessingException { + verifyMetadataErrorResponse(handler, SC_SERVICE_UNAVAILABLE); + } }