Skip to content

Commit

Permalink
Update mockgen (#11615)
Browse files Browse the repository at this point in the history
Co-authored-by: Radosław Kapka <[email protected]>
  • Loading branch information
nalepae and rkapka authored Nov 21, 2022
1 parent ee9da3a commit 0bcddb3
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 127 deletions.
50 changes: 41 additions & 9 deletions hack/update-mockgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,60 @@
# Use a space to separate mock destination from its interfaces.

mock_path="testing/mock"
proto_mocks=(

# github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1
# ------------------------------------------------------
proto_mocks_v1alpha1=(
"$mock_path/beacon_service_mock.go BeaconChainClient,BeaconChain_StreamChainHeadClient,BeaconChain_StreamAttestationsClient,BeaconChain_StreamBlocksClient,BeaconChain_StreamValidatorsInfoClient,BeaconChain_StreamIndexedAttestationsClient"
"$mock_path/beacon_chain_service_mock.go BeaconChain_StreamChainHeadServer,BeaconChain_StreamAttestationsServer,BeaconChain_StreamBlocksServer,BeaconChain_StreamValidatorsInfoServer,BeaconChain_StreamIndexedAttestationsServer"
"$mock_path/beacon_validator_server_mock.go BeaconNodeValidatorServer,BeaconNodeValidator_WaitForActivationServer,BeaconNodeValidator_WaitForChainStartServer,BeaconNodeValidator_StreamDutiesServer"
"$mock_path/beacon_validator_client_mock.go BeaconNodeValidatorClient,BeaconNodeValidator_WaitForChainStartClient,BeaconNodeValidator_WaitForActivationClient,BeaconNodeValidator_StreamDutiesClient"
"$mock_path/slasher_client_mock.go SlasherClient"
"$mock_path/event_service_mock.go EventsClient,Events_StreamEventsClient,Events_StreamEventsServer"
"$mock_path/node_service_mock.go NodeClient"
"$mock_path/keymanager_mock.go RemoteSignerClient"
)

iface_mocks=(
"$mock_path/validator_client_mock.go ValidatorClient"
for ((i = 0; i < ${#proto_mocks_v1alpha1[@]}; i++)); do
file=${proto_mocks_v1alpha1[i]% *};
interfaces=${proto_mocks_v1alpha1[i]#* };
echo "generating $file for interfaces: $interfaces";
echo
GO11MODULE=on mockgen -package=mock -destination="$file" github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1 "$interfaces"
done

# github.com/prysmaticlabs/prysm/v3/proto/eth/service
# ---------------------------------------------------
proto_mocks_service=(
"$mock_path/event_service_mock.go EventsClient,Events_StreamEventsClient,Events_StreamEventsServer"
)

for ((i = 0; i < ${#proto_mocks[@]}; i++)); do
file=${proto_mocks[i]% *};
interfaces=${proto_mocks[i]#* };
for ((i = 0; i < ${#proto_mocks_service[@]}; i++)); do
file=${proto_mocks_service[i]% *};
interfaces=${proto_mocks_service[i]#* };
echo "generating $file for interfaces: $interfaces";
GO11MODULE=on mockgen -package=mock -destination="$file" github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1 "$interfaces"
echo
GO11MODULE=on mockgen -package=mock -destination="$file" github.com/prysmaticlabs/prysm/v3/proto/eth/service "$interfaces"
done

# github.com/prysmaticlabs/prysm/proto/v3/prysm/v1alpha1/validator-client
# -----------------------------------------------------------------------
proto_mocks_v1alpha1_validator_clients=(
"$mock_path/keymanager_mock.go RemoteSignerClient"
)

for ((i = 0; i < ${#proto_mocks_v1alpha1_validator_clients[@]}; i++)); do
file=${proto_mocks_v1alpha1_validator_clients[i]% *};
interfaces=${proto_mocks_v1alpha1_validator_clients[i]#* };
echo "generating $file for interfaces: $interfaces";
echo
GO11MODULE=on mockgen -package=mock -destination="$file" github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1/validator-client "$interfaces"
done

# github.com/prysmaticlabs/prysm/v3/validator/client/iface
# --------------------------------------------------------
iface_mocks=(
"$mock_path/validator_client_mock.go ValidatorClient"
)

for ((i = 0; i < ${#iface_mocks[@]}; i++)); do
file=${iface_mocks[i]% *};
interfaces=${iface_mocks[i]#* };
Expand Down
2 changes: 1 addition & 1 deletion testing/mock/beacon_chain_service_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion testing/mock/beacon_service_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 21 additions & 41 deletions testing/mock/beacon_validator_client_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions testing/mock/beacon_validator_server_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0bcddb3

Please sign in to comment.