diff --git a/build/ci/.test.yml b/build/ci/.test.yml index 2484f6a971dd5fcd6035e0d059ef19a86aa133b6..66afb034854df4e7c5dc5b36ba09a7ab5d2a7d5c 100644 --- a/build/ci/.test.yml +++ b/build/ci/.test.yml @@ -12,6 +12,7 @@ integration-test: - if: $CI_COMMIT_BRANCH == "integration-test" allow_failure: true script: + - sleep 1m - go test -race ./test/integration -v -coverprofile=coverage.out .test: &test diff --git a/nucleus/controller.go b/nucleus/controller.go index e8fb8413c499a85ae435c9c65a6c9474cf9f0cf5..4e96a290b394a596dd2568b73305f1f7a27f7dc8 100644 --- a/nucleus/controller.go +++ b/nucleus/controller.go @@ -47,7 +47,8 @@ func initialize() error { } // TODO: Start grpc listener here - + coreLock.Lock() + defer coreLock.Unlock() return httpAPI() } @@ -76,11 +77,9 @@ func createPrincipalNetworkDomain(sbi SouthboundInterface) error { // Run calls initialize to start the controller func Run(ctx context.Context) error { var initError error - coreLock.Lock() coreOnce.Do(func() { initError = initialize() }) - coreLock.Unlock() if initError != nil { log.WithFields(log.Fields{}).Error(initError) return initError @@ -100,5 +99,7 @@ func Run(ctx context.Context) error { func shutdown() error { log.Info("shutting down controller") + coreLock.Lock() + defer coreLock.Unlock() return stopHttpServer() } diff --git a/nucleus/http_test.go b/nucleus/http_test.go index 855838d73e04fb1e0acb8de121a9d179e5feaaac..9efa72110a1fe89cf1507424d147e7faac6fd71b 100644 --- a/nucleus/http_test.go +++ b/nucleus/http_test.go @@ -140,10 +140,12 @@ func Test_httpApi(t *testing.T) { wantErr: false, }, } + coreLock.Lock() if err := httpAPI(); err != nil { t.Errorf("httpApi() error = %v", err) return } + coreLock.Unlock() for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := http.Get(tt.request)