-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #268 from gocardless/CI-1658
CI-1658: Upgrade theatre to be compatible with k8s 1.22
- Loading branch information
Showing
47 changed files
with
5,172 additions
and
1,529 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ version: 2 | |
references: | ||
docker_golang: &docker_golang | ||
docker: | ||
- image: golang:1.17.3 | ||
- image: golang:1.19.3 | ||
working_directory: /go/src/github.com/gocardless/theatre | ||
|
||
jobs: | ||
|
@@ -44,14 +44,14 @@ jobs: | |
name: Install ginkgo test runner | ||
command: go install github.com/onsi/ginkgo/[email protected] | ||
- run: | ||
name: Install Kubebuilder test helpers | ||
name: Install envtest binaries for k8s 1.22.x | ||
command: | | ||
mkdir /usr/local/kubebuilder | ||
curl -fsL https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_linux_amd64.tar.gz \ | ||
| tar -xvz --strip=1 -C /usr/local/kubebuilder | ||
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest | ||
setup-envtest use -p path 1.22.x | ||
- run: | ||
name: Run tests | ||
command: | | ||
source <(setup-envtest use -i -p env 1.22.x) | ||
ginkgo -race -randomizeSuites -randomizeAllSpecs -r -v ./... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
golang 1.19.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,12 @@ bin/%.darwin_amd64: | |
bin/%: | ||
CGO_ENABLED=0 GOARCH=amd64 $(BUILD_COMMAND) -o $@ ./cmd/$*/. | ||
|
||
# Run the below commands in order to install the required dependencies for | ||
# running `make test` locally. | ||
# go install github.com/onsi/ginkgo/[email protected] | ||
# go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest | ||
# setup-envtest use -p path 1.22.x | ||
# source <(setup-envtest use -i -p env 1.22.x) | ||
test: | ||
ginkgo -race -r ./... | ||
|
||
|
@@ -78,7 +83,7 @@ ifeq (, $(shell which controller-gen)) | |
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\ | ||
cd $$CONTROLLER_GEN_TMP_DIR ;\ | ||
go mod init tmp ;\ | ||
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.5.0 ;\ | ||
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.10.0 ;\ | ||
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\ | ||
} | ||
CONTROLLER_GEN=$(GOBIN)/controller-gen | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.10.0 | ||
4.0.0 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,6 @@ import ( | |
var ( | ||
mgr ctrl.Manager | ||
testEnv *envtest.Environment | ||
|
||
finished = make(chan struct{}) | ||
) | ||
|
||
func TestSuite(t *testing.T) { | ||
|
@@ -34,24 +32,24 @@ func TestSuite(t *testing.T) { | |
RunSpecs(t, "apis/workloads/v1alpha1") | ||
} | ||
|
||
var _ = BeforeSuite(func(done Done) { | ||
logf.SetLogger(zap.LoggerTo(GinkgoWriter, true)) | ||
var _ = BeforeSuite(func() { | ||
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) | ||
|
||
By("bootstrapping test environment") | ||
testEnv = &envtest.Environment{ | ||
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "..", "config", "base", "crds")}, | ||
WebhookInstallOptions: envtest.WebhookInstallOptions{ | ||
DirectoryPaths: []string{filepath.Join("..", "..", "..", "..", "config", "base", "webhooks")}, | ||
Paths: []string{filepath.Join("..", "..", "..", "..", "config", "base", "webhooks")}, | ||
}, | ||
} | ||
|
||
cfg, err := testEnv.Start() | ||
Expect(err).ToNot(HaveOccurred()) | ||
Expect(cfg).ToNot(BeNil()) | ||
|
||
cfg.Impersonate = rest.ImpersonationConfig{ | ||
UserName: "[email protected]", | ||
} | ||
user, err := testEnv.AddUser(envtest.User{Name: "[email protected]"}, &rest.Config{}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
Expect(user).ToNot(BeNil()) | ||
|
||
scheme := runtime.NewScheme() | ||
err = clientgoscheme.AddToScheme(scheme) | ||
|
@@ -80,23 +78,13 @@ var _ = BeforeSuite(func(done Done) { | |
}, | ||
) | ||
|
||
go func() { | ||
<-ctrl.SetupSignalHandler() | ||
close(finished) | ||
}() | ||
|
||
go func() { | ||
defer GinkgoRecover() | ||
err = mgr.Start(finished) | ||
err = mgr.Start(ctrl.SetupSignalHandler()) | ||
Expect(err).ToNot(HaveOccurred(), "failed to run manager") | ||
gexec.KillAndWait(4 * time.Second) | ||
err := testEnv.Stop() | ||
Expect(err).ToNot(HaveOccurred()) | ||
}() | ||
|
||
close(done) | ||
}, 60) | ||
|
||
var _ = AfterSuite(func() { | ||
close(finished) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.