1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/integration/integration_gitops_test.go
Alexey Matvievsky e5f2f1414e
Improve integration tests (#4019)
Improve integration tests
2022-09-19 14:47:13 +04:00

39 lines
1.3 KiB
Go

//go:build integration
// +build integration
// can be executed with
// go test -v -tags integration -run TestGitOpsIntegration ./integration/...
package main
import (
"testing"
)
func TestGitOpsIntegrationUpdateDeployment(t *testing.T) {
container := givenThisContainer(t, IntegrationTestDockerExecRunnerBundle{
Image: "nekottyo/kustomize-kubeval:kustomizev4",
TestDir: []string{"testdata", "TestGitopsUpdateIntegration", "kustomize", "workdir"},
Mounts: map[string]string{"./testdata/TestGitopsUpdateIntegration/kustomize/gitopsRepo": "/gitopsRepo-source"},
Setup: []string{"cp -r /gitopsRepo-source /gitopsRepo"},
})
defer container.terminate(t)
err := container.whenRunningPiperCommand("gitopsUpdateDeployment", "--containerImageNameTag=image:456")
if err != nil {
t.Fatalf("Calling piper command failed %s\n", err)
}
err = container.Runner.RunExecutable("docker", "exec", container.ContainerName, "git", "clone", "/gitopsRepo", "/tmp/repo")
if err != nil {
t.Fatalf("Cloing of bare repo failed")
}
container.assertHasOutput(t, "SUCCESS", "[kustomize] updating")
container.assertFileContentEquals(t, "/tmp/repo/kustomization.yaml", `images:
- name: test-project
newName: image
newTag: "456"
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization`)
}