Skip to content
Snippets Groups Projects
Commit 20b5575e authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

Merge branch '93-runner-not-ready-for-networking' into 'develop'

Resolve "Runner not Ready for Networking"

See merge request cocsn/gosdn!127
parents 18ec4577 c9fa2eb2
No related branches found
No related tags found
2 merge requests!127Resolve "Runner not Ready for Networking",!90Develop
Pipeline #67504 failed
...@@ -12,6 +12,7 @@ integration-test: ...@@ -12,6 +12,7 @@ integration-test:
- if: $CI_COMMIT_BRANCH == "integration-test" - if: $CI_COMMIT_BRANCH == "integration-test"
allow_failure: true allow_failure: true
script: script:
- sleep 1m
- go test -race ./test/integration -v -coverprofile=coverage.out - go test -race ./test/integration -v -coverprofile=coverage.out
unit-test: unit-test:
......
...@@ -47,7 +47,8 @@ func initialize() error { ...@@ -47,7 +47,8 @@ func initialize() error {
} }
// TODO: Start grpc listener here // TODO: Start grpc listener here
coreLock.Lock()
defer coreLock.Unlock()
return httpAPI() return httpAPI()
} }
...@@ -76,11 +77,9 @@ func createPrincipalNetworkDomain(sbi SouthboundInterface) error { ...@@ -76,11 +77,9 @@ func createPrincipalNetworkDomain(sbi SouthboundInterface) error {
// Run calls initialize to start the controller // Run calls initialize to start the controller
func Run(ctx context.Context) error { func Run(ctx context.Context) error {
var initError error var initError error
coreLock.Lock()
coreOnce.Do(func() { coreOnce.Do(func() {
initError = initialize() initError = initialize()
}) })
coreLock.Unlock()
if initError != nil { if initError != nil {
log.WithFields(log.Fields{}).Error(initError) log.WithFields(log.Fields{}).Error(initError)
return initError return initError
...@@ -100,5 +99,7 @@ func Run(ctx context.Context) error { ...@@ -100,5 +99,7 @@ func Run(ctx context.Context) error {
func shutdown() error { func shutdown() error {
log.Info("shutting down controller") log.Info("shutting down controller")
coreLock.Lock()
defer coreLock.Unlock()
return stopHttpServer() return stopHttpServer()
} }
...@@ -137,10 +137,12 @@ func Test_httpApi(t *testing.T) { ...@@ -137,10 +137,12 @@ func Test_httpApi(t *testing.T) {
wantErr: false, wantErr: false,
}, },
} }
coreLock.Lock()
if err := httpAPI(); err != nil { if err := httpAPI(); err != nil {
t.Errorf("httpApi() error = %v", err) t.Errorf("httpApi() error = %v", err)
return return
} }
coreLock.Unlock()
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
got, err := http.Get(tt.request) got, err := http.Get(tt.request)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment