mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-26 23:38:31 +00:00
Merge pull request #1555 from liubin/fix/1554-install-hook-before-test
test: install mock hook binary before test
This commit is contained in:
commit
b58fb25d88
@ -597,7 +597,14 @@ generate-config: $(CONFIGS)
|
|||||||
|
|
||||||
check: check-go-static
|
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: $(GENERATED_FILES)
|
||||||
go test -v -mod=vendor ./...
|
go test -v -mod=vendor ./...
|
||||||
@ -659,7 +666,8 @@ show-usage: show-header
|
|||||||
@printf "• Additional targets:\n"
|
@printf "• Additional targets:\n"
|
||||||
@printf "\n"
|
@printf "\n"
|
||||||
@printf "\tbuild : standard build (build everything).\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 "\tclean : remove built files.\n"
|
||||||
@printf "\tcontainerd-shim-v2 : only build containerd shim v2.\n"
|
@printf "\tcontainerd-shim-v2 : only build containerd shim v2.\n"
|
||||||
@printf "\tcoverage : run coverage tests.\n"
|
@printf "\tcoverage : run coverage tests.\n"
|
||||||
|
@ -12,7 +12,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
ktu "github.com/kata-containers/kata-containers/src/runtime/pkg/katatestutils"
|
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/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
@ -25,11 +24,7 @@ var testBinHookPath = "/usr/bin/virtcontainers/bin/test/hook"
|
|||||||
var testBundlePath = "/test/bundle"
|
var testBundlePath = "/test/bundle"
|
||||||
|
|
||||||
func getMockHookBinPath() string {
|
func getMockHookBinPath() string {
|
||||||
if DefaultMockHookBinPath == "" {
|
|
||||||
return testBinHookPath
|
return testBinHookPath
|
||||||
}
|
|
||||||
|
|
||||||
return DefaultMockHookBinPath
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func createHook(timeout int) specs.Hook {
|
func createHook(timeout int) specs.Hook {
|
||||||
|
@ -18,9 +18,6 @@ import (
|
|||||||
pb "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols/grpc"
|
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"
|
var testKataMockHybridVSockURLTempl = "mock://%s/kata-mock-hybrid-vsock.sock"
|
||||||
|
|
||||||
func GenerateKataMockHybridVSock() (string, error) {
|
func GenerateKataMockHybridVSock() (string, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user