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