1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-03-03 15:02:35 +02:00

fixed order of mount path and name

This commit is contained in:
Sascha Vornheder 2019-11-18 09:16:12 +01:00
parent ad6934098a
commit 1da0f8d064
2 changed files with 7 additions and 7 deletions

View File

@ -321,7 +321,7 @@ func envVarsAsStringSlice(envVars []EnvVar) []string {
func volumeMountsAsStringSlice(volumeMounts []VolumeMount) []string {
e := []string{}
for _, v := range volumeMounts {
e = append(e, fmt.Sprintf("%v:%v", v.MountPath, v.Name))
e = append(e, fmt.Sprintf("%v:%v", v.Name, v.MountPath))
}
return e
}

View File

@ -339,8 +339,8 @@ func TestGetContextDefaults(t *testing.T) {
Shell: "/bin/bash",
WorkingDir: "/test/dir",
VolumeMounts: []VolumeMount{
{MountPath: "vbn1", Name: "vbv1"},
{MountPath: "vbn2", Name: "vbv2"},
{MountPath: "mp1", Name: "mn1"},
{MountPath: "mp2", Name: "mn2"},
},
},
},
@ -357,8 +357,8 @@ func TestGetContextDefaults(t *testing.T) {
ReadyCommand: "/sidecar/command",
WorkingDir: "/sidecar/dir",
VolumeMounts: []VolumeMount{
{MountPath: "vbn3", Name: "vbv3"},
{MountPath: "vbn4", Name: "vbv4"},
{MountPath: "mp3", Name: "mn3"},
{MountPath: "mp4", Name: "mn4"},
},
},
},
@ -387,7 +387,7 @@ func TestGetContextDefaults(t *testing.T) {
assert.Equal(t, "testcontainer", d.Defaults[0].Steps["testStep"]["dockerName"], "dockerName default not available")
assert.Equal(t, true, d.Defaults[0].Steps["testStep"]["dockerPullImage"], "dockerPullImage default not available")
assert.Equal(t, "/test/dir", d.Defaults[0].Steps["testStep"]["dockerWorkspace"], "dockerWorkspace default not available")
assert.Equal(t, []interface{}{"vbn1:vbv1", "vbn2:vbv2"}, d.Defaults[0].Steps["testStep"]["dockerVolumeBind"], "dockerVolumeBind default not available")
assert.Equal(t, []interface{}{"mn1:mp1", "mn2:mp2"}, d.Defaults[0].Steps["testStep"]["dockerVolumeBind"], "dockerVolumeBind default not available")
assert.Equal(t, "/sidecar/command", d.Defaults[0].Steps["testStep"]["sidecarCommand"], "sidecarCommand default not available")
assert.Equal(t, []interface{}{"env3=val3", "env4=val4"}, d.Defaults[0].Steps["testStep"]["sidecarEnvVars"], "sidecarEnvVars default not available")
@ -396,7 +396,7 @@ func TestGetContextDefaults(t *testing.T) {
assert.Equal(t, false, d.Defaults[0].Steps["testStep"]["sidecarPullImage"], "sidecarPullImage default not available")
assert.Equal(t, "/sidecar/command", d.Defaults[0].Steps["testStep"]["sidecarReadyCommand"], "sidecarReadyCommand default not available")
assert.Equal(t, "/sidecar/dir", d.Defaults[0].Steps["testStep"]["sidecarWorkspace"], "sidecarWorkspace default not available")
assert.Equal(t, []interface{}{"vbn3:vbv3", "vbn4:vbv4"}, d.Defaults[0].Steps["testStep"]["sidecarVolumeBind"], "sidecarVolumeBind default not available")
assert.Equal(t, []interface{}{"mn3:mp3", "mn4:mp4"}, d.Defaults[0].Steps["testStep"]["sidecarVolumeBind"], "sidecarVolumeBind default not available")
})
t.Run("Negative case", func(t *testing.T) {