Skip to content

Commit

Permalink
Merge pull request #5138 from shiftstack/az
Browse files Browse the repository at this point in the history
NO-JIRA: openstack/e2e: allow to change AZ name
  • Loading branch information
openshift-merge-bot[bot] authored Dec 9, 2024
2 parents 9c85495 + d8709e2 commit 3f21b14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 2 additions & 3 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,8 @@ func (p *options) DefaultOpenStackOptions() hypershiftopenstack.RawCreateOptions
OpenStackExternalNetworkID: p.configurableClusterOptions.OpenStackExternalNetworkID,
NodePoolOpts: &openstacknodepool.RawOpenStackPlatformCreateOptions{
OpenStackPlatformOptions: &openstacknodepool.OpenStackPlatformOptions{
Flavor: p.configurableClusterOptions.OpenStackNodeFlavor,
ImageName: p.configurableClusterOptions.OpenStackNodeImageName,
AvailabityZone: p.configurableClusterOptions.OpenStackNodeAvailabilityZone,
Flavor: p.configurableClusterOptions.OpenStackNodeFlavor,
ImageName: p.configurableClusterOptions.OpenStackNodeImageName,
},
},
}
Expand Down
13 changes: 10 additions & 3 deletions test/e2e/nodepool_osp_az_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (o OpenStackAZTest) Run(t *testing.T, nodePool hyperv1.NodePool, _ []corev1
return want == got, fmt.Sprintf("expected NodePool to have platform %s, got %s", want, got), nil
},
func(pool *hyperv1.NodePool) (done bool, reasons string, err error) {
diff := cmp.Diff(defaultAvailabilityZone, ptr.Deref(np.Spec.Platform.OpenStack, hyperv1.OpenStackNodePoolPlatform{}).AvailabilityZone)
diff := cmp.Diff(getAZName(), ptr.Deref(np.Spec.Platform.OpenStack, hyperv1.OpenStackNodePoolPlatform{}).AvailabilityZone)
return diff == "", fmt.Sprintf("incorrect availability zone: %v", diff), nil
},
},
Expand All @@ -88,7 +88,7 @@ func (o OpenStackAZTest) Run(t *testing.T, nodePool hyperv1.NodePool, _ []corev1
if machine.Spec.FailureDomain == nil {
return false, "Machine does not have a failure domain", nil
}
want, got := defaultAvailabilityZone, *machine.Spec.FailureDomain
want, got := getAZName(), *machine.Spec.FailureDomain
return want == got, fmt.Sprintf("expected Machine to have failure domain %s, got %s", want, got), nil
},
},
Expand All @@ -105,10 +105,17 @@ func (o OpenStackAZTest) BuildNodePoolManifest(defaultNodepool hyperv1.NodePool)
defaultNodepool.Spec.DeepCopyInto(&nodePool.Spec)

nodePool.Spec.Replicas = &oneReplicas
nodePool.Spec.Platform.OpenStack.AvailabilityZone = defaultAvailabilityZone
nodePool.Spec.Platform.OpenStack.AvailabilityZone = getAZName()
return nodePool, nil
}

func getAZName() string {
if globalOpts.configurableClusterOptions.OpenStackNodeAvailabilityZone != "" {
return globalOpts.configurableClusterOptions.OpenStackNodeAvailabilityZone
}
return defaultAvailabilityZone
}

func (o OpenStackAZTest) SetupInfra(t *testing.T) error {
return nil
}
Expand Down

0 comments on commit 3f21b14

Please sign in to comment.