Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
removing rbac error checking from merge fn (#3530)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrutir25 authored and jackfrancis committed Jul 25, 2018
1 parent 513ed45 commit ae1b0a6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 115 deletions.
13 changes: 0 additions & 13 deletions pkg/api/agentPoolOnlyApi/v20180331/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
102 changes: 0 additions & 102 deletions pkg/api/agentPoolOnlyApi/v20180331/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit ae1b0a6

Please sign in to comment.