Skip to content

Commit 481e275

Browse files
dtfranzopenshift-merge-bot[bot]
authored andcommitted
UPSTREAM: <carry>: Enable upstream e2e in 4.18
Signed-off-by: dtfranz <[email protected]>
1 parent a965479 commit 481e275

File tree

3 files changed

+139
-2
lines changed

3 files changed

+139
-2
lines changed

Diff for: openshift/Makefile

+14-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ manifests: $(KUSTOMIZE) $(YQ)
2121
verify-manifests: manifests
2222
git diff --exit-code
2323

24+
E2E_REGISTRY_NAME=docker-registry
25+
E2E_REGISTRY_NAMESPACE=operator-controller-e2e
26+
export LOCAL_REGISTRY_HOST := $(E2E_REGISTRY_NAME).$(E2E_REGISTRY_NAMESPACE).svc:5000
27+
export CLUSTER_REGISTRY_HOST := $(E2E_REGISTRY_NAME).$(E2E_REGISTRY_NAMESPACE).svc:5000
28+
export REG_PKG_NAME := registry-operator
29+
export E2E_TEST_CATALOG_V1 := e2e/test-catalog:v1
30+
export E2E_TEST_CATALOG_V2 := e2e/test-catalog:v2
31+
export CATALOG_IMG := $(LOCAL_REGISTRY_HOST)/$(E2E_TEST_CATALOG_V1)
32+
# Order matters here, the ".../registries.conf" entry must be last.
33+
export DOWNSTREAM_E2E_FLAGS := -count=1 -v -skip 'TestClusterExtensionInstallReResolvesWhenNewCatalog|TestClusterExtensionInstallRegistryDynamic|TestClusterExtensionInstallRegistry/package_requires_mirror_registry_configuration_in_/etc/containers/registries.conf'
2434
.PHONY: test-e2e
25-
test-e2e: ## Run the e2e tests. TODO: stub until tests are working downstream
26-
/bin/true
35+
test-e2e: ## Run the e2e tests.
36+
$(DIR)/build-test-registry.sh $(E2E_REGISTRY_NAMESPACE) $(E2E_REGISTRY_NAME) $(E2E_REGISTRY_IMAGE)
37+
cd $(DIR)/../; \
38+
go test $(DOWNSTREAM_E2E_FLAGS) ./test/e2e/...;

Diff for: openshift/build-test-registry.sh

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
set -o nounset
5+
set -o pipefail
6+
7+
help="
8+
build-test-registry.sh is a script to stand up an image registry within a cluster.
9+
Usage:
10+
build-test-registry.sh [NAMESPACE] [NAME] [IMAGE]
11+
12+
Argument Descriptions:
13+
- NAMESPACE is the namespace that should be created and is the namespace in which the image registry will be created
14+
- NAME is the name that should be used for the image registry Deployment and Service
15+
- IMAGE is the name of the image that should be used to run the image registry
16+
"
17+
18+
if [[ "$#" -ne 3 ]]; then
19+
echo "Illegal number of arguments passed"
20+
echo "${help}"
21+
exit 1
22+
fi
23+
24+
namespace=$1
25+
name=$2
26+
image=$3
27+
28+
oc apply -f - << EOF
29+
---
30+
apiVersion: v1
31+
kind: Namespace
32+
metadata:
33+
name: ${namespace}
34+
---
35+
apiVersion: apps/v1
36+
kind: Deployment
37+
metadata:
38+
name: ${name}
39+
namespace: ${namespace}
40+
labels:
41+
app: registry
42+
spec:
43+
replicas: 1
44+
selector:
45+
matchLabels:
46+
app: registry
47+
template:
48+
metadata:
49+
labels:
50+
app: registry
51+
spec:
52+
containers:
53+
- name: registry
54+
image: ${image}
55+
imagePullPolicy: IfNotPresent
56+
command:
57+
- /registry
58+
args:
59+
- "--registry-address=:5000"
60+
volumeMounts:
61+
- mountPath: /var/certs
62+
name: operator-controller-e2e-certs
63+
env:
64+
- name: REGISTRY_HTTP_TLS_CERTIFICATE
65+
value: "/var/certs/tls.crt"
66+
- name: REGISTRY_HTTP_TLS_KEY
67+
value: "/var/certs/tls.key"
68+
volumes:
69+
- name: operator-controller-e2e-certs
70+
secret:
71+
optional: false
72+
secretName: operator-controller-e2e-certs
73+
---
74+
apiVersion: v1
75+
kind: Service
76+
metadata:
77+
name: ${name}
78+
namespace: ${namespace}
79+
annotations:
80+
service.beta.openshift.io/serving-cert-secret-name: operator-controller-e2e-certs
81+
spec:
82+
selector:
83+
app: registry
84+
ports:
85+
- name: http
86+
port: 5000
87+
targetPort: 5000
88+
type: NodePort
89+
EOF
90+
91+
oc wait --for=condition=Available -n "${namespace}" "deploy/${name}" --timeout=60s
92+
93+
oc apply -f - << EOF
94+
apiVersion: batch/v1
95+
kind: Job
96+
metadata:
97+
name: ${name}-push
98+
namespace: ${namespace}
99+
spec:
100+
template:
101+
spec:
102+
restartPolicy: Never
103+
containers:
104+
- name: push
105+
image: ${image}
106+
command:
107+
- /push
108+
args:
109+
- "--registry-address=${name}.${namespace}.svc:5000"
110+
- "--images-path=/images"
111+
volumeMounts:
112+
- mountPath: /var/certs
113+
name: operator-controller-e2e-certs
114+
env:
115+
- name: SSL_CERT_DIR
116+
value: "/var/certs/"
117+
volumes:
118+
- name: operator-controller-e2e-certs
119+
secret:
120+
optional: false
121+
secretName: operator-controller-e2e-certs
122+
EOF
123+
124+
oc wait --for=condition=Complete -n "${namespace}" "job/${name}-push" --timeout=60s

Diff for: openshift/registry.Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ USER 1001
1111
COPY --from=builder /build/registry /registry
1212
COPY --from=builder /build/push /push
1313
COPY openshift/manifests /openshift/manifests
14+
COPY testdata/images /images
1415

1516
LABEL io.k8s.display-name="OpenShift Operator Lifecycle Manager Operator Controller E2E Registry" \
1617
io.k8s.description="This is a registry image that is used during E2E testing of Operator Controller"

0 commit comments

Comments
 (0)