From 053b1e660b817a51333be3d54682a67ea2216447 Mon Sep 17 00:00:00 2001 From: liqingping Date: Tue, 25 Jan 2022 16:51:25 +0800 Subject: [PATCH] test: server test error --- Makefile | 2 +- pkg/server/suite_test.go | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 244f227..7aca9e6 100644 --- a/Makefile +++ b/Makefile @@ -87,7 +87,7 @@ lint: test: ginkgo ## Run tests. $(GINKGO) -nodes 4 -v -cover -coverprofile=coverage.out ./pkg/... go tool cover -func=./pkg/controllers/coverage.out - go tool cover -func=./pkg/server/http/coverage.out + go tool cover -func=./pkg/server/coverage.out go tool cover -func=./pkg/common/gpuallocator/coverage.out ##@ Build diff --git a/pkg/server/suite_test.go b/pkg/server/suite_test.go index c03d983..7a08afb 100644 --- a/pkg/server/suite_test.go +++ b/pkg/server/suite_test.go @@ -77,7 +77,7 @@ var _ = BeforeSuite(func() { By("bootstrapping test environment") testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, + CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")}, ErrorIfCRDPathMissing: true, } @@ -110,16 +110,19 @@ var _ = BeforeSuite(func() { fmt.Printf("node: %s added to cluster\n", node.Name) } + metricPort := config.GinkgoConfig.ParallelNode + 8200 + metricAddress := fmt.Sprintf(":%d", metricPort) mgr, err := ctrl.NewManager(cfg, ctrl.Options{ - Scheme: scheme.Scheme, + Scheme: scheme.Scheme, + MetricsBindAddress: metricAddress, }) Expect(err).NotTo(HaveOccurred()) ctx := dicontext.NewContext(context.Background(), cfg, mgr.GetClient(), - mgr.GetEventRecorderFor("di-operator"), - ctrl.Log.WithName("di-operator")) + mgr.GetEventRecorderFor("di-server"), + ctrl.Log.WithName("di-server")) localServingPort = port + config.GinkgoConfig.ParallelNode addrPort := fmt.Sprintf("%s:%d", localServingHost, localServingPort) -- GitLab