Skip to content

Commit

Permalink
update e2e to use latest version of operator (Azure#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverMKing authored Mar 12, 2024
1 parent ae1b243 commit 28ec1b6
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
11 changes: 8 additions & 3 deletions testing/e2e/manifests/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ var (
"app": "app-routing-operator",
}

// AllOperatorVersions is a list of all the operator versions
AllOperatorVersions = []OperatorVersion{OperatorVersion0_0_3, OperatorVersionLatest}
// AllUsedOperatorVersions is a list of all the operator versions used today
AllUsedOperatorVersions = []OperatorVersion{OperatorVersion0_2_0, OperatorVersionLatest}

// AllDnsZoneCounts is a list of all the dns zone counts
AllDnsZoneCounts = []DnsZoneCount{DnsZoneCountNone, DnsZoneCountOne, DnsZoneCountMultiple}
Expand All @@ -40,6 +40,7 @@ type OperatorVersion uint

const (
OperatorVersion0_0_3 OperatorVersion = iota // use iota to number with earlier versions being lower numbers
OperatorVersion0_2_0

// OperatorVersionLatest represents the latest version of the operator which is essentially whatever code changes this test is running against
OperatorVersionLatest = math.MaxUint // this must always be the last/largest value in the enum because we order by value
Expand All @@ -49,6 +50,8 @@ func (o OperatorVersion) String() string {
switch o {
case OperatorVersion0_0_3:
return "0.0.3"
case OperatorVersion0_2_0:
return "0.2.0"
case OperatorVersionLatest:
return "latest"
default:
Expand Down Expand Up @@ -99,6 +102,8 @@ func (o *OperatorConfig) image(latestImage string) string {
switch o.Version {
case OperatorVersion0_0_3:
return "mcr.microsoft.com/aks/aks-app-routing-operator:0.0.3"
case OperatorVersion0_2_0:
return "mcr.microsoft.com/aks/aks-app-routing-operator:0.2.0"
case OperatorVersionLatest:
return latestImage
default:
Expand Down Expand Up @@ -289,7 +294,7 @@ func Operator(latestImage string, publicZones, privateZones []string, cfg *Opera
baseDeployment.Spec.Template.Spec.Containers[0].VolumeMounts = nil
baseDeployment.Spec.Template.Spec.Volumes = nil
ret = append(ret, baseDeployment)
case OperatorVersionLatest:
default:
ret = append(ret, baseDeployment)

if cleanDeploy {
Expand Down
4 changes: 2 additions & 2 deletions testing/e2e/suites/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func basicSuite(in infra.Provisioned) []test {
name: "basic ingress",
cfgs: builderFromInfra(in).
withOsm(in, false, true).
withVersions(manifests.AllOperatorVersions...).
withVersions(manifests.AllUsedOperatorVersions...).
withZones(manifests.NonZeroDnsZoneCounts, manifests.NonZeroDnsZoneCounts).
build(),
run: func(ctx context.Context, config *rest.Config, operator manifests.OperatorConfig) error {
Expand All @@ -47,7 +47,7 @@ func basicSuite(in infra.Provisioned) []test {
name: "basic service",
cfgs: builderFromInfra(in).
withOsm(in, false, true).
withVersions(manifests.AllOperatorVersions...).
withVersions(manifests.AllUsedOperatorVersions...).
withZones(manifests.NonZeroDnsZoneCounts, manifests.NonZeroDnsZoneCounts).
build(),
run: func(ctx context.Context, config *rest.Config, operator manifests.OperatorConfig) error {
Expand Down
15 changes: 9 additions & 6 deletions testing/e2e/suites/operatorConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,27 @@ type cfgBuilderWithOsm struct {
}

func (c cfgBuilder) withOsm(in infra.Provisioned, enabled ...bool) cfgBuilderWithOsm {
if len(enabled) == 0 {
enabled = []bool{false}
}

osms := make([]bool, 0, len(enabled))

osmCluster := false
if _, ok := in.Cluster.GetOptions()[clients.OsmClusterOpt.Name]; ok {
osmCluster = true
}

if len(enabled) == 0 {
enabled = []bool{osmCluster}
}

osms := make([]bool, 0, len(enabled))
for _, e := range enabled {
// osm tests can only work if the cluster has osm installed.
// filter out any enabled on clusters without osm
if !osmCluster && e {
continue
}

if osmCluster && !e {
continue
}

osms = append(osms, e)
}

Expand Down
4 changes: 2 additions & 2 deletions testing/e2e/suites/osm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func osmSuite(in infra.Provisioned) []test {
name: "osm ingress",
cfgs: builderFromInfra(in).
withOsm(in, true).
withVersions(manifests.AllOperatorVersions...).
withVersions(manifests.AllUsedOperatorVersions...).
withZones(manifests.AllDnsZoneCounts, manifests.AllDnsZoneCounts).build(),
run: func(ctx context.Context, config *rest.Config, operator manifests.OperatorConfig) error {
if err := clientServerTest(ctx, config, operator, osmNs, in,
Expand All @@ -41,7 +41,7 @@ func osmSuite(in infra.Provisioned) []test {
name: "osm service",
cfgs: builderFromInfra(in).
withOsm(in, true).
withVersions(manifests.AllOperatorVersions...).
withVersions(manifests.AllUsedOperatorVersions...).
withZones(manifests.AllDnsZoneCounts, manifests.AllDnsZoneCounts).build(),
run: func(ctx context.Context, config *rest.Config, operator manifests.OperatorConfig) error {
if err := clientServerTest(ctx, config, operator, osmNs, in,
Expand Down
2 changes: 1 addition & 1 deletion testing/e2e/suites/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func promSuite(in infra.Provisioned) []test {
name: "ingress prometheus metrics",
cfgs: builderFromInfra(in).
withOsm(in, false, true).
withVersions(manifests.AllOperatorVersions...).
withVersions(manifests.AllUsedOperatorVersions...).
withZones(manifests.AllDnsZoneCounts, manifests.AllDnsZoneCounts).
build(),
run: func(ctx context.Context, config *rest.Config, operator manifests.OperatorConfig) error {
Expand Down

0 comments on commit 28ec1b6

Please sign in to comment.