Skip to content

Commit

Permalink
fix(tests): Fix the tests after GetTemplateID args changed
Browse files Browse the repository at this point in the history
  • Loading branch information
hrak committed Jul 9, 2024
1 parent 74f1355 commit 23e49f6
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions pkg/cloud/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ var _ = Describe("Instance", func() {
Id: dummies.CSMachine1.Spec.Offering.ID,
Name: dummies.CSMachine1.Spec.Offering.Name,
}, 1, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID).
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID, gomock.Any()).
Return("", -1, unknownError)
Ω(client.GetOrCreateVMInstance(
dummies.CSMachine1, dummies.CAPIMachine, dummies.CSFailureDomain1, dummies.CSAffinityGroup, "")).
Expand All @@ -184,7 +184,7 @@ var _ = Describe("Instance", func() {
Id: dummies.CSMachine1.Spec.Offering.ID,
Name: dummies.CSMachine1.Spec.Offering.Name,
}, 1, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID).Return("", 2, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID, gomock.Any()).Return("", 2, nil)
Ω(client.GetOrCreateVMInstance(
dummies.CSMachine1, dummies.CAPIMachine, dummies.CSFailureDomain1, dummies.CSAffinityGroup, "")).
ShouldNot(Succeed())
Expand All @@ -198,7 +198,7 @@ var _ = Describe("Instance", func() {
Id: dummies.CSMachine1.Spec.Offering.ID,
Name: dummies.CSMachine1.Spec.Offering.Name,
}, 1, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID).Return(dummies.CSMachine1.Spec.Template.ID, 1, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID, gomock.Any()).Return(dummies.CSMachine1.Spec.Template.ID, 1, nil)
dos.EXPECT().GetDiskOfferingID(dummies.CSMachine1.Spec.DiskOffering.Name, gomock.Any()).Return(diskOfferingFakeID, 2, nil)
Ω(client.GetOrCreateVMInstance(
dummies.CSMachine1, dummies.CAPIMachine, dummies.CSFailureDomain1, dummies.CSAffinityGroup, "")).
Expand All @@ -212,7 +212,7 @@ var _ = Describe("Instance", func() {
Id: dummies.CSMachine1.Spec.Offering.ID,
Name: dummies.CSMachine1.Spec.Offering.Name,
}, 1, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID).Return(dummies.CSMachine1.Spec.Template.ID, 1, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID, gomock.Any()).Return(dummies.CSMachine1.Spec.Template.ID, 1, nil)
dos.EXPECT().GetDiskOfferingID(dummies.CSMachine1.Spec.DiskOffering.Name, gomock.Any()).Return(diskOfferingFakeID, 1, nil)
dos.EXPECT().GetDiskOfferingByID(diskOfferingFakeID).Return(&cloudstack.DiskOffering{Iscustomized: false}, 1, unknownError)
Ω(client.GetOrCreateVMInstance(
Expand All @@ -228,7 +228,7 @@ var _ = Describe("Instance", func() {
Id: dummies.CSMachine1.Spec.Offering.ID,
Name: dummies.CSMachine1.Spec.Offering.Name,
}, 1, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID).Return(dummies.CSMachine1.Spec.Template.ID, 1, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID, gomock.Any()).Return(dummies.CSMachine1.Spec.Template.ID, 1, nil)
dos.EXPECT().GetDiskOfferingID(dummies.CSMachine1.Spec.DiskOffering.Name, gomock.Any()).Return(diskOfferingFakeID, 1, nil)
dos.EXPECT().GetDiskOfferingByID(diskOfferingFakeID).Return(&cloudstack.DiskOffering{Iscustomized: false}, 1, nil)
Ω(client.GetOrCreateVMInstance(
Expand All @@ -246,7 +246,7 @@ var _ = Describe("Instance", func() {
Cpunumber: 1,
Memory: 1024,
}, 1, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID).Return(dummies.CSMachine1.Spec.Template.ID, 1, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID, gomock.Any()).Return(dummies.CSMachine1.Spec.Template.ID, 1, nil)
dos.EXPECT().GetDiskOfferingID(dummies.CSMachine1.Spec.DiskOffering.Name, gomock.Any()).Return(diskOfferingFakeID, 1, nil)
dos.EXPECT().GetDiskOfferingByID(diskOfferingFakeID).Return(&cloudstack.DiskOffering{Iscustomized: true}, 1, nil)
Ω(client.GetOrCreateVMInstance(
Expand Down Expand Up @@ -433,7 +433,7 @@ var _ = Describe("Instance", func() {
Cpunumber: 1,
Memory: 1024,
}, 1, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID).
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID, gomock.Any()).
Return(templateFakeID, 1, nil)
dos.EXPECT().GetDiskOfferingID(dummies.CSMachine1.Spec.DiskOffering.Name, gomock.Any()).
Return(diskOfferingFakeID, 1, nil)
Expand Down Expand Up @@ -504,7 +504,7 @@ var _ = Describe("Instance", func() {
}, 1, nil)
dos.EXPECT().GetDiskOfferingID(dummies.CSMachine1.Spec.DiskOffering.Name, gomock.Any()).Return(diskOfferingFakeID, 1, nil)
dos.EXPECT().GetDiskOfferingByID(dummies.CSMachine1.Spec.DiskOffering.ID).Return(&cloudstack.DiskOffering{Iscustomized: false}, 1, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID).
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID, gomock.Any()).
Return(templateFakeID, 1, nil)

ActionAndAssert()
Expand All @@ -522,7 +522,7 @@ var _ = Describe("Instance", func() {
Cpunumber: 1,
Memory: 1024,
}, 1, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID).
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID, gomock.Any()).
Return(templateFakeID, 1, nil)

ActionAndAssert()
Expand All @@ -540,7 +540,7 @@ var _ = Describe("Instance", func() {
Cpunumber: 1,
Memory: 1024,
}, 1, nil)
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID).
ts.EXPECT().GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID, gomock.Any()).
Return(templateFakeID, 1, nil)
dos.EXPECT().GetDiskOfferingID(dummies.CSMachine1.Spec.DiskOffering.Name, gomock.Any()).Return(diskOfferingFakeID, 1, nil)
dos.EXPECT().GetDiskOfferingByID(dummies.CSMachine1.Spec.DiskOffering.ID).Return(&cloudstack.DiskOffering{Iscustomized: false}, 1, nil)
Expand Down Expand Up @@ -696,7 +696,7 @@ var _ = Describe("Instance", func() {
GetDiskOfferingByID(dummies.CSMachine1.Spec.DiskOffering.ID).
Return(&cloudstack.DiskOffering{Iscustomized: false}, 1, nil)
ts.EXPECT().
GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID).
GetTemplateID(dummies.CSMachine1.Spec.Template.Name, executableFilter, dummies.Zone1.ID, gomock.Any()).
Return(templateFakeID, 1, nil)
vms.EXPECT().
NewDeployVirtualMachineParams(offeringFakeID, templateFakeID, dummies.Zone1.ID).
Expand Down

0 comments on commit 23e49f6

Please sign in to comment.