Skip to content

Commit

Permalink
Merge pull request #2602 from chinaran/fix/suite-test-global-cfg
Browse files Browse the repository at this point in the history
🐛 fix: suite test using global cfg and update docs
  • Loading branch information
k8s-ci-robot authored Apr 7, 2022
2 parents bb9cbb5 + dff39ef commit 10ce817
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ var _ = BeforeSuite(func() {
},
}

cfg, err := testEnv.Start()
var err error
// cfg is defined in this file globally.
cfg, err = testEnv.Start()
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ var _ = BeforeSuite(func() {
/*
Then, we start the envtest cluster.
*/
cfg, err := testEnv.Start()
var err error
// cfg is defined in this file globally.
cfg, err = testEnv.Start()
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ var _ = BeforeSuite(func() {
},
}

cfg, err := testEnv.Start()
var err error
// cfg is defined in this file globally.
cfg, err = testEnv.Start()
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ var _ = BeforeSuite(func() {
},
}

cfg, err := testEnv.Start()
var err error
// cfg is defined in this file globally.
cfg, err = testEnv.Start()
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ var _ = BeforeSuite(func() {
ErrorIfCRDPathMissing: true,
}

cfg, err := testEnv.Start()
var err error
// cfg is defined in this file globally.
cfg, err = testEnv.Start()
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ var _ = BeforeSuite(func() {
},
}
cfg, err := testEnv.Start()
var err error
// cfg is defined in this file globally.
cfg, err = testEnv.Start()
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())
Expand Down
4 changes: 3 additions & 1 deletion testdata/project-v3-config/api/v1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ var _ = BeforeSuite(func() {
},
}

cfg, err := testEnv.Start()
var err error
// cfg is defined in this file globally.
cfg, err = testEnv.Start()
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ var _ = BeforeSuite(func() {
},
}

cfg, err := testEnv.Start()
var err error
// cfg is defined in this file globally.
cfg, err = testEnv.Start()
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ var _ = BeforeSuite(func() {
},
}

cfg, err := testEnv.Start()
var err error
// cfg is defined in this file globally.
cfg, err = testEnv.Start()
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ var _ = BeforeSuite(func() {
},
}

cfg, err := testEnv.Start()
var err error
// cfg is defined in this file globally.
cfg, err = testEnv.Start()
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

Expand Down
4 changes: 3 additions & 1 deletion testdata/project-v3-multigroup/apis/v1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ var _ = BeforeSuite(func() {
},
}

cfg, err := testEnv.Start()
var err error
// cfg is defined in this file globally.
cfg, err = testEnv.Start()
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

Expand Down
4 changes: 3 additions & 1 deletion testdata/project-v3-v1beta1/api/v1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ var _ = BeforeSuite(func() {
},
}

cfg, err := testEnv.Start()
var err error
// cfg is defined in this file globally.
cfg, err = testEnv.Start()
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

Expand Down
4 changes: 3 additions & 1 deletion testdata/project-v3/api/v1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ var _ = BeforeSuite(func() {
},
}

cfg, err := testEnv.Start()
var err error
// cfg is defined in this file globally.
cfg, err = testEnv.Start()
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

Expand Down

0 comments on commit 10ce817

Please sign in to comment.