Skip to content

Commit 573a1f3

Browse files
committed
🏃 Run tests with race detector enabled
1 parent bb96678 commit 573a1f3

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

hack/test-all.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ setup_envs
2222

2323
header_text "running go test"
2424

25-
# TODO(directxman12): enable the race detector once the LeaderElector race condition is resolved in client-go
26-
go test ${MOD_OPT} ./... -parallel 4
25+
go test -race ${MOD_OPT} ./... -parallel 4
2726

2827
header_text "running coverage"
2928

pkg/builder/controller_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"fmt"
2222
"strings"
23+
"sync/atomic"
2324

2425
. "github.com/onsi/ginkgo"
2526
. "github.com/onsi/gomega"
@@ -214,7 +215,7 @@ var _ = Describe("application", func() {
214215
var (
215216
deployPrctExecuted = false
216217
replicaSetPrctExecuted = false
217-
allPrctExecuted = 0
218+
allPrctExecuted = int64(0)
218219
)
219220

220221
deployPrct := predicate.Funcs{
@@ -246,7 +247,7 @@ var _ = Describe("application", func() {
246247
BeAssignableToTypeOf(&appsv1.ReplicaSet{}),
247248
))
248249

249-
allPrctExecuted++
250+
atomic.AddInt64(&allPrctExecuted, 1)
250251
return true
251252
},
252253
}

pkg/internal/testing/integration/internal/integration_tests/etcd_integration_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ var _ = Describe("Etcd", func() {
3939
}
4040

4141
Expect(etcd.Start()).To(Succeed())
42-
defer func() {
43-
Expect(etcd.Stop()).To(Succeed())
44-
}()
42+
Expect(etcd.Stop()).To(Succeed())
4543

4644
Expect(stderr.String()).NotTo(BeEmpty())
4745
})

pkg/internal/testing/integration/internal/process_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ var _ = Describe("Start method", func() {
216216
processState.StartTimeout = 1 * time.Second
217217

218218
Expect(processState.Start(stdout, stderr)).To(Succeed())
219+
Expect(processState.Session).Should(gexec.Exit())
219220

220221
Expect(stdout.String()).To(Equal("that is stdout\n"))
221222
Expect(stderr.String()).To(Equal("this is stderr\ni started\n"))

0 commit comments

Comments
 (0)