fix(dockerCompose): mergeLastWinImage
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3bf9380001
commit
ce48d6dd0c
@ -490,8 +490,17 @@ func (s *Service) mergeLastWinEnvironments(environments []string) {
|
||||
}
|
||||
|
||||
func (s *Service) mergeLastWinImage(image string) {
|
||||
if s.Image != image {
|
||||
switch {
|
||||
case len(s.Image) == 0 && len(image) != 0:
|
||||
s.Image = image
|
||||
case len(s.Image) != 0 && len(image) == 0:
|
||||
fallthrough
|
||||
case len(s.Image) == 0 && len(image) == 0:
|
||||
return
|
||||
default:
|
||||
if s.Image != image {
|
||||
s.Image = image
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -735,6 +735,41 @@ func TestService_MergeLastWin(t *testing.T) {
|
||||
},
|
||||
},
|
||||
|
||||
// Image
|
||||
{
|
||||
serviceDeploymentA: &dockerCompose.Service{
|
||||
Image: "",
|
||||
},
|
||||
serviceDeploymentB: &dockerCompose.Service{
|
||||
Image: "",
|
||||
},
|
||||
expectedService: &dockerCompose.Service{
|
||||
Image: "",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceDeploymentA: &dockerCompose.Service{
|
||||
Image: "HelloWorld",
|
||||
},
|
||||
serviceDeploymentB: &dockerCompose.Service{
|
||||
Image: "FooBar",
|
||||
},
|
||||
expectedService: &dockerCompose.Service{
|
||||
Image: "FooBar",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceDeploymentA: &dockerCompose.Service{
|
||||
Image: "HelloWorld",
|
||||
},
|
||||
serviceDeploymentB: &dockerCompose.Service{
|
||||
Image: "",
|
||||
},
|
||||
expectedService: &dockerCompose.Service{
|
||||
Image: "HelloWorld",
|
||||
},
|
||||
},
|
||||
|
||||
// Labels
|
||||
{
|
||||
serviceDeploymentA: &dockerCompose.Service{
|
||||
|
Loading…
Reference in New Issue
Block a user