github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/scripts/generate-mock.sh (about) 1 #!/bin/bash 2 # Copyright 2022 PingCAP, Inc. 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 set -eu 16 17 cd "$(dirname "${BASH_SOURCE[0]}")"/.. 18 19 MOCKGEN="tools/bin/mockgen" 20 21 if [ ! -f "$MOCKGEN" ]; then 22 echo "${MOCKGEN} does not exist, please run 'make tools/bin/mockgen' first" 23 exit 1 24 fi 25 26 # CDC mock 27 "$MOCKGEN" -source cdc/owner/owner.go -destination cdc/owner/mock/owner_mock.go 28 "$MOCKGEN" -source cdc/controller/controller.go -destination cdc/controller/mock/controller_mock.go 29 "$MOCKGEN" -source cdc/owner/status_provider.go -destination cdc/owner/mock/status_provider_mock.go 30 "$MOCKGEN" -source cdc/api/v2/api_helpers.go -destination cdc/api/v2/api_helpers_mock.go -package v2 31 "$MOCKGEN" -source pkg/etcd/etcd.go -destination pkg/etcd/mock/etcd_client_mock.go 32 "$MOCKGEN" -source cdc/processor/manager.go -destination cdc/processor/mock/manager_mock.go 33 "$MOCKGEN" -source cdc/capture/capture.go -destination cdc/capture/mock/capture_mock.go 34 "$MOCKGEN" -source pkg/cmd/factory/factory.go -destination pkg/cmd/factory/mock/factory_mock.go -package mock_factory 35 "$MOCKGEN" -source cdc/processor/sourcemanager/sorter/engine.go -destination cdc/processor/sourcemanager/sorter/mock/engine_mock.go 36 "$MOCKGEN" -source pkg/api/v2/changefeed.go -destination pkg/api/v2/mock/changefeed_mock.go -package mock 37 "$MOCKGEN" -source pkg/api/v2/tso.go -destination pkg/api/v2/mock/tso_mock.go -package mock 38 "$MOCKGEN" -source pkg/api/v2/unsafe.go -destination pkg/api/v2/mock/unsafe_mock.go -package mock 39 "$MOCKGEN" -source pkg/api/v2/status.go -destination pkg/api/v2/mock/status_mock.go -package mock 40 "$MOCKGEN" -source pkg/api/v2/capture.go -destination pkg/api/v2/mock/capture_mock.go -package mock 41 "$MOCKGEN" -source pkg/api/v2/processor.go -destination pkg/api/v2/mock/processor_mock.go -package mock 42 "$MOCKGEN" -source pkg/sink/kafka/v2/client.go -destination pkg/sink/kafka/v2/mock/client_mock.go 43 "$MOCKGEN" -source pkg/sink/kafka/v2/gssapi.go -destination pkg/sink/kafka/v2/mock/gssapi_mock.go 44 "$MOCKGEN" -source pkg/sink/kafka/v2/writer.go -destination pkg/sink/kafka/v2/mock/writer_mock.go 45 "$MOCKGEN" -source pkg/sink/codec/simple/marshaller.go -destination pkg/sink/codec/simple/mock/marshaller.go 46 47 # DM mock 48 "$MOCKGEN" -package pbmock -destination dm/pbmock/dmmaster.go github.com/pingcap/tiflow/dm/pb MasterClient,MasterServer 49 "$MOCKGEN" -package pbmock -destination dm/pbmock/dmworker.go github.com/pingcap/tiflow/dm/pb WorkerClient,WorkerServer 50 51 # Engine mock 52 "$MOCKGEN" -package mock -destination engine/pkg/meta/mock/client_mock.go github.com/pingcap/tiflow/engine/pkg/meta/model KVClient 53 "$MOCKGEN" -package mock -destination engine/executor/server/mock/metastore_mock.go github.com/pingcap/tiflow/engine/executor/server MetastoreCreator 54 "$MOCKGEN" -package mock -destination engine/enginepb/mock/executor_mock.go github.com/pingcap/tiflow/engine/enginepb ExecutorServiceClient 55 "$MOCKGEN" -package mock -destination engine/enginepb/mock/broker_mock.go github.com/pingcap/tiflow/engine/enginepb BrokerServiceClient 56 "$MOCKGEN" -package mock -destination engine/enginepb/mock/resource_mock.go github.com/pingcap/tiflow/engine/enginepb ResourceManagerClient 57 "$MOCKGEN" -package mock -destination engine/pkg/httputil/mock/jobhttpclient_mock.go github.com/pingcap/tiflow/engine/pkg/httputil JobHTTPClient 58 "$MOCKGEN" -package mock -destination engine/servermaster/jobop/mock/joboperator_mock.go github.com/pingcap/tiflow/engine/servermaster/jobop JobOperator 59 "$MOCKGEN" -package mock -destination engine/pkg/orm/mock/client_mock.go github.com/pingcap/tiflow/engine/pkg/orm Client 60 "$MOCKGEN" -package mock -destination engine/servermaster/jobop/mock/backoffmanager_mock.go github.com/pingcap/tiflow/engine/servermaster/jobop BackoffManager 61 "$MOCKGEN" -package mock -source engine/pkg/rpcutil/checker.go -destination engine/pkg/rpcutil/mock/checker_mock.go 62 "$MOCKGEN" -package client -self_package github.com/pingcap/tiflow/engine/pkg/client \ 63 -destination engine/pkg/client/client_mock.go github.com/pingcap/tiflow/engine/pkg/client ExecutorClient,ServerMasterClient 64 65 # PKG mock 66 "$MOCKGEN" -package mock -destination pkg/election/mock/storage_mock.go github.com/pingcap/tiflow/pkg/election Storage 67 "$MOCKGEN" -package mock -destination pkg/election/mock/elector_mock.go github.com/pingcap/tiflow/pkg/election Elector