You've already forked sap-jenkins-library
mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-07-15 01:34:38 +02:00
Rewrite nexus 3 Integration Tests (#1902)
This commit adapts nexus 3 integration tests to our new docker-based framework of writing IT. It makes individual tests easier to read and debug. One significant change is that each test now spawns a separate Nexus instance, which requires more memory, but also isolates the tests better.
This commit is contained in:
@ -59,6 +59,7 @@ func givenThisContainer(t *testing.T, bundle IntegrationTestDockerExecRunnerBund
|
||||
Image: bundle.Image,
|
||||
User: bundle.User,
|
||||
Mounts: bundle.Mounts,
|
||||
Environment: bundle.Environment,
|
||||
Setup: bundle.Setup,
|
||||
ContainerName: containerName,
|
||||
}
|
||||
@ -90,7 +91,7 @@ func givenThisContainer(t *testing.T, bundle IntegrationTestDockerExecRunnerBund
|
||||
}
|
||||
if len(testRunner.Environment) > 0 {
|
||||
for envVarName, envVarValue := range testRunner.Environment {
|
||||
params = append(params, "--env", fmt.Sprintf("%s='%s'", envVarName, envVarValue))
|
||||
params = append(params, "--env", fmt.Sprintf("%s=%s", envVarName, envVarValue))
|
||||
}
|
||||
}
|
||||
params = append(params, testRunner.Image, "sleep", "2000")
|
||||
@ -151,11 +152,16 @@ func setupPiperBinary(t *testing.T, testRunner IntegrationTestDockerExecRunner,
|
||||
}
|
||||
|
||||
func (d *IntegrationTestDockerExecRunner) whenRunningPiperCommand(command string, parameters ...string) error {
|
||||
args := []string{"exec", "--workdir", "/project", d.ContainerName, "/bin/bash", "/piper-wrapper", "/piper", command}
|
||||
args := []string{"exec", "--workdir", "/project", d.ContainerName, "/bin/bash", "--login", "/piper-wrapper", "/piper", command}
|
||||
args = append(args, parameters...)
|
||||
return d.Runner.RunExecutable("docker", args...)
|
||||
}
|
||||
|
||||
func (d *IntegrationTestDockerExecRunner) runScriptInsideContainer(script string) error {
|
||||
args := []string{"exec", "--workdir", "/project", d.ContainerName, "/bin/bash", "--login", "-c", script}
|
||||
return d.Runner.RunExecutable("docker", args...)
|
||||
}
|
||||
|
||||
func (d *IntegrationTestDockerExecRunner) assertHasOutput(t *testing.T, want string) {
|
||||
buffer := new(bytes.Buffer)
|
||||
d.Runner.Stdout(buffer)
|
||||
|
Reference in New Issue
Block a user