Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove data races from tests #2433

Merged
merged 1 commit into from
Apr 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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