1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/integration/integration_gitopsUpdateDeployment_test.go
Michael 2c04f0acad
(fix) gitopsUpdateDeployment - integration test for kustomize (#3572)
* (fix) gitopsUpdateDeployment - integration test for kustomize

Signed-off-by: Michael Sprauer <Michael.Sprauer@sap.com>

* (fix) test: dash login shell is "-l"

Signed-off-by: Michael Sprauer <Michael.Sprauer@sap.com>

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2022-02-25 16:38:02 +01:00

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`)
}