mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 04:47:18 +00:00
9333ede9a1
* Add validator mocks to script * Add more mocks * Generate all the mocks for Ivan * Change script to use relative paths and gofmt * bazel * Remove duplicates * Remove duplicated interfaces * change to shared/mock * Fix script and build Co-authored-by: terence tsao <terence@prysmaticlabs.com>
24 lines
1.5 KiB
Bash
Executable File
24 lines
1.5 KiB
Bash
Executable File
#!/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.
|
|
|
|
mock_path="shared/mock"
|
|
mocks=(
|
|
"$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_WaitForSyncedServer,BeaconNodeValidator_WaitForActivationServer,BeaconNodeValidator_WaitForChainStartServer,BeaconNodeValidator_StreamDutiesServer"
|
|
"$mock_path/beacon_validator_client_mock.go BeaconNodeValidatorClient,BeaconNodeValidator_WaitForSyncedClient,BeaconNodeValidator_WaitForChainStartClient,BeaconNodeValidator_WaitForActivationClient,BeaconNodeValidator_StreamDutiesClient"
|
|
"$mock_path/node_service_mock.go NodeClient"
|
|
)
|
|
|
|
for ((i = 0; i < ${#mocks[@]}; i++)); do
|
|
file=${mocks[i]% *};
|
|
interfaces=${mocks[i]#* };
|
|
echo "generating $file for interfaces: $interfaces";
|
|
GO11MODULE=on mockgen -package=mock -destination=$file github.com/prysmaticlabs/ethereumapis/eth/v1alpha1 $interfaces
|
|
done
|
|
|
|
goimports -w "$mock_path/."
|
|
gofmt -s -w "$mock_path/."
|