removing rbac error checking from merge fn (#3530)

This commit is contained in:
Shruti Ramesh 2018-07-25 15:50:46 -07:00 коммит произвёл Jack Francis
Родитель 513ed45773
Коммит ae1b0a6fa4
2 изменённых файлов: 0 добавлений и 115 удалений

Просмотреть файл

@ -42,19 +42,6 @@ func (mc *ManagedCluster) Merge(emc *ManagedCluster) error {
mc.Properties.KubernetesVersion = emc.Properties.KubernetesVersion
}
// Merge properties.enableRBAC
if emc.Properties.EnableRBAC == nil {
return errors.New("existing ManagedCluster expect properties.enableRBAC not to be nil")
}
if mc.Properties.EnableRBAC == nil {
// For update scenario, the default behavior is to use existing behavior
mc.Properties.EnableRBAC = emc.Properties.EnableRBAC
} else if *mc.Properties.EnableRBAC != *emc.Properties.EnableRBAC {
return errors.Errorf("existing ManagedCluster has properties.enableRBAC %v. update to %v is not supported",
*emc.Properties.EnableRBAC,
*mc.Properties.EnableRBAC)
}
if mc.Properties.NetworkProfile == nil {
// For update scenario, the default behavior is to use existing behavior
mc.Properties.NetworkProfile = emc.Properties.NetworkProfile

Просмотреть файл

@ -62,108 +62,6 @@ func TestMerge_DNSPrefix(t *testing.T) {
}
}
func TestMerge_EnableRBAC(t *testing.T) {
newMC := &ManagedCluster{
Properties: &Properties{
EnableRBAC: nil,
},
}
existingMC := &ManagedCluster{
Properties: &Properties{
DNSPrefix: "something",
EnableRBAC: helpers.PointerToBool(false),
},
}
e := newMC.Merge(existingMC)
if e != nil {
t.Error("expect error to be nil")
}
if newMC.Properties.EnableRBAC == nil || *newMC.Properties.EnableRBAC != false {
t.Error("expect EnableRBAC to be same with existing when omit in updating")
}
newMC = &ManagedCluster{
Properties: &Properties{
EnableRBAC: nil,
},
}
existingMC = &ManagedCluster{
Properties: &Properties{
DNSPrefix: "something",
EnableRBAC: helpers.PointerToBool(true),
},
}
e = newMC.Merge(existingMC)
if e != nil {
t.Error("expect error to be nil")
}
if newMC.Properties.EnableRBAC == nil || *newMC.Properties.EnableRBAC != true {
t.Error("expect EnableRBAC to be same with existing when omit in updating")
}
newMC = &ManagedCluster{
Properties: &Properties{
EnableRBAC: nil,
},
}
existingMC = &ManagedCluster{
Properties: &Properties{
DNSPrefix: "something",
EnableRBAC: nil,
},
}
e = newMC.Merge(existingMC)
if e == nil {
t.Error("expect error not to be nil")
}
newMC = &ManagedCluster{
Properties: &Properties{
EnableRBAC: helpers.PointerToBool(true),
},
}
existingMC = &ManagedCluster{
Properties: &Properties{
DNSPrefix: "something",
EnableRBAC: helpers.PointerToBool(true),
},
}
e = newMC.Merge(existingMC)
if e != nil {
t.Error("expect error to be nil")
}
if newMC.Properties.EnableRBAC == nil || *newMC.Properties.EnableRBAC != true {
t.Error("expect EnableRBAC to be true")
}
newMC = &ManagedCluster{
Properties: &Properties{
EnableRBAC: helpers.PointerToBool(false),
},
}
existingMC = &ManagedCluster{
Properties: &Properties{
DNSPrefix: "something",
EnableRBAC: helpers.PointerToBool(true),
},
}
e = newMC.Merge(existingMC)
if e == nil {
t.Error("expect error to be nil")
}
}
func TestMerge_AAD(t *testing.T) {
// Partial AAD profile was passed during update
newMC := &ManagedCluster{