Skip to content

Commit c4a171f

Browse files
authored
Merge pull request #572 from shaneutt/master
Remove race condition from templated StartTestManager
2 parents a085eb8 + eff8a42 commit c4a171f

File tree

83 files changed

+116
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+116
-92
lines changed

pkg/scaffold/controller/controllersuitetest.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ func SetupTestReconcile(inner reconcile.Reconciler) (reconcile.Reconciler, chan
9696
func StartTestManager(mgr manager.Manager, g *gomega.GomegaWithT) (chan struct{}, *sync.WaitGroup) {
9797
stop := make(chan struct{})
9898
wg := &sync.WaitGroup{}
99+
wg.Add(1)
99100
go func() {
100-
wg.Add(1)
101+
defer wg.Done()
101102
g.Expect(mgr.Start(stop)).NotTo(gomega.HaveOccurred())
102-
wg.Done()
103103
}()
104104
return stop, wg
105105
}

pkg/scaffold/project/project_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var _ = Describe("Project", func() {
3232
})
3333

3434
It("should match the golden file", func() {
35-
instance := &Boilerplate{Year: "2018", License: "apache2", Owner: "The Kubernetes authors"}
35+
instance := &Boilerplate{Year: "2019", License: "apache2", Owner: "The Kubernetes authors"}
3636
Expect(s.Execute(input.Options{}, instance)).NotTo(HaveOccurred())
3737
Expect(result.Actual.String()).To(BeEquivalentTo(result.Golden))
3838
})
@@ -45,15 +45,15 @@ var _ = Describe("Project", func() {
4545

4646
Context("for apache2", func() {
4747
It("should write the apache2 boilerplate with specified owners", func() {
48-
instance := &Boilerplate{Year: "2018", Owner: "Example Owners"}
48+
instance := &Boilerplate{Year: "2019", Owner: "Example Owners"}
4949
Expect(s.Execute(input.Options{}, instance)).NotTo(HaveOccurred())
5050
e := strings.Replace(
5151
result.Golden, "The Kubernetes authors", "Example Owners", -1)
5252
Expect(result.Actual.String()).To(BeEquivalentTo(e))
5353
})
5454

5555
It("should use apache2 as the default", func() {
56-
instance := &Boilerplate{Year: "2018", Owner: "The Kubernetes authors"}
56+
instance := &Boilerplate{Year: "2019", Owner: "The Kubernetes authors"}
5757
Expect(s.Execute(input.Options{}, instance)).NotTo(HaveOccurred())
5858
Expect(result.Actual.String()).To(BeEquivalentTo(result.Golden))
5959
})

test/project/cmd/manager/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018 The Kubernetes authors.
2+
Copyright 2019 The Kubernetes authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

test/project/config/crds/creatures_v2alpha1_kraken.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ spec:
1515
openAPIV3Schema:
1616
properties:
1717
apiVersion:
18+
description: 'APIVersion defines the versioned schema of this representation
19+
of an object. Servers should convert recognized schemas to the latest
20+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
1821
type: string
1922
kind:
23+
description: 'Kind is a string value representing the REST resource this
24+
object represents. Servers may infer this from the endpoint the client
25+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
2026
type: string
2127
metadata:
2228
type: object

test/project/config/crds/crew_v1_firstmate.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ spec:
1515
openAPIV3Schema:
1616
properties:
1717
apiVersion:
18+
description: 'APIVersion defines the versioned schema of this representation
19+
of an object. Servers should convert recognized schemas to the latest
20+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
1821
type: string
1922
kind:
23+
description: 'Kind is a string value representing the REST resource this
24+
object represents. Servers may infer this from the endpoint the client
25+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
2026
type: string
2127
metadata:
2228
type: object

test/project/config/crds/policy_v1beta1_healthcheckpolicy.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ spec:
1515
openAPIV3Schema:
1616
properties:
1717
apiVersion:
18+
description: 'APIVersion defines the versioned schema of this representation
19+
of an object. Servers should convert recognized schemas to the latest
20+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
1821
type: string
1922
kind:
23+
description: 'Kind is a string value representing the REST resource this
24+
object represents. Servers may infer this from the endpoint the client
25+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
2026
type: string
2127
metadata:
2228
type: object

test/project/config/crds/ship_v1beta1_frigate.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ spec:
1515
openAPIV3Schema:
1616
properties:
1717
apiVersion:
18+
description: 'APIVersion defines the versioned schema of this representation
19+
of an object. Servers should convert recognized schemas to the latest
20+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
1821
type: string
1922
kind:
23+
description: 'Kind is a string value representing the REST resource this
24+
object represents. Servers may infer this from the endpoint the client
25+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
2026
type: string
2127
metadata:
2228
type: object

test/project/hack/boilerplate.go.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018 The Kubernetes authors.
2+
Copyright 2019 The Kubernetes authors.
33

44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

test/project/pkg/apis/addtoscheme_creatures_v2alpha1.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018 The Kubernetes authors.
2+
Copyright 2019 The Kubernetes authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

test/project/pkg/apis/addtoscheme_crew_v1.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018 The Kubernetes authors.
2+
Copyright 2019 The Kubernetes authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)