Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
feature: add mock mgr for the convenience of testing
Browse files Browse the repository at this point in the history
Signed-off-by: Starnop <starnop@163.com>
  • Loading branch information
starnop committed Apr 18, 2019
1 parent 20f8a4a commit 3c6bfd3
Show file tree
Hide file tree
Showing 12 changed files with 1,688 additions and 0 deletions.
25 changes: 25 additions & 0 deletions hack/generate-super-mock-mgr.sh
@@ -0,0 +1,25 @@
#!/bin/bash
set -e

# This script is used to generate mock files for interfaces.

# Get the absolute path of this file
DIR="$( cd "$( dirname "$0" )" && pwd )"/..
cd "$DIR"

# install mockgen if it not exists
mockgen -h >/dev/null 2>&1 || go get github.com/golang/mock/mockgen
# install goimports if it not exists
goimports -h >/dev/null 2>&1 || go get golang.org/x/tools/cmd/goimports


# generate mock files for supernode mgr interfaces.
MGR_ARRAY=("cdn_mgr" "dfget_task_mgr" "peer_mgr" "progress_mgr" "scheduler_mgr")
for name in "${MGR_ARRAY[@]}"
do
mockgen -destination "./supernode/daemon/mgr/mock/mock_$name.go" -source "supernode/daemon/mgr/$name.go" -package mock
goimports -w --local "github.com/dragonflyoss/Dragonfly" "./supernode/daemon/mgr/mock"
echo "Mock file ./supernode/daemon/mgr/mock/mock_$name.go generated successfully for $name"
done


80 changes: 80 additions & 0 deletions supernode/daemon/mgr/mock/mock_cdn_mgr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

109 changes: 109 additions & 0 deletions supernode/daemon/mgr/mock/mock_dfget_task_mgr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 97 additions & 0 deletions supernode/daemon/mgr/mock/mock_peer_mgr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3c6bfd3

Please sign in to comment.