Merge pull request #1555 from liubin/fix/1554-install-hook-before-test

test: install mock hook binary before test
This commit is contained in:
Tim Zhang 2021-03-30 14:01:56 +08:00 committed by GitHub
commit b58fb25d88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View File

@ -597,7 +597,14 @@ generate-config: $(CONFIGS)
check: check-go-static
test: go-test
test: install-hook go-test
install-hook:
make -C virtcontainers hook
ifeq ($(shell id -u), 0)
echo "installing mock hook"
make -C virtcontainers install
endif
go-test: $(GENERATED_FILES)
go test -v -mod=vendor ./...
@ -659,7 +666,8 @@ show-usage: show-header
@printf "• Additional targets:\n"
@printf "\n"
@printf "\tbuild : standard build (build everything).\n"
@printf "\tcheck : run tests.\n"
@printf "\ttest : run tests.\n"
@printf "\tcheck : run code checks.\n"
@printf "\tclean : remove built files.\n"
@printf "\tcontainerd-shim-v2 : only build containerd shim v2.\n"
@printf "\tcoverage : run coverage tests.\n"

View File

@ -12,7 +12,6 @@ import (
"testing"
ktu "github.com/kata-containers/kata-containers/src/runtime/pkg/katatestutils"
. "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/mock"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/stretchr/testify/assert"
)
@ -25,11 +24,7 @@ var testBinHookPath = "/usr/bin/virtcontainers/bin/test/hook"
var testBundlePath = "/test/bundle"
func getMockHookBinPath() string {
if DefaultMockHookBinPath == "" {
return testBinHookPath
}
return DefaultMockHookBinPath
return testBinHookPath
}
func createHook(timeout int) specs.Hook {

View File

@ -18,9 +18,6 @@ import (
pb "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols/grpc"
)
// DefaultMockHookBinPath is populated at link time.
var DefaultMockHookBinPath string
var testKataMockHybridVSockURLTempl = "mock://%s/kata-mock-hybrid-vsock.sock"
func GenerateKataMockHybridVSock() (string, error) {