Skip to content

Commit

Permalink
Merge pull request #2433 from aledbf/tests-race
Browse files Browse the repository at this point in the history
Remove data races from tests
  • Loading branch information
k8s-ci-robot authored Apr 27, 2018
2 parents 108dfbf + a92bf82 commit 1086ec6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
12 changes: 2 additions & 10 deletions internal/ingress/controller/nginx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,10 @@ func TestConfigureDynamically(t *testing.T) {

}))

listener, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
t.Errorf("unexpected error listening on a random port: %v", err)
}
defer listener.Close()

port := listener.Addr().(*net.TCPAddr).Port

ts.Listener = listener
port := ts.Listener.Addr().(*net.TCPAddr).Port
defer ts.Close()

err = configureDynamically(commonConfig, port)
err := configureDynamically(commonConfig, port)
if err != nil {
t.Errorf("unexpected error posting dynamic configuration: %v", err)
}
Expand Down
15 changes: 0 additions & 15 deletions internal/ingress/controller/store/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ func TestStore(t *testing.T) {
if svc != nil {
t.Errorf("expected an Ingres but none returned")
}

updateCh.Close()
close(stopCh)
})

t.Run("should return one event for add, update and delete of ingress", func(t *testing.T) {
Expand Down Expand Up @@ -257,9 +254,6 @@ func TestStore(t *testing.T) {
if atomic.LoadUint64(&del) != 1 {
t.Errorf("expected 1 event of type Delete but %v occurred", del)
}

updateCh.Close()
close(stopCh)
})

t.Run("should not receive events from secret not referenced from ingress", func(t *testing.T) {
Expand Down Expand Up @@ -346,9 +340,6 @@ func TestStore(t *testing.T) {
if atomic.LoadUint64(&del) != 0 {
t.Errorf("expected 0 events of type Delete but %v occurred", del)
}

updateCh.Close()
close(stopCh)
})

t.Run("should receive events from secret referenced from ingress", func(t *testing.T) {
Expand Down Expand Up @@ -458,9 +449,6 @@ func TestStore(t *testing.T) {
if atomic.LoadUint64(&del) != 1 {
t.Errorf("expected 1 events of type Delete but %v occurred", del)
}

updateCh.Close()
close(stopCh)
})

t.Run("should create an ingress with a secret which does not exist", func(t *testing.T) {
Expand Down Expand Up @@ -604,9 +592,6 @@ func TestStore(t *testing.T) {
t.Errorf("SHA of secret on disk differs from local secret store (%v != %v)", pemSHA, sslCert.PemSHA)
}
})

updateCh.Close()
close(stopCh)
})

// test add ingress with secret it doesn't exists and then add secret
Expand Down

0 comments on commit 1086ec6

Please sign in to comment.