Skip to content

Commit fceb9f9

Browse files
committed
Update reconfig nfr test
1 parent de0fdc2 commit fceb9f9

File tree

8 files changed

+202
-340
lines changed

8 files changed

+202
-340
lines changed

tests/Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ build-test-runner-image: ## Build conformance test runner image
4444

4545
.PHONY: build-crossplane-image
4646
build-crossplane-image: ## Build the crossplane image
47-
docker build --build-arg NGINX_CONF_DIR=$(NGINX_CONF_DIR) -t nginx-crossplane:latest -f framework/crossplane/Dockerfile ..
47+
docker build --platform linux/$(GOARCH) --build-arg NGINX_CONF_DIR=$(NGINX_CONF_DIR) -t nginx-crossplane:latest -f framework/crossplane/Dockerfile ..
4848

4949
.PHONY: run-conformance-tests
5050
run-conformance-tests: ## Run conformance tests
@@ -104,8 +104,16 @@ create-gke-router: ## Create a GKE router to allow egress traffic from private n
104104
sync-files-to-vm: ## Syncs your local NGF files with the NGF repo on the VM
105105
./scripts/sync-files-to-vm.sh
106106

107+
108+
include scripts/vars.env
109+
export
110+
107111
.PHONY: nfr-test
108112
nfr-test: check-for-plus-usage-endpoint ## Run the NFR tests on a GCP VM
113+
nfr-test: GOARCH=amd64
114+
nfr-test: build-crossplane-image
115+
docker tag nginx-crossplane:latest $(PREFIX)/nginx-crossplane:latest
116+
docker push $(PREFIX)/nginx-crossplane:latest
109117
CI=$(CI) ./scripts/run-tests-gcp-vm.sh
110118

111119
.PHONY: start-longevity-test

tests/framework/crossplane.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,17 @@ func injectCrossplaneContainer(
144144
k8sClient kubernetes.Interface,
145145
timeout time.Duration,
146146
ngfPodName,
147-
namespace string,
147+
namespace,
148+
crossplaneImageRepo string,
148149
) error {
149150
ctx, cancel := context.WithTimeout(context.Background(), timeout)
150151
defer cancel()
151152

153+
image := "nginx-crossplane:latest"
154+
if crossplaneImageRepo != "" {
155+
image = crossplaneImageRepo + "/" + image
156+
}
157+
152158
pod := &core.Pod{
153159
ObjectMeta: metav1.ObjectMeta{
154160
Name: ngfPodName,
@@ -160,8 +166,8 @@ func injectCrossplaneContainer(
160166
TargetContainerName: "nginx",
161167
EphemeralContainerCommon: core.EphemeralContainerCommon{
162168
Name: "crossplane",
163-
Image: "nginx-crossplane:latest",
164-
ImagePullPolicy: "Never",
169+
Image: image,
170+
ImagePullPolicy: "IfNotPresent",
165171
Stdin: true,
166172
VolumeMounts: []core.VolumeMount{
167173
{

tests/framework/resourcemanager.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,12 +825,14 @@ func (rm *ResourceManager) WaitForGatewayObservedGeneration(
825825
}
826826

827827
// GetNginxConfig uses crossplane to get the nginx configuration and convert it to JSON.
828-
func (rm *ResourceManager) GetNginxConfig(nginxPodName, namespace string) (*Payload, error) {
828+
// If the crossplane image is loaded locally on the node, crossplaneImageRepo can be empty.
829+
func (rm *ResourceManager) GetNginxConfig(nginxPodName, namespace, crossplaneImageRepo string) (*Payload, error) {
829830
if err := injectCrossplaneContainer(
830831
rm.ClientGoClient,
831832
rm.TimeoutConfig.UpdateTimeout,
832833
nginxPodName,
833834
namespace,
835+
crossplaneImageRepo,
834836
); err != nil {
835837
return nil, err
836838
}

tests/suite/client_settings_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ var _ = Describe("ClientSettingsPolicy", Ordered, Label("functional", "cspolicy"
109109

110110
BeforeAll(func() {
111111
var err error
112-
conf, err = resourceManager.GetNginxConfig(nginxPodName, namespace)
112+
conf, err = resourceManager.GetNginxConfig(nginxPodName, namespace, "")
113113
Expect(err).ToNot(HaveOccurred())
114114
})
115115

tests/suite/manifests/reconfig/cafe-routes.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
spec:
66
parentRefs:
77
- name: gateway
8-
namespace: default
8+
namespace: reconfig
99
sectionName: http
1010
hostnames:
1111
- "cafe.example.com"
@@ -23,7 +23,7 @@ metadata:
2323
spec:
2424
parentRefs:
2525
- name: gateway
26-
namespace: default
26+
namespace: reconfig
2727
sectionName: https
2828
hostnames:
2929
- "cafe.example.com"
@@ -43,8 +43,8 @@ metadata:
4343
spec:
4444
parentRefs:
4545
- name: gateway
46+
namespace: reconfig
4647
sectionName: https
47-
namespace: default
4848
hostnames:
4949
- "cafe.example.com"
5050
rules:

0 commit comments

Comments
 (0)