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

Commit

Permalink
test: fix UT expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
mboersma committed Feb 18, 2021
1 parent 4f7e21d commit 14482e6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions pkg/api/vlabs/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4593,7 +4593,7 @@ func TestValidateLocation(t *testing.T) {
},
OrchestratorProfile: &OrchestratorProfile{
OrchestratorType: Kubernetes,
OrchestratorVersion: common.RationalizeReleaseAndVersion(Kubernetes, "", "", false, false, false),
OrchestratorVersion: common.RationalizeReleaseAndVersion(Kubernetes, "", "", false, false, true),
KubernetesConfig: &KubernetesConfig{
UseInstanceMetadata: to.BoolPtr(trueVal),
},
Expand All @@ -4614,7 +4614,7 @@ func TestValidateLocation(t *testing.T) {
},
OrchestratorProfile: &OrchestratorProfile{
OrchestratorType: Kubernetes,
OrchestratorVersion: common.RationalizeReleaseAndVersion(Kubernetes, "", "", false, false, false),
OrchestratorVersion: common.RationalizeReleaseAndVersion(Kubernetes, "", "", false, false, true),
KubernetesConfig: &KubernetesConfig{
EtcdDiskSizeGB: "1024",
},
Expand All @@ -4635,7 +4635,7 @@ func TestValidateLocation(t *testing.T) {
},
OrchestratorProfile: &OrchestratorProfile{
OrchestratorType: Kubernetes,
OrchestratorVersion: common.RationalizeReleaseAndVersion(Kubernetes, "", "", false, false, false),
OrchestratorVersion: common.RationalizeReleaseAndVersion(Kubernetes, "", "", false, false, true),
KubernetesConfig: &KubernetesConfig{
EtcdDiskSizeGB: "1024GB",
},
Expand All @@ -4656,7 +4656,7 @@ func TestValidateLocation(t *testing.T) {
},
OrchestratorProfile: &OrchestratorProfile{
OrchestratorType: Kubernetes,
OrchestratorVersion: common.RationalizeReleaseAndVersion(Kubernetes, "", "", false, false, false),
OrchestratorVersion: common.RationalizeReleaseAndVersion(Kubernetes, "", "", false, false, true),
},
AgentPoolProfiles: []*AgentPoolProfile{
{
Expand All @@ -4682,7 +4682,7 @@ func TestValidateLocation(t *testing.T) {
},
OrchestratorProfile: &OrchestratorProfile{
OrchestratorType: Kubernetes,
OrchestratorVersion: common.RationalizeReleaseAndVersion(Kubernetes, "", "", false, false, false),
OrchestratorVersion: common.RationalizeReleaseAndVersion(Kubernetes, "", "", false, false, true),
},
AgentPoolProfiles: []*AgentPoolProfile{
{
Expand Down
34 changes: 17 additions & 17 deletions pkg/operations/kubernetesupgrade/upgradecluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {
})

It("Should succeed when cluster VMs are missing expected tags during upgrade operation", func() {
cs := api.CreateMockContainerService("testcluster", "1.18.15", 1, 1, false)
cs := api.CreateMockContainerService("testcluster", "1.18.16", 1, 1, false)
uc := UpgradeCluster{
Translator: &i18n.Translator{},
Logger: log.NewEntry(log.New()),
Expand All @@ -87,7 +87,7 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {
})

It("Should return error message when failing to list VMs during upgrade operation", func() {
cs := api.CreateMockContainerService("testcluster", "1.18.15", 1, 1, false)
cs := api.CreateMockContainerService("testcluster", "1.18.16", 1, 1, false)
uc := UpgradeCluster{
Translator: &i18n.Translator{},
Logger: log.NewEntry(log.New()),
Expand All @@ -113,7 +113,7 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {
})

It("Should return error message when failing to delete VMs during upgrade operation", func() {
cs := api.CreateMockContainerService("testcluster", "1.18.15", 1, 1, false)
cs := api.CreateMockContainerService("testcluster", "1.18.16", 1, 1, false)
uc := UpgradeCluster{
Translator: &i18n.Translator{},
Logger: log.NewEntry(log.New()),
Expand All @@ -136,7 +136,7 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {
})

It("Should return error message when failing to deploy template during upgrade operation", func() {
cs := api.CreateMockContainerService("testcluster", "1.18.15", 1, 1, false)
cs := api.CreateMockContainerService("testcluster", "1.18.16", 1, 1, false)
uc := UpgradeCluster{
Translator: &i18n.Translator{},
Logger: log.NewEntry(log.New()),
Expand All @@ -159,7 +159,7 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {
})

It("Should return error message when failing to get a virtual machine during upgrade operation", func() {
cs := api.CreateMockContainerService("testcluster", "1.18.15", 1, 6, false)
cs := api.CreateMockContainerService("testcluster", "1.18.16", 1, 6, false)
uc := UpgradeCluster{
Translator: &i18n.Translator{},
Logger: log.NewEntry(log.New()),
Expand All @@ -182,7 +182,7 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {
})

It("Should return error message when failing to get storage client during upgrade operation", func() {
cs := api.CreateMockContainerService("testcluster", "1.18.15", 5, 1, false)
cs := api.CreateMockContainerService("testcluster", "1.18.16", 5, 1, false)
uc := UpgradeCluster{
Translator: &i18n.Translator{},
Logger: log.NewEntry(log.New()),
Expand All @@ -205,7 +205,7 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {
})

It("Should return error message when failing to delete network interface during upgrade operation", func() {
cs := api.CreateMockContainerService("testcluster", "1.18.15", 3, 2, false)
cs := api.CreateMockContainerService("testcluster", "1.18.16", 3, 2, false)
uc := UpgradeCluster{
Translator: &i18n.Translator{},
Logger: log.NewEntry(log.New()),
Expand All @@ -228,7 +228,7 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {
})

It("Should return error message when failing to delete role assignment during upgrade operation", func() {
cs := api.CreateMockContainerService("testcluster", "1.18.15", 3, 2, false)
cs := api.CreateMockContainerService("testcluster", "1.18.16", 3, 2, false)
cs.Properties.OrchestratorProfile.KubernetesConfig = &api.KubernetesConfig{}
cs.Properties.OrchestratorProfile.KubernetesConfig.UseManagedIdentity = to.BoolPtr(true)
uc := UpgradeCluster{
Expand Down Expand Up @@ -262,7 +262,7 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {

BeforeEach(func() {
mockClient = armhelpers.MockAKSEngineClient{MockKubernetesClient: &armhelpers.MockKubernetesClient{}}
cs = api.CreateMockContainerService("testcluster", "1.18.15", 3, 3, false)
cs = api.CreateMockContainerService("testcluster", "1.18.16", 3, 3, false)
uc = UpgradeCluster{
Translator: &i18n.Translator{},
Logger: log.NewEntry(log.New()),
Expand Down Expand Up @@ -291,10 +291,10 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {
It("Should skip VMs that are already on desired version", func() {
mockClient.FakeListVirtualMachineScaleSetVMsResult = func() []compute.VirtualMachineScaleSetVM {
return []compute.VirtualMachineScaleSetVM{
mockClient.MakeFakeVirtualMachineScaleSetVM("Kubernetes:1.18.15"),
mockClient.MakeFakeVirtualMachineScaleSetVM("Kubernetes:1.18.16"),
mockClient.MakeFakeVirtualMachineScaleSetVM("Kubernetes:1.18.10"),
mockClient.MakeFakeVirtualMachineScaleSetVM("Kubernetes:1.18.9"),
mockClient.MakeFakeVirtualMachineScaleSetVM("Kubernetes:1.18.15"),
mockClient.MakeFakeVirtualMachineScaleSetVM("Kubernetes:1.18.16"),
}
}
uc.Force = false
Expand Down Expand Up @@ -362,9 +362,9 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {
It("Should use kubernetes api to get node versions for VMSS when latest model is not applied", func() {
trueVar := true
falseVar := false
vmWithoutLatestModelApplied := mockClient.MakeFakeVirtualMachineScaleSetVMWithGivenName("Kubernetes:1.18.15", "vmWithoutLatestModelApplied!")
vmWithoutLatestModelApplied := mockClient.MakeFakeVirtualMachineScaleSetVMWithGivenName("Kubernetes:1.18.16", "vmWithoutLatestModelApplied!")
vmWithoutLatestModelApplied.VirtualMachineScaleSetVMProperties.LatestModelApplied = &falseVar
vmWithLatestModelApplied := mockClient.MakeFakeVirtualMachineScaleSetVMWithGivenName("Kubernetes:1.18.15", "vmWithLatestModelApplied")
vmWithLatestModelApplied := mockClient.MakeFakeVirtualMachineScaleSetVMWithGivenName("Kubernetes:1.18.16", "vmWithLatestModelApplied")
vmWithLatestModelApplied.VirtualMachineScaleSetVMProperties.LatestModelApplied = &trueVar

mockClient.MockKubernetesClient.GetNodeFunc = func(name string) (*v1.Node, error) {
Expand Down Expand Up @@ -622,7 +622,7 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {
Expect(*uc.UpgradedMasterVMs).To(HaveLen(0))
})
It("Should leave platform fault domain count nil", func() {
cs := api.CreateMockContainerService("testcluster", "1.18.15", 3, 2, false)
cs := api.CreateMockContainerService("testcluster", "1.18.16", 3, 2, false)
cs.Properties.OrchestratorProfile.KubernetesConfig = &api.KubernetesConfig{}
cs.Properties.OrchestratorProfile.KubernetesConfig.UseManagedIdentity = to.BoolPtr(true)
cs.Properties.MasterProfile.AvailabilityProfile = "AvailabilitySet"
Expand Down Expand Up @@ -715,7 +715,7 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {
})

It("Should not fail if no managed identity is returned by azure during upgrade operation", func() {
cs := api.CreateMockContainerService("testcluster", "1.18.15", 3, 2, false)
cs := api.CreateMockContainerService("testcluster", "1.18.16", 3, 2, false)
cs.Properties.OrchestratorProfile.KubernetesConfig = &api.KubernetesConfig{}
cs.Properties.OrchestratorProfile.KubernetesConfig.UseManagedIdentity = to.BoolPtr(true)
uc := UpgradeCluster{
Expand All @@ -738,7 +738,7 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {
})

It("Should not fail if a Kubernetes client cannot be created", func() {
cs := api.CreateMockContainerService("testcluster", "1.18.15", 3, 2, false)
cs := api.CreateMockContainerService("testcluster", "1.18.16", 3, 2, false)
uc := UpgradeCluster{
Translator: &i18n.Translator{},
Logger: log.NewEntry(log.New()),
Expand Down Expand Up @@ -772,7 +772,7 @@ var _ = Describe("Upgrade Kubernetes cluster tests", func() {
})

It("Should fail if cluster-autoscaler cannot be paused unless --force is specified", func() {
cs := api.CreateMockContainerService("testcluster", "1.18.15", 3, 2, false)
cs := api.CreateMockContainerService("testcluster", "1.18.16", 3, 2, false)
enabled := true
addon := api.KubernetesAddon{
Name: "cluster-autoscaler",
Expand Down

0 comments on commit 14482e6

Please sign in to comment.