2019-02-03 05:13:16 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Script to update mock files after proto/beacon/rpc/v1/services.proto changes.
|
|
|
|
# Use a space to separate mock destination from its interfaces.
|
|
|
|
|
2020-05-15 17:27:46 +00:00
|
|
|
mock_path="shared/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"
|
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";
|
2020-05-15 17:27:46 +00:00
|
|
|
GO11MODULE=on mockgen -package=mock -destination=$file github.com/prysmaticlabs/ethereumapis/eth/v1alpha1 $interfaces
|
2020-07-10 05:49:56 +00:00
|
|
|
GO11MODULE=on mockgen -package=mock -destination=$file github.com/prysmaticlabs/prysm/proto/validator/accounts/v2 $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/."
|