Skip to content

Commit

Permalink
UT fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nelljerram committed Jan 23, 2025
1 parent 799a27d commit a0b7396
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
18 changes: 1 addition & 17 deletions pkg/render/gateway_api.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2024 Tigera, Inc. All rights reserved.
// Copyright (c) 2024-2025 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -293,34 +293,18 @@ func GatewayAPIResourcesGetter() func() *gatewayAPIResources {

// Further assumptions that we rely on below in `Objects()`. We put these
// here, instead of later, so that they are verified in UT.
defaultGatewayImage, _ := components.GetReference(components.ComponentGatewayAPIEnvoyGateway, "", "", "", nil)
defaultRatelimitImage, _ := components.GetReference(components.ComponentGatewayAPIEnvoyRatelimit, "", "", "", nil)
if len(resources.controllerDeployment.Spec.Template.Spec.Containers) != 1 {
panic("expected 1 container in deployment from gateway API YAML")
}
if resources.controllerDeployment.Spec.Template.Spec.Containers[0].Name != EnvoyGatewayDeploymentContainerName {
panic("expected container name 'envoy-gateway' in deployment from gateway API YAML")
}
if resources.controllerDeployment.Spec.Template.Spec.Containers[0].Image != defaultGatewayImage {
panic(fmt.Sprintf("unexpected image in deployment from gateway API YAML (%v != %v)",
resources.controllerDeployment.Spec.Template.Spec.Containers[0].Image,
defaultGatewayImage))
}
if len(resources.certgenJob.Spec.Template.Spec.Containers) != 1 {
panic("expected 1 container in certgen job from gateway API YAML")
}
if resources.certgenJob.Spec.Template.Spec.Containers[0].Name != EnvoyGatewayJobContainerName {
panic("expected container name 'envoy-gateway' in certgen job from gateway API YAML")
}
if resources.certgenJob.Spec.Template.Spec.Containers[0].Image != defaultGatewayImage {
panic("unexpected image in certgen job from gateway API YAML")
}
if *resources.envoyGatewayConfig.Provider.Kubernetes.RateLimitDeployment.Container.Image != defaultRatelimitImage {
panic("wrong ratelimit image in envoy-gateway-config from gateway API YAML")
}
if *resources.envoyGatewayConfig.Provider.Kubernetes.ShutdownManager.Image != defaultGatewayImage {
panic("wrong gateway image in envoy-gateway-config from gateway API YAML")
}
}
return resources
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/render/gateway_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,15 @@ var _ = Describe("Gateway API rendering tests", func() {
Expect(err).NotTo(HaveOccurred())
Expect(deploy.Spec.Template.Spec.Containers).To(ContainElement(And(
HaveField("Name", "envoy-gateway"),
HaveField("Image", "myregistry.io/envoyproxy/gateway:v1.1.2"),
HaveField("Image", "myregistry.io/tigera/envoy-gateway:master"),
)))
Expect(deploy.Spec.Template.Spec.ImagePullSecrets).To(ContainElement(pullSecretRefs[0]))

job, err := rtest.GetResourceOfType[*batchv1.Job](objsToCreate, "tigera-gateway-api-gateway-helm-certgen", "tigera-gateway")
Expect(err).NotTo(HaveOccurred())
Expect(job.Spec.Template.Spec.Containers).To(ContainElement(And(
HaveField("Name", "envoy-gateway-certgen"),
HaveField("Image", "myregistry.io/envoyproxy/gateway:v1.1.2"),
HaveField("Image", "myregistry.io/tigera/envoy-gateway:master"),
)))
Expect(job.Spec.Template.Spec.ImagePullSecrets).To(ContainElement(pullSecretRefs[0]))

Expand Down

0 comments on commit a0b7396

Please sign in to comment.