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,10 +490,19 @@ func (s *Service) mergeLastWinEnvironments(environments []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeLastWinImage(image string) {
|
func (s *Service) mergeLastWinImage(image string) {
|
||||||
|
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 {
|
if s.Image != image {
|
||||||
s.Image = image
|
s.Image = image
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Service) mergeLastWinExtraHosts(extraHosts []string) {
|
func (s *Service) mergeLastWinExtraHosts(extraHosts []string) {
|
||||||
for _, extraHost := range extraHosts {
|
for _, extraHost := range extraHosts {
|
||||||
|
@ -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
|
// Labels
|
||||||
{
|
{
|
||||||
serviceDeploymentA: &dockerCompose.Service{
|
serviceDeploymentA: &dockerCompose.Service{
|
||||||
|
Loading…
Reference in New Issue
Block a user