Skip to content

Commit

Permalink
update with PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tzneal committed Mar 24, 2022
1 parent 85f1dc4 commit f33a1b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions pkg/cloudprovider/fake/instancetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ func NewInstanceType(options InstanceTypeOptions) *InstanceType {
}
}

// InstanceTypesAssorted create 1000+ unique instance types with varying CPU/memory/architecture/OS/zone/capacity type.
// InstanceTypesAssorted create many unique instance types with varying CPU/memory/architecture/OS/zone/capacity type.
func InstanceTypesAssorted() []cloudprovider.InstanceType {
var instanceTypes []cloudprovider.InstanceType
for _, cpu := range []int{1, 2, 4, 8, 16, 32, 64} {
for _, mem := range []int{1, 2, 4, 8, 16, 32, 64, 128} {
for _, zone := range []string{"test-zone-1", "test-zone-2"} {
for _, zone := range []string{"test-zone-1", "test-zone-2", "test-zone-3"} {
for _, ct := range []string{v1alpha1.CapacityTypeSpot, v1alpha1.CapacityTypeOnDemand} {
for _, os := range []sets.String{sets.NewString("darwin"), sets.NewString("linux"), sets.NewString("windows")} {
for _, os := range []sets.String{sets.NewString("linux"), sets.NewString("windows")} {
for _, arch := range []string{v1alpha5.ArchitectureAmd64, v1alpha5.ArchitectureArm64} {
it := NewInstanceType(InstanceTypeOptions{
Name: fmt.Sprintf("%d-cpu-%d-mem-%s-%s-%s-%s", cpu, mem, arch, strings.Join(os.List(), ","), zone, ct),
Expand Down
20 changes: 10 additions & 10 deletions pkg/controllers/provisioning/scheduling/instance_selection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,40 +145,40 @@ var _ = Describe("Instance Type Selection", func() {
Expect(nodePrice(node)).To(Equal(minPrice))
ExpectInstancesWithLabel(cloudProv.CreateCalls[0].InstanceTypes, v1.LabelOSStable, "windows")
})
It("should schedule on one of the cheapest instances (prov os = darwin)", func() {
It("should schedule on one of the cheapest instances (prov os = windows)", func() {
provisioner.Spec.Requirements.Requirements = []v1.NodeSelectorRequirement{
{
Key: v1.LabelOSStable,
Operator: v1.NodeSelectorOpIn,
Values: []string{"darwin"},
Values: []string{"windows"},
},
}
pod := ExpectProvisioned(ctx, env.Client, selectionController, provisioners, provisioner, test.UnschedulablePod())
node := ExpectScheduled(ctx, env.Client, pod[0])
Expect(nodePrice(node)).To(Equal(minPrice))
ExpectInstancesWithLabel(cloudProv.CreateCalls[0].InstanceTypes, v1.LabelOSStable, "darwin")
ExpectInstancesWithLabel(cloudProv.CreateCalls[0].InstanceTypes, v1.LabelOSStable, "windows")
})
It("should schedule on one of the cheapest instances (pod os = darwin)", func() {
It("should schedule on one of the cheapest instances (pod os = linux)", func() {
pod := ExpectProvisioned(ctx, env.Client, selectionController, provisioners, provisioner, test.UnschedulablePod(
test.PodOptions{NodeRequirements: []v1.NodeSelectorRequirement{{
Key: v1.LabelOSStable,
Operator: v1.NodeSelectorOpIn,
Values: []string{"darwin"},
Values: []string{"linux"},
}}}))
node := ExpectScheduled(ctx, env.Client, pod[0])
Expect(nodePrice(node)).To(Equal(minPrice))
ExpectInstancesWithLabel(cloudProv.CreateCalls[0].InstanceTypes, v1.LabelOSStable, "darwin")
ExpectInstancesWithLabel(cloudProv.CreateCalls[0].InstanceTypes, v1.LabelOSStable, "linux")
})
It("should schedule on one of the cheapest instances (pod os = darwin)", func() {
It("should schedule on one of the cheapest instances (pod os = linux)", func() {
pod := ExpectProvisioned(ctx, env.Client, selectionController, provisioners, provisioner, test.UnschedulablePod(
test.PodOptions{NodeRequirements: []v1.NodeSelectorRequirement{{
Key: v1.LabelOSStable,
Operator: v1.NodeSelectorOpIn,
Values: []string{"darwin"},
Values: []string{"linux"},
}}}))
node := ExpectScheduled(ctx, env.Client, pod[0])
Expect(nodePrice(node)).To(Equal(minPrice))
ExpectInstancesWithLabel(cloudProv.CreateCalls[0].InstanceTypes, v1.LabelOSStable, "darwin")
ExpectInstancesWithLabel(cloudProv.CreateCalls[0].InstanceTypes, v1.LabelOSStable, "linux")
})
It("should schedule on one of the cheapest instances (prov zone = test-zone-2)", func() {
provisioner.Spec.Requirements.Requirements = []v1.NodeSelectorRequirement{
Expand Down Expand Up @@ -217,7 +217,7 @@ var _ = Describe("Instance Type Selection", func() {
Expect(nodePrice(node)).To(Equal(minPrice))
ExpectInstancesWithLabel(cloudProv.CreateCalls[0].InstanceTypes, v1alpha5.LabelCapacityType, v1alpha1.CapacityTypeSpot)
})
It("should schedule on one of the cheapest instances (pod zone = test-zone-2)", func() {
It("should schedule on one of the cheapest instances (pod ct = spot)", func() {
pod := ExpectProvisioned(ctx, env.Client, selectionController, provisioners, provisioner, test.UnschedulablePod(
test.PodOptions{NodeRequirements: []v1.NodeSelectorRequirement{{
Key: v1alpha5.LabelCapacityType,
Expand Down

0 comments on commit f33a1b7

Please sign in to comment.