fix: rename firstWin to existingWin
This commit is contained in:
parent
4ad9da6d63
commit
9b469bd8c6
12
cmd/root.go
12
cmd/root.go
@ -42,7 +42,7 @@ dcmerge docker-compose.yml https://git.example.local/user/repo/docker-compose.ym
|
|||||||
RunE: run,
|
RunE: run,
|
||||||
Version: version,
|
Version: version,
|
||||||
}
|
}
|
||||||
rootCmd.Flags().BoolP("first-win", "f", false, "Add only missing attributes")
|
rootCmd.Flags().BoolP("existing-win", "f", false, "Protect existing attributes")
|
||||||
rootCmd.Flags().BoolP("last-win", "l", false, "Overwrite existing attributes")
|
rootCmd.Flags().BoolP("last-win", "l", false, "Overwrite existing attributes")
|
||||||
rootCmd.Flags().StringP("output-file", "o", "", "Write instead on stdout into a file")
|
rootCmd.Flags().StringP("output-file", "o", "", "Write instead on stdout into a file")
|
||||||
rootCmd.AddCommand(completionCmd)
|
rootCmd.AddCommand(completionCmd)
|
||||||
@ -51,7 +51,7 @@ dcmerge docker-compose.yml https://git.example.local/user/repo/docker-compose.ym
|
|||||||
}
|
}
|
||||||
|
|
||||||
func run(cmd *cobra.Command, args []string) error {
|
func run(cmd *cobra.Command, args []string) error {
|
||||||
mergeFirstWin, err := cmd.Flags().GetBool("first-win")
|
mergeExisting, err := cmd.Flags().GetBool("existing-win")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Failed to parse flag last-win: %s", err)
|
return fmt.Errorf("Failed to parse flag last-win: %s", err)
|
||||||
}
|
}
|
||||||
@ -75,11 +75,11 @@ func run(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
for _, config := range dockerComposeConfigs {
|
for _, config := range dockerComposeConfigs {
|
||||||
switch {
|
switch {
|
||||||
case mergeFirstWin && mergeLastWin:
|
case mergeExisting && mergeLastWin:
|
||||||
return fmt.Errorf("Neither --first-win or --last-win can be specified - not booth.")
|
return fmt.Errorf("Neither --first-win or --last-win can be specified - not booth.")
|
||||||
case mergeFirstWin && !mergeLastWin:
|
case mergeExisting && !mergeLastWin:
|
||||||
dockerComposeConfig.MergeFirstWin(config)
|
dockerComposeConfig.MergeExistingWin(config)
|
||||||
case !mergeFirstWin && mergeLastWin:
|
case !mergeExisting && mergeLastWin:
|
||||||
dockerComposeConfig.MergeLastWin(config)
|
dockerComposeConfig.MergeLastWin(config)
|
||||||
default:
|
default:
|
||||||
dockerComposeConfig.Merge(config)
|
dockerComposeConfig.Merge(config)
|
||||||
|
@ -92,7 +92,7 @@ func (c *Config) Merge(config *Config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MergeLastWin merges a config and overwrite already existing properties
|
// MergeLastWin merges a config and overwrite already existing properties
|
||||||
func (c *Config) MergeFirstWin(config *Config) {
|
func (c *Config) MergeExistingWin(config *Config) {
|
||||||
switch {
|
switch {
|
||||||
case c == nil && config == nil:
|
case c == nil && config == nil:
|
||||||
fallthrough
|
fallthrough
|
||||||
@ -108,11 +108,11 @@ func (c *Config) MergeFirstWin(config *Config) {
|
|||||||
// fallthrough
|
// fallthrough
|
||||||
|
|
||||||
default:
|
default:
|
||||||
c.mergeFirstWinNetworks(config.Networks)
|
c.mergeExistingWinNetworks(config.Networks)
|
||||||
c.mergeFirstWinSecrets(config.Secrets)
|
c.mergeExistingWinSecrets(config.Secrets)
|
||||||
c.mergeFirstWinServices(config.Services)
|
c.mergeExistingWinServices(config.Services)
|
||||||
c.mergeFirstWinVersion(config.Version)
|
c.mergeExistingWinVersion(config.Version)
|
||||||
c.mergeFirstWinVolumes(config.Volumes)
|
c.mergeExistingWinVolumes(config.Volumes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,62 +141,62 @@ func (c *Config) MergeLastWin(config *Config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) mergeFirstWinVersion(version string) {
|
func (c *Config) mergeExistingWinVersion(version string) {
|
||||||
if len(c.Version) <= 0 {
|
if len(c.Version) <= 0 {
|
||||||
c.Version = version
|
c.Version = version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) mergeFirstWinNetworks(networks map[string]*Network) {
|
func (c *Config) mergeExistingWinNetworks(networks map[string]*Network) {
|
||||||
for networkName, network := range networks {
|
for networkName, network := range networks {
|
||||||
if network == nil {
|
if network == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.ExistsNetwork(networkName) {
|
if c.ExistsNetwork(networkName) {
|
||||||
c.Networks[networkName].MergeFirstWin(network)
|
c.Networks[networkName].MergeExistingWin(network)
|
||||||
} else {
|
} else {
|
||||||
c.Networks[networkName] = network
|
c.Networks[networkName] = network
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) mergeFirstWinSecrets(secrets map[string]*Secret) {
|
func (c *Config) mergeExistingWinSecrets(secrets map[string]*Secret) {
|
||||||
for secretName, secret := range secrets {
|
for secretName, secret := range secrets {
|
||||||
if secret == nil {
|
if secret == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.ExistsNetwork(secretName) {
|
if c.ExistsNetwork(secretName) {
|
||||||
c.Secrets[secretName].MergeFirstWin(secret)
|
c.Secrets[secretName].MergeExistingWin(secret)
|
||||||
} else {
|
} else {
|
||||||
c.Secrets[secretName] = secret
|
c.Secrets[secretName] = secret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) mergeFirstWinServices(services map[string]*Service) {
|
func (c *Config) mergeExistingWinServices(services map[string]*Service) {
|
||||||
for serviceName, service := range services {
|
for serviceName, service := range services {
|
||||||
if service == nil {
|
if service == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.ExistsService(serviceName) {
|
if c.ExistsService(serviceName) {
|
||||||
c.Services[serviceName].MergeFirstWin(service)
|
c.Services[serviceName].MergeExistingWin(service)
|
||||||
} else {
|
} else {
|
||||||
c.Services[serviceName] = service
|
c.Services[serviceName] = service
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) mergeFirstWinVolumes(volumes map[string]*Volume) {
|
func (c *Config) mergeExistingWinVolumes(volumes map[string]*Volume) {
|
||||||
for volumeName, volume := range volumes {
|
for volumeName, volume := range volumes {
|
||||||
if volume == nil {
|
if volume == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.ExistsNetwork(volumeName) {
|
if c.ExistsNetwork(volumeName) {
|
||||||
c.Volumes[volumeName].MergeFirstWin(volume)
|
c.Volumes[volumeName].MergeExistingWin(volume)
|
||||||
} else {
|
} else {
|
||||||
c.Volumes[volumeName] = volume
|
c.Volumes[volumeName] = volume
|
||||||
}
|
}
|
||||||
@ -301,7 +301,7 @@ func (n *Network) Equal(equalable Equalable) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Network) MergeFirstWin(network *Network) {
|
func (n *Network) MergeExistingWin(network *Network) {
|
||||||
switch {
|
switch {
|
||||||
case n == nil && network == nil:
|
case n == nil && network == nil:
|
||||||
fallthrough
|
fallthrough
|
||||||
@ -317,7 +317,7 @@ func (n *Network) MergeFirstWin(network *Network) {
|
|||||||
// fallthrough
|
// fallthrough
|
||||||
|
|
||||||
default:
|
default:
|
||||||
n.mergeFirstWinIPAM(network.IPAM)
|
n.mergeExistingWinIPAM(network.IPAM)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,9 +341,9 @@ func (n *Network) MergeLastWin(network *Network) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Network) mergeFirstWinIPAM(networkIPAM *NetworkIPAM) {
|
func (n *Network) mergeExistingWinIPAM(networkIPAM *NetworkIPAM) {
|
||||||
if !n.IPAM.Equal(networkIPAM) {
|
if !n.IPAM.Equal(networkIPAM) {
|
||||||
n.IPAM.MergeFirstWin(networkIPAM)
|
n.IPAM.MergeExistingWin(networkIPAM)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ func (nIPAM *NetworkIPAM) Equal(equalable Equalable) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nIPAM *NetworkIPAM) MergeFirstWin(networkIPAM *NetworkIPAM) {
|
func (nIPAM *NetworkIPAM) MergeExistingWin(networkIPAM *NetworkIPAM) {
|
||||||
switch {
|
switch {
|
||||||
case nIPAM == nil && networkIPAM == nil:
|
case nIPAM == nil && networkIPAM == nil:
|
||||||
fallthrough
|
fallthrough
|
||||||
@ -399,7 +399,7 @@ func (nIPAM *NetworkIPAM) MergeFirstWin(networkIPAM *NetworkIPAM) {
|
|||||||
// fallthrough
|
// fallthrough
|
||||||
|
|
||||||
default:
|
default:
|
||||||
nIPAM.mergeFirstWinConfig(networkIPAM.Configs)
|
nIPAM.mergeExistingWinConfig(networkIPAM.Configs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,7 +423,7 @@ func (nIPAM *NetworkIPAM) MergeLastWin(networkIPAM *NetworkIPAM) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nIPAM *NetworkIPAM) mergeFirstWinConfig(networkIPAMConfigs []*NetworkIPAMConfig) {
|
func (nIPAM *NetworkIPAM) mergeExistingWinConfig(networkIPAMConfigs []*NetworkIPAMConfig) {
|
||||||
for _, networkIPAMConfig := range networkIPAMConfigs {
|
for _, networkIPAMConfig := range networkIPAMConfigs {
|
||||||
if !existsInSlice(nIPAM.Configs, networkIPAMConfig) {
|
if !existsInSlice(nIPAM.Configs, networkIPAMConfig) {
|
||||||
nIPAM.Configs = append(nIPAM.Configs, networkIPAMConfig)
|
nIPAM.Configs = append(nIPAM.Configs, networkIPAMConfig)
|
||||||
@ -495,9 +495,9 @@ func (s *Secret) Equal(equalable Equalable) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MergeFirstWin merges adds or overwrite the attributes of the passed secret
|
// MergeExistingWin merges adds or overwrite the attributes of the passed secret
|
||||||
// with the existing one.
|
// with the existing one.
|
||||||
func (s *Secret) MergeFirstWin(secret *Secret) {
|
func (s *Secret) MergeExistingWin(secret *Secret) {
|
||||||
if len(s.File) <= 0 {
|
if len(s.File) <= 0 {
|
||||||
s.File = secret.File
|
s.File = secret.File
|
||||||
}
|
}
|
||||||
@ -657,7 +657,7 @@ func (s *Service) Equal(equalable Equalable) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) MergeFirstWin(service *Service) {
|
func (s *Service) MergeExistingWin(service *Service) {
|
||||||
switch {
|
switch {
|
||||||
case s == nil && service == nil:
|
case s == nil && service == nil:
|
||||||
fallthrough
|
fallthrough
|
||||||
@ -673,18 +673,18 @@ func (s *Service) MergeFirstWin(service *Service) {
|
|||||||
// fallthrough
|
// fallthrough
|
||||||
|
|
||||||
default:
|
default:
|
||||||
s.mergeFirstWinCapabilitiesAdd(service.CapabilitiesAdd)
|
s.mergeExistingWinCapabilitiesAdd(service.CapabilitiesAdd)
|
||||||
s.mergeFirstWinCapabilitiesDrop(service.CapabilitiesDrop)
|
s.mergeExistingWinCapabilitiesDrop(service.CapabilitiesDrop)
|
||||||
s.mergeFirstWinDeploy(service.Deploy)
|
s.mergeExistingWinDeploy(service.Deploy)
|
||||||
s.mergeFirstWinEnvironments(service.Environments)
|
s.mergeExistingWinEnvironments(service.Environments)
|
||||||
s.mergeFirstWinExtraHosts(service.ExtraHosts)
|
s.mergeExistingWinExtraHosts(service.ExtraHosts)
|
||||||
s.mergeFirstWinImage(service.Image)
|
s.mergeExistingWinImage(service.Image)
|
||||||
s.mergeFirstWinLabels(service.Labels)
|
s.mergeExistingWinLabels(service.Labels)
|
||||||
s.mergeFirstWinNetworks(service.Networks)
|
s.mergeExistingWinNetworks(service.Networks)
|
||||||
s.mergeFirstWinPorts(service.Ports)
|
s.mergeExistingWinPorts(service.Ports)
|
||||||
s.mergeFirstWinSecrets(service.Secrets)
|
s.mergeExistingWinSecrets(service.Secrets)
|
||||||
s.mergeFirstWinULimits(service.ULimits)
|
s.mergeExistingWinULimits(service.ULimits)
|
||||||
s.mergeFirstWinVolumes(service.Volumes)
|
s.mergeExistingWinVolumes(service.Volumes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,7 +721,7 @@ func (s *Service) MergeLastWin(service *Service) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeFirstWinCapabilitiesAdd(capabilitiesAdd []string) {
|
func (s *Service) mergeExistingWinCapabilitiesAdd(capabilitiesAdd []string) {
|
||||||
for _, capabilityAdd := range capabilitiesAdd {
|
for _, capabilityAdd := range capabilitiesAdd {
|
||||||
if !existsInSlice(s.CapabilitiesAdd, capabilityAdd) && len(capabilityAdd) > 0 {
|
if !existsInSlice(s.CapabilitiesAdd, capabilityAdd) && len(capabilityAdd) > 0 {
|
||||||
s.CapabilitiesAdd = append(s.CapabilitiesAdd, capabilityAdd)
|
s.CapabilitiesAdd = append(s.CapabilitiesAdd, capabilityAdd)
|
||||||
@ -729,7 +729,7 @@ func (s *Service) mergeFirstWinCapabilitiesAdd(capabilitiesAdd []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeFirstWinCapabilitiesDrop(capabilitiesDrop []string) {
|
func (s *Service) mergeExistingWinCapabilitiesDrop(capabilitiesDrop []string) {
|
||||||
for _, capabilityDrop := range capabilitiesDrop {
|
for _, capabilityDrop := range capabilitiesDrop {
|
||||||
if !existsInSlice(s.CapabilitiesAdd, capabilityDrop) && len(capabilityDrop) > 0 {
|
if !existsInSlice(s.CapabilitiesAdd, capabilityDrop) && len(capabilityDrop) > 0 {
|
||||||
s.CapabilitiesDrop = append(s.CapabilitiesDrop, capabilityDrop)
|
s.CapabilitiesDrop = append(s.CapabilitiesDrop, capabilityDrop)
|
||||||
@ -737,7 +737,7 @@ func (s *Service) mergeFirstWinCapabilitiesDrop(capabilitiesDrop []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeFirstWinDeploy(deploy *ServiceDeploy) {
|
func (s *Service) mergeExistingWinDeploy(deploy *ServiceDeploy) {
|
||||||
switch {
|
switch {
|
||||||
case s.Deploy == nil && deploy != nil:
|
case s.Deploy == nil && deploy != nil:
|
||||||
s.Deploy = deploy
|
s.Deploy = deploy
|
||||||
@ -746,11 +746,11 @@ func (s *Service) mergeFirstWinDeploy(deploy *ServiceDeploy) {
|
|||||||
case s.Deploy == nil && deploy == nil:
|
case s.Deploy == nil && deploy == nil:
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
s.Deploy.MergeFirstWin(deploy)
|
s.Deploy.MergeExistingWin(deploy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeFirstWinEnvironments(environments []string) {
|
func (s *Service) mergeExistingWinEnvironments(environments []string) {
|
||||||
switch {
|
switch {
|
||||||
case s.Environments == nil && environments != nil:
|
case s.Environments == nil && environments != nil:
|
||||||
s.Environments = environments
|
s.Environments = environments
|
||||||
@ -772,7 +772,7 @@ func (s *Service) mergeFirstWinEnvironments(environments []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeFirstWinImage(image string) {
|
func (s *Service) mergeExistingWinImage(image string) {
|
||||||
switch {
|
switch {
|
||||||
case len(s.Image) == 0 && len(image) != 0:
|
case len(s.Image) == 0 && len(image) != 0:
|
||||||
s.Image = image
|
s.Image = image
|
||||||
@ -785,7 +785,7 @@ func (s *Service) mergeFirstWinImage(image string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeFirstWinExtraHosts(extraHosts []string) {
|
func (s *Service) mergeExistingWinExtraHosts(extraHosts []string) {
|
||||||
for _, extraHost := range extraHosts {
|
for _, extraHost := range extraHosts {
|
||||||
if !existsInSlice(s.ExtraHosts, extraHost) && len(extraHost) > 0 {
|
if !existsInSlice(s.ExtraHosts, extraHost) && len(extraHost) > 0 {
|
||||||
s.ExtraHosts = append(s.ExtraHosts, extraHost)
|
s.ExtraHosts = append(s.ExtraHosts, extraHost)
|
||||||
@ -793,7 +793,7 @@ func (s *Service) mergeFirstWinExtraHosts(extraHosts []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeFirstWinLabels(labels []string) {
|
func (s *Service) mergeExistingWinLabels(labels []string) {
|
||||||
switch {
|
switch {
|
||||||
case s.Labels == nil && labels != nil:
|
case s.Labels == nil && labels != nil:
|
||||||
s.Labels = labels
|
s.Labels = labels
|
||||||
@ -815,7 +815,7 @@ func (s *Service) mergeFirstWinLabels(labels []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeFirstWinNetworks(networks map[string]*ServiceNetwork) {
|
func (s *Service) mergeExistingWinNetworks(networks map[string]*ServiceNetwork) {
|
||||||
switch {
|
switch {
|
||||||
case s.Networks == nil && networks != nil:
|
case s.Networks == nil && networks != nil:
|
||||||
s.Networks = networks
|
s.Networks = networks
|
||||||
@ -826,7 +826,7 @@ func (s *Service) mergeFirstWinNetworks(networks map[string]*ServiceNetwork) {
|
|||||||
default:
|
default:
|
||||||
for name, network := range networks {
|
for name, network := range networks {
|
||||||
if _, exists := s.Networks[name]; exists {
|
if _, exists := s.Networks[name]; exists {
|
||||||
s.Networks[name].MergeFirstWin(network)
|
s.Networks[name].MergeExistingWin(network)
|
||||||
} else {
|
} else {
|
||||||
s.Networks[name] = network
|
s.Networks[name] = network
|
||||||
}
|
}
|
||||||
@ -834,7 +834,7 @@ func (s *Service) mergeFirstWinNetworks(networks map[string]*ServiceNetwork) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeFirstWinPorts(ports []string) {
|
func (s *Service) mergeExistingWinPorts(ports []string) {
|
||||||
switch {
|
switch {
|
||||||
case s.Ports == nil && ports != nil:
|
case s.Ports == nil && ports != nil:
|
||||||
s.Ports = ports
|
s.Ports = ports
|
||||||
@ -852,7 +852,7 @@ func (s *Service) mergeFirstWinPorts(ports []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeFirstWinSecrets(secrets []string) {
|
func (s *Service) mergeExistingWinSecrets(secrets []string) {
|
||||||
for _, secret := range secrets {
|
for _, secret := range secrets {
|
||||||
if !existsInSlice(s.Secrets, secret) && len(secret) > 0 {
|
if !existsInSlice(s.Secrets, secret) && len(secret) > 0 {
|
||||||
s.Secrets = append(s.Secrets, secret)
|
s.Secrets = append(s.Secrets, secret)
|
||||||
@ -860,7 +860,7 @@ func (s *Service) mergeFirstWinSecrets(secrets []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeFirstWinULimits(uLimits *ServiceULimits) {
|
func (s *Service) mergeExistingWinULimits(uLimits *ServiceULimits) {
|
||||||
switch {
|
switch {
|
||||||
case s.ULimits == nil && uLimits != nil:
|
case s.ULimits == nil && uLimits != nil:
|
||||||
s.ULimits = uLimits
|
s.ULimits = uLimits
|
||||||
@ -869,11 +869,11 @@ func (s *Service) mergeFirstWinULimits(uLimits *ServiceULimits) {
|
|||||||
case s.ULimits == nil && uLimits == nil:
|
case s.ULimits == nil && uLimits == nil:
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
s.ULimits.MergeFirstWin(uLimits)
|
s.ULimits.MergeExistingWin(uLimits)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeFirstWinVolumes(volumes []string) {
|
func (s *Service) mergeExistingWinVolumes(volumes []string) {
|
||||||
switch {
|
switch {
|
||||||
case s.Volumes == nil && volumes != nil:
|
case s.Volumes == nil && volumes != nil:
|
||||||
s.Volumes = volumes
|
s.Volumes = volumes
|
||||||
@ -1179,9 +1179,9 @@ func (sd *ServiceDeploy) Equal(equalable Equalable) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MergeFirstWin merges adds or overwrite the attributes of the passed
|
// MergeExistingWin merges adds or overwrite the attributes of the passed
|
||||||
// serviceDeploy with the existing one.
|
// serviceDeploy with the existing one.
|
||||||
func (sd *ServiceDeploy) MergeFirstWin(serviceDeploy *ServiceDeploy) {
|
func (sd *ServiceDeploy) MergeExistingWin(serviceDeploy *ServiceDeploy) {
|
||||||
switch {
|
switch {
|
||||||
case sd == nil && serviceDeploy == nil:
|
case sd == nil && serviceDeploy == nil:
|
||||||
fallthrough
|
fallthrough
|
||||||
@ -1197,7 +1197,7 @@ func (sd *ServiceDeploy) MergeFirstWin(serviceDeploy *ServiceDeploy) {
|
|||||||
// fallthrough
|
// fallthrough
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sd.mergeFirstWinDeployResources(serviceDeploy.Resources)
|
sd.mergeExistingWinDeployResources(serviceDeploy.Resources)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1223,7 +1223,7 @@ func (sd *ServiceDeploy) MergeLastWin(serviceDeploy *ServiceDeploy) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sd *ServiceDeploy) mergeFirstWinDeployResources(resources *ServiceDeployResources) {
|
func (sd *ServiceDeploy) mergeExistingWinDeployResources(resources *ServiceDeployResources) {
|
||||||
switch {
|
switch {
|
||||||
case sd.Resources == nil && resources != nil:
|
case sd.Resources == nil && resources != nil:
|
||||||
sd.Resources = resources
|
sd.Resources = resources
|
||||||
@ -1232,7 +1232,7 @@ func (sd *ServiceDeploy) mergeFirstWinDeployResources(resources *ServiceDeployRe
|
|||||||
case sd.Resources == nil && resources == nil:
|
case sd.Resources == nil && resources == nil:
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
sd.Resources.MergeFirstWin(resources)
|
sd.Resources.MergeExistingWin(resources)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1280,9 +1280,9 @@ func (sdr *ServiceDeployResources) Equal(equalable Equalable) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MergeFirstWin adds only attributes of the passed serviceDeployResources if
|
// MergeExistingWin adds only attributes of the passed serviceDeployResources if
|
||||||
// they are not already exists.
|
// they are not already exists.
|
||||||
func (sdr *ServiceDeployResources) MergeFirstWin(serviceDeployResources *ServiceDeployResources) {
|
func (sdr *ServiceDeployResources) MergeExistingWin(serviceDeployResources *ServiceDeployResources) {
|
||||||
switch {
|
switch {
|
||||||
case sdr == nil && serviceDeployResources == nil:
|
case sdr == nil && serviceDeployResources == nil:
|
||||||
fallthrough
|
fallthrough
|
||||||
@ -1296,8 +1296,8 @@ func (sdr *ServiceDeployResources) MergeFirstWin(serviceDeployResources *Service
|
|||||||
sdr = NewServiceDeployResources()
|
sdr = NewServiceDeployResources()
|
||||||
fallthrough
|
fallthrough
|
||||||
default:
|
default:
|
||||||
sdr.mergeFirstWinLimits(serviceDeployResources.Limits)
|
sdr.mergeExistingWinLimits(serviceDeployResources.Limits)
|
||||||
sdr.mergeFirstWinReservations(serviceDeployResources.Reservations)
|
sdr.mergeExistingWinReservations(serviceDeployResources.Reservations)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1322,7 +1322,7 @@ func (sdr *ServiceDeployResources) MergeLastWin(serviceDeployResources *ServiceD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sdr *ServiceDeployResources) mergeFirstWinLimits(limits *ServiceDeployResourcesLimits) {
|
func (sdr *ServiceDeployResources) mergeExistingWinLimits(limits *ServiceDeployResourcesLimits) {
|
||||||
switch {
|
switch {
|
||||||
case sdr.Limits == nil && limits != nil:
|
case sdr.Limits == nil && limits != nil:
|
||||||
sdr.Limits = limits
|
sdr.Limits = limits
|
||||||
@ -1331,11 +1331,11 @@ func (sdr *ServiceDeployResources) mergeFirstWinLimits(limits *ServiceDeployReso
|
|||||||
case sdr.Limits == nil && limits == nil:
|
case sdr.Limits == nil && limits == nil:
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
sdr.Limits.MergeFirstWin(limits)
|
sdr.Limits.MergeExistingWin(limits)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sdr *ServiceDeployResources) mergeFirstWinReservations(reservations *ServiceDeployResourcesLimits) {
|
func (sdr *ServiceDeployResources) mergeExistingWinReservations(reservations *ServiceDeployResourcesLimits) {
|
||||||
switch {
|
switch {
|
||||||
case sdr.Reservations == nil && reservations != nil:
|
case sdr.Reservations == nil && reservations != nil:
|
||||||
sdr.Reservations = reservations
|
sdr.Reservations = reservations
|
||||||
@ -1344,7 +1344,7 @@ func (sdr *ServiceDeployResources) mergeFirstWinReservations(reservations *Servi
|
|||||||
case sdr.Reservations == nil && reservations == nil:
|
case sdr.Reservations == nil && reservations == nil:
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
sdr.Reservations.MergeFirstWin(reservations)
|
sdr.Reservations.MergeExistingWin(reservations)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1406,9 +1406,9 @@ func (sdrl *ServiceDeployResourcesLimits) Equal(equalable Equalable) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MergeFirstWin adds only attributes of the passed serviceDeployResourcesLimits
|
// MergeExistingWin adds only attributes of the passed serviceDeployResourcesLimits
|
||||||
// if they are not already exists.
|
// if they are not already exists.
|
||||||
func (sdrl *ServiceDeployResourcesLimits) MergeFirstWin(serviceDeployResourcesLimits *ServiceDeployResourcesLimits) {
|
func (sdrl *ServiceDeployResourcesLimits) MergeExistingWin(serviceDeployResourcesLimits *ServiceDeployResourcesLimits) {
|
||||||
switch {
|
switch {
|
||||||
case sdrl == nil && serviceDeployResourcesLimits == nil:
|
case sdrl == nil && serviceDeployResourcesLimits == nil:
|
||||||
fallthrough
|
fallthrough
|
||||||
@ -1424,8 +1424,8 @@ func (sdrl *ServiceDeployResourcesLimits) MergeFirstWin(serviceDeployResourcesLi
|
|||||||
// fallthrough
|
// fallthrough
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sdrl.mergeFirstWinCPUs(serviceDeployResourcesLimits.CPUs)
|
sdrl.mergeExistingWinCPUs(serviceDeployResourcesLimits.CPUs)
|
||||||
sdrl.mergeFirstWinMemory(serviceDeployResourcesLimits.Memory)
|
sdrl.mergeExistingWinMemory(serviceDeployResourcesLimits.Memory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1452,13 +1452,13 @@ func (sdrl *ServiceDeployResourcesLimits) MergeLastWin(serviceDeployResourcesLim
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sdrl *ServiceDeployResourcesLimits) mergeFirstWinCPUs(cpus string) {
|
func (sdrl *ServiceDeployResourcesLimits) mergeExistingWinCPUs(cpus string) {
|
||||||
if len(sdrl.CPUs) <= 0 {
|
if len(sdrl.CPUs) <= 0 {
|
||||||
sdrl.CPUs = cpus
|
sdrl.CPUs = cpus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sdrl *ServiceDeployResourcesLimits) mergeFirstWinMemory(memory string) {
|
func (sdrl *ServiceDeployResourcesLimits) mergeExistingWinMemory(memory string) {
|
||||||
if len(sdrl.Memory) <= 0 {
|
if len(sdrl.Memory) <= 0 {
|
||||||
sdrl.Memory = memory
|
sdrl.Memory = memory
|
||||||
}
|
}
|
||||||
@ -1503,9 +1503,9 @@ func (sn *ServiceNetwork) Equal(equalable Equalable) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MergeFirstWin adds only attributes of the passed
|
// MergeExistingWin adds only attributes of the passed
|
||||||
// serviceNetwork if they are undefined.
|
// serviceNetwork if they are undefined.
|
||||||
func (sn *ServiceNetwork) MergeFirstWin(serviceNetwork *ServiceNetwork) {
|
func (sn *ServiceNetwork) MergeExistingWin(serviceNetwork *ServiceNetwork) {
|
||||||
switch {
|
switch {
|
||||||
case sn == nil && serviceNetwork == nil:
|
case sn == nil && serviceNetwork == nil:
|
||||||
fallthrough
|
fallthrough
|
||||||
@ -1523,7 +1523,7 @@ func (sn *ServiceNetwork) MergeFirstWin(serviceNetwork *ServiceNetwork) {
|
|||||||
sn = NewServiceNetwork()
|
sn = NewServiceNetwork()
|
||||||
fallthrough
|
fallthrough
|
||||||
default:
|
default:
|
||||||
sn.mergeFirstWinAliases(serviceNetwork.Aliases)
|
sn.mergeExistingWinAliases(serviceNetwork.Aliases)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1551,7 +1551,7 @@ func (sn *ServiceNetwork) MergeLastWin(serviceNetwork *ServiceNetwork) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sn *ServiceNetwork) mergeFirstWinAliases(aliases []string) {
|
func (sn *ServiceNetwork) mergeExistingWinAliases(aliases []string) {
|
||||||
for _, alias := range aliases {
|
for _, alias := range aliases {
|
||||||
if !existsInSlice(sn.Aliases, alias) && len(alias) > 0 {
|
if !existsInSlice(sn.Aliases, alias) && len(alias) > 0 {
|
||||||
sn.Aliases = append(sn.Aliases, alias)
|
sn.Aliases = append(sn.Aliases, alias)
|
||||||
@ -1598,9 +1598,9 @@ func (l *ServiceULimits) Equal(equalable Equalable) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MergeFirstWin adds only the attributes of the passed ServiceULimits they are
|
// MergeExistingWin adds only the attributes of the passed ServiceULimits they are
|
||||||
// undefined.
|
// undefined.
|
||||||
func (l *ServiceULimits) MergeFirstWin(serviceULimits *ServiceULimits) {
|
func (l *ServiceULimits) MergeExistingWin(serviceULimits *ServiceULimits) {
|
||||||
switch {
|
switch {
|
||||||
case l == nil && serviceULimits == nil:
|
case l == nil && serviceULimits == nil:
|
||||||
fallthrough
|
fallthrough
|
||||||
@ -1615,8 +1615,8 @@ func (l *ServiceULimits) MergeFirstWin(serviceULimits *ServiceULimits) {
|
|||||||
// fallthrough
|
// fallthrough
|
||||||
|
|
||||||
default:
|
default:
|
||||||
l.mergeFirstWinNProc(serviceULimits.NProc)
|
l.mergeExistingWinNProc(serviceULimits.NProc)
|
||||||
l.mergeFirstWinNoFile(serviceULimits.NoFile)
|
l.mergeExistingWinNoFile(serviceULimits.NoFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1642,16 +1642,16 @@ func (l *ServiceULimits) MergeLastWin(serviceULimits *ServiceULimits) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *ServiceULimits) mergeFirstWinNProc(nproc uint) {
|
func (l *ServiceULimits) mergeExistingWinNProc(nproc uint) {
|
||||||
if l.NProc != nproc {
|
if l.NProc != nproc {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
l.NProc = nproc
|
l.NProc = nproc
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *ServiceULimits) mergeFirstWinNoFile(noFile *ServiceULimitsNoFile) {
|
func (l *ServiceULimits) mergeExistingWinNoFile(noFile *ServiceULimitsNoFile) {
|
||||||
if !l.NoFile.Equal(noFile) {
|
if !l.NoFile.Equal(noFile) {
|
||||||
l.NoFile.MergeFirstWin(noFile)
|
l.NoFile.MergeExistingWin(noFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1698,9 +1698,9 @@ func (nf *ServiceULimitsNoFile) Equal(equalable Equalable) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MergeFirstWin adds only the attributes of the passed ServiceULimits they are
|
// MergeExistingWin adds only the attributes of the passed ServiceULimits they are
|
||||||
// undefined.
|
// undefined.
|
||||||
func (nf *ServiceULimitsNoFile) MergeFirstWin(serviceULimitsNoFile *ServiceULimitsNoFile) {
|
func (nf *ServiceULimitsNoFile) MergeExistingWin(serviceULimitsNoFile *ServiceULimitsNoFile) {
|
||||||
switch {
|
switch {
|
||||||
case nf == nil && serviceULimitsNoFile == nil:
|
case nf == nil && serviceULimitsNoFile == nil:
|
||||||
fallthrough
|
fallthrough
|
||||||
@ -1716,8 +1716,8 @@ func (nf *ServiceULimitsNoFile) MergeFirstWin(serviceULimitsNoFile *ServiceULimi
|
|||||||
// fallthrough
|
// fallthrough
|
||||||
|
|
||||||
default:
|
default:
|
||||||
nf.mergeFirstWinHard(serviceULimitsNoFile.Hard)
|
nf.mergeExistingWinHard(serviceULimitsNoFile.Hard)
|
||||||
nf.mergeFirstWinSoft(serviceULimitsNoFile.Soft)
|
nf.mergeExistingWinSoft(serviceULimitsNoFile.Soft)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1744,14 +1744,14 @@ func (nf *ServiceULimitsNoFile) MergeLastWin(serviceULimitsNoFile *ServiceULimit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nf *ServiceULimitsNoFile) mergeFirstWinHard(hard uint) {
|
func (nf *ServiceULimitsNoFile) mergeExistingWinHard(hard uint) {
|
||||||
if nf.Hard != hard {
|
if nf.Hard != hard {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
nf.Hard = hard
|
nf.Hard = hard
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nf *ServiceULimitsNoFile) mergeFirstWinSoft(soft uint) {
|
func (nf *ServiceULimitsNoFile) mergeExistingWinSoft(soft uint) {
|
||||||
if nf.Soft != soft {
|
if nf.Soft != soft {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1797,9 +1797,9 @@ func (v *Volume) Equal(equalable Equalable) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MergeFirstWin adds only the attributes of the passed Volume they are
|
// MergeExistingWin adds only the attributes of the passed Volume they are
|
||||||
// undefined.
|
// undefined.
|
||||||
func (v *Volume) MergeFirstWin(volume *Volume) {
|
func (v *Volume) MergeExistingWin(volume *Volume) {
|
||||||
switch {
|
switch {
|
||||||
case v == nil && volume == nil:
|
case v == nil && volume == nil:
|
||||||
fallthrough
|
fallthrough
|
||||||
@ -1814,7 +1814,7 @@ func (v *Volume) MergeFirstWin(volume *Volume) {
|
|||||||
// fallthrough
|
// fallthrough
|
||||||
|
|
||||||
default:
|
default:
|
||||||
v.mergeFirstWinExternal(volume.External)
|
v.mergeExistingWinExternal(volume.External)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1837,7 +1837,7 @@ func (v *Volume) MergeLastWin(volume *Volume) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Volume) mergeFirstWinExternal(external bool) {
|
func (v *Volume) mergeExistingWinExternal(external bool) {
|
||||||
if v.External {
|
if v.External {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -464,7 +464,7 @@ func TestService_Equal(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestService_MergeFirstWin(t *testing.T) {
|
func TestService_MergeExistingWin(t *testing.T) {
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
@ -1360,7 +1360,7 @@ func TestService_MergeFirstWin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, testCase := range testCases {
|
for i, testCase := range testCases {
|
||||||
testCase.serviceDeploymentA.MergeFirstWin(testCase.serviceDeploymentB)
|
testCase.serviceDeploymentA.MergeExistingWin(testCase.serviceDeploymentB)
|
||||||
require.True(testCase.expectedService.Equal(testCase.serviceDeploymentA), "Failed test case %v", i)
|
require.True(testCase.expectedService.Equal(testCase.serviceDeploymentA), "Failed test case %v", i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2196,7 +2196,7 @@ func TestSecretDeploy_Equal(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestServiceDeploy_MergeFirstWin(t *testing.T) {
|
func TestServiceDeploy_MergeExistingWin(t *testing.T) {
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
@ -2377,7 +2377,7 @@ func TestSecretDeployResources_Equal(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestServiceDeployResources_MergeFirstWin(t *testing.T) {
|
func TestServiceDeployResources_MergeExistingWin(t *testing.T) {
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
@ -2521,7 +2521,7 @@ func TestServiceDeployResources_MergeFirstWin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, testCase := range testCases {
|
for i, testCase := range testCases {
|
||||||
testCase.serviceDeploymentResourcesA.MergeFirstWin(testCase.serviceDeploymentResourcesB)
|
testCase.serviceDeploymentResourcesA.MergeExistingWin(testCase.serviceDeploymentResourcesB)
|
||||||
require.True(testCase.expectedServiceDeploymentResources.Equal(testCase.serviceDeploymentResourcesA), "Failed test case %v", i)
|
require.True(testCase.expectedServiceDeploymentResources.Equal(testCase.serviceDeploymentResourcesA), "Failed test case %v", i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2715,7 +2715,7 @@ func TestServiceDeployResourcesLimits_Equal(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestServiceDeployResourcesLimits_MergeFirstWin(t *testing.T) {
|
func TestServiceDeployResourcesLimits_MergeExistingWin(t *testing.T) {
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
@ -2803,7 +2803,7 @@ func TestServiceDeployResourcesLimits_MergeFirstWin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, testCase := range testCases {
|
for i, testCase := range testCases {
|
||||||
testCase.serviceDeploymentResourcesLimitsA.MergeFirstWin(testCase.serviceDeploymentResourcesLimitsB)
|
testCase.serviceDeploymentResourcesLimitsA.MergeExistingWin(testCase.serviceDeploymentResourcesLimitsB)
|
||||||
require.True(testCase.expectedServiceDeploymentResourcesLimits.Equal(testCase.serviceDeploymentResourcesLimitsA), "Failed test case %v", i)
|
require.True(testCase.expectedServiceDeploymentResourcesLimits.Equal(testCase.serviceDeploymentResourcesLimitsA), "Failed test case %v", i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2941,7 +2941,7 @@ func TestServiceNetwork_Equal(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestServiceNetwork_MergeFirstWin(t *testing.T) {
|
func TestServiceNetwork_MergeExistingWin(t *testing.T) {
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
@ -2995,7 +2995,7 @@ func TestServiceNetwork_MergeFirstWin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, testCase := range testCases {
|
for i, testCase := range testCases {
|
||||||
testCase.ServiceNetworkA.MergeFirstWin(testCase.ServiceNetworkB)
|
testCase.ServiceNetworkA.MergeExistingWin(testCase.ServiceNetworkB)
|
||||||
require.True(testCase.expectedServiceNetwork.Equal(testCase.ServiceNetworkA), "Failed test case %v", i)
|
require.True(testCase.expectedServiceNetwork.Equal(testCase.ServiceNetworkA), "Failed test case %v", i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3163,7 +3163,7 @@ func TestServiceULimits_MergeLastWin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestServiceULimits_MergeFirstWin(t *testing.T) {
|
func TestServiceULimits_MergeExistingWin(t *testing.T) {
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
@ -3206,7 +3206,7 @@ func TestServiceULimits_MergeFirstWin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, testCase := range testCases {
|
for i, testCase := range testCases {
|
||||||
testCase.ServiceULimitsA.MergeFirstWin(testCase.ServiceULimitsB)
|
testCase.ServiceULimitsA.MergeExistingWin(testCase.ServiceULimitsB)
|
||||||
require.True(testCase.expectedServiceULimits.Equal(testCase.ServiceULimitsA), "Failed test case %v", i)
|
require.True(testCase.expectedServiceULimits.Equal(testCase.ServiceULimitsA), "Failed test case %v", i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3261,7 +3261,7 @@ func TestServiceULimitsNoFile_Equal(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestServiceULimitsNoFile_MergeFirstWin(t *testing.T) {
|
func TestServiceULimitsNoFile_MergeExistingWin(t *testing.T) {
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
@ -3338,7 +3338,7 @@ func TestServiceULimitsNoFile_MergeFirstWin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, testCase := range testCases {
|
for i, testCase := range testCases {
|
||||||
testCase.ServiceULimitsNoFileA.MergeFirstWin(testCase.ServiceULimitsNoFileB)
|
testCase.ServiceULimitsNoFileA.MergeExistingWin(testCase.ServiceULimitsNoFileB)
|
||||||
require.True(testCase.expectedServiceULimitsNoFile.Equal(testCase.ServiceULimitsNoFileA), "Failed test case %v", i)
|
require.True(testCase.expectedServiceULimitsNoFile.Equal(testCase.ServiceULimitsNoFileA), "Failed test case %v", i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3473,7 +3473,7 @@ func TestVolume_Equal(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVolume_MergeFirstWin(t *testing.T) {
|
func TestVolume_MergeExistingWin(t *testing.T) {
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
@ -3527,7 +3527,7 @@ func TestVolume_MergeFirstWin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, testCase := range testCases {
|
for i, testCase := range testCases {
|
||||||
testCase.volumeA.MergeFirstWin(testCase.volumeB)
|
testCase.volumeA.MergeExistingWin(testCase.volumeB)
|
||||||
require.True(testCase.expectedVolume.Equal(testCase.volumeA), "Failed test case %v", i)
|
require.True(testCase.expectedVolume.Equal(testCase.volumeA), "Failed test case %v", i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user