2019-02-03 05:13:16 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-07-28 21:23:44 +00:00
|
|
|
# Script to update mock files after proto/prysm/v1alpha1/services.proto changes.
|
2019-02-03 05:13:16 +00:00
|
|
|
# Use a space to separate mock destination from its interfaces.
|
|
|
|
|
2021-09-29 21:25:45 +00:00
|
|
|
mock_path="testing/mock"
|
2019-03-24 00:46:25 +00:00
|
|
|
mocks=(
|
2020-05-15 17:27:46 +00:00
|
|
|
"$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"
|
2020-11-17 02:48:16 +00:00
|
|
|
"$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"
|
2021-09-29 21:25:45 +00:00
|
|
|
"$mock_path/slasher_client_mock.go SlasherClient"
|
2021-06-14 16:58:08 +00:00
|
|
|
"$mock_path/event_service_mock.go EventsClient,Events_StreamEventsClient,Events_StreamEventsServer"
|
2020-05-14 22:11:52 +00:00
|
|
|
"$mock_path/node_service_mock.go NodeClient"
|
2020-07-10 05:49:56 +00:00
|
|
|
"$mock_path/keymanager_mock.go RemoteSignerClient"
|
2020-05-14 22:11:52 +00:00
|
|
|
)
|
2019-02-03 05:13:16 +00:00
|
|
|
|
|
|
|
for ((i = 0; i < ${#mocks[@]}; i++)); do
|
|
|
|
file=${mocks[i]% *};
|
|
|
|
interfaces=${mocks[i]#* };
|
|
|
|
echo "generating $file for interfaces: $interfaces";
|
2021-07-21 21:34:07 +00:00
|
|
|
GO11MODULE=on mockgen -package=mock -destination="$file" github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1 "$interfaces"
|
2019-03-24 00:46:25 +00:00
|
|
|
done
|
2020-05-15 17:27:46 +00:00
|
|
|
|
|
|
|
goimports -w "$mock_path/."
|
|
|
|
gofmt -s -w "$mock_path/."
|
2021-09-29 21:25:45 +00:00
|
|
|
|