mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-02-07 13:42:23 +02:00
39 lines
1.3 KiB
Go
39 lines
1.3 KiB
Go
|
//go:build integration
|
||
|
// +build integration
|
||
|
|
||
|
// can be execute with go test -tags=integration ./integration/...
|
||
|
|
||
|
package main
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestGitopsUpdateDeploymentIT(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")
|
||
|
container.assertHasOutput(t, "[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`)
|
||
|
}
|