Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions test/assets/router/error-page-404.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HTTP/1.0 404 Not Found
Connection: close
Content-Type: text/html

<html>
<head><title>Custom:Not Found</title></head>
<body>
<p>Custom error page:The requested document was not found.</p>
</body>
</html>
10 changes: 10 additions & 0 deletions test/assets/router/error-page-503.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HTTP/1.0 503 Service Unavailable
Connection: close
Content-Type: text/html

<html>
<head><title>Custom:Application Unavailable</title></head>
<body>
<p>Custom error page:The requested application is not available.</p>
</body>
</html>
19 changes: 19 additions & 0 deletions test/assets/router/microshift-ingress-destca.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-ms-reen
annotations:
route.openshift.io/destination-ca-certificate-secret: service-secret
route.openshift.io/termination: reencrypt
spec:
rules:
- host: service-secure-test.example.com
http:
paths:
- backend:
service:
name: service-secure
port:
number: 27443
path: "/"
pathType: Prefix
16 changes: 16 additions & 0 deletions test/assets/router/microshift-ingress-http.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-on-microshift
spec:
rules:
- host: service-unsecure-test.example.com
http:
paths:
- backend:
service:
name: service-unsecure
port:
number: 27017
path: "/"
pathType: Prefix
20 changes: 20 additions & 0 deletions test/assets/router/rsyslogd-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
kind: Pod
apiVersion: v1
metadata:
name: rsyslogd-pod
labels:
name: rsyslogd
spec:
containers:
- image: quay.io/openshifttest/rsyslogd-container@sha256:e806eb41f05d7cc6eec96bf09c7bcb692f97562d4a983cb019289bd048d9aee2
name: rsyslogd-container
securityContext:
privileged: true
ports:
- containerPort: 514
protocol: TCP
- containerPort: 514
protocol: UDP
resources:
limits:
memory: 340Mi
22 changes: 22 additions & 0 deletions test/assets/router/test-client-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v1
kind: Pod
metadata:
labels:
app: hello-pod
name: hello-pod
spec:
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
containers:
- image: quay.io/openshifttest/nginx-alpine@sha256:cee6930776b92dc1e93b73f9e5965925d49cff3d2e91e1d071c2f0ff72cbca29
name: hello-pod
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
ports:
- containerPort: 8080
- containerPort: 8443
57 changes: 57 additions & 0 deletions test/assets/router/web-server-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apiVersion: v1
kind: List
items:
- apiVersion: apps/v1
kind: Deployment
metadata:
name: web-server-deploy
labels:
app: web-server-deploy
spec:
replicas: 1
selector:
matchLabels:
name: web-server-deploy
template:
metadata:
labels:
name: web-server-deploy
spec:
containers:
- name: nginx
image: quay.io/openshifttest/nginx-alpine@sha256:cee6930776b92dc1e93b73f9e5965925d49cff3d2e91e1d071c2f0ff72cbca29
ports:
- containerPort: 8080
name: http
protocol: TCP
- containerPort: 8443
name: https
protocol: TCP
- kind: Service
apiVersion: v1
metadata:
labels:
name: service-secure
name: service-secure
spec:
ports:
- name: https
protocol: TCP
port: 27443
targetPort: 8443
selector:
name: web-server-deploy
- apiVersion: v1
kind: Service
metadata:
labels:
name: service-unsecure
name: service-unsecure
spec:
ports:
- name: http
port: 27017
protocol: TCP
targetPort: 8080
selector:
name: web-server-deploy
94 changes: 94 additions & 0 deletions test/assets/router/web-server-signed-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-config
data:
nginx.conf: |
events {
worker_connections 1024;
}

http {
server {
listen 8080;
listen [::]:8080;
location / {
root /data/http;
}
}

server {
listen 8443 ssl http2 default;
listen [::]:8443 ssl http2 default;
server_name _;
ssl_certificate certs/tls.crt;
ssl_certificate_key certs/tls.key;
location / {
root /data/https-default;
}
}
}
- apiVersion: apps/v1
kind: Deployment
metadata:
name: web-server-deploy
labels:
name: web-server-deploy
spec:
replicas: 1
selector:
matchExpressions:
- {key: name, operator: In, values: [web-server-deploy]}
template:
metadata:
labels:
name: web-server-deploy
spec:
containers:
- name: nginx
image: quay.io/openshifttest/nginx-alpine@sha256:cee6930776b92dc1e93b73f9e5965925d49cff3d2e91e1d071c2f0ff72cbca29
volumeMounts:
- name: service-secret
mountPath: /etc/nginx/certs/
- name: nginx-config
mountPath: /etc/nginx/
volumes:
Comment thread
agullon marked this conversation as resolved.
- name: service-secret
secret:
secretName: service-secret
- name: nginx-config
configMap:
name: nginx-config
- kind: Service
apiVersion: v1
metadata:
annotations:
service.beta.openshift.io/serving-cert-secret-name: service-secret
labels:
name: service-secure
name: service-secure
spec:
ports:
- name: https
protocol: TCP
port: 27443
targetPort: 8443
selector:
name: web-server-deploy
- apiVersion: v1
kind: Service
metadata:
labels:
name: service-unsecure
name: service-unsecure
spec:
ports:
- name: http
port: 27017
protocol: TCP
targetPort: 8080
selector:
name: web-server-deploy
70 changes: 70 additions & 0 deletions test/bin/run-single-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/bin/bash
set -euo pipefail

# Run a single Robot Framework test against a remote MicroShift cluster.
#
# Usage:
# ./test/bin/run-single-test.sh <variables.yaml> <robot-file> [test-name]
#
# Examples:
# ./test/bin/run-single-test.sh test/variables.yaml suites/router/router-config-infra.robot
# ./test/bin/run-single-test.sh test/variables.yaml suites/router/router-config-infra.robot 'Custom Listening IPs And Ports'

VARIABLES_FILE="$(cd "$(dirname "${1:?Usage: $0 <variables.yaml> <robot-file> [test-name]}")" && pwd)/$(basename "$1")"
ROBOT_FILE="${2:?Usage: $0 <variables.yaml> <robot-file> [test-name]}"
TEST_NAME="${3:-}"

ROOTDIR="$(cd "$(dirname "$0")/../.." && pwd)"
TESTDIR="${ROOTDIR}/test"
RF_VENV="${ROOTDIR}/_output/robotenv"
OUTDIR="${ROOTDIR}/_output/rf-single-$(date +%Y%m%d-%H%M%S)"

if [[ ! -f "${VARIABLES_FILE}" ]]; then
echo "ERROR: Variables file not found: ${VARIABLES_FILE}"
echo ""
echo "Create one from the example:"
echo " cp test/variables.yaml.example test/variables.yaml"
echo ""
echo "Required fields:"
echo " USHIFT_HOST: <host-ip>"
echo " USHIFT_USER: <ssh-user>"
echo " SSH_PRIV_KEY: <path-to-key-or-empty-for-agent>"
echo " SSH_PORT: 22"
echo " API_PORT: 6443"
exit 1
fi

if [[ ! -d "${RF_VENV}" ]]; then
echo "Setting up Robot Framework venv..."
"${ROOTDIR}/scripts/fetch_tools.sh" robotframework
fi

RF_BINARY="${RF_VENV}/bin/robot"
if [[ ! -f "${RF_BINARY}" ]]; then
echo "ERROR: robot binary not found at ${RF_BINARY}"
exit 1
fi

mkdir -p "${OUTDIR}"

TEST_FLAG=()
if [[ -n "${TEST_NAME}" ]]; then
TEST_FLAG=(-t "${TEST_NAME}")
echo "=== Running test: ${TEST_NAME} ==="
else
echo "=== Running all tests ==="
fi
echo "Variables: ${VARIABLES_FILE}"
echo "Robot file: ${ROBOT_FILE}"
echo "Output dir: ${OUTDIR}"
echo ""

cd "${TESTDIR}"

exec "${RF_BINARY}" \
--loglevel TRACE \
-V "${VARIABLES_FILE}" \
--outputdir "${OUTDIR}" \
--pythonpath resources \
${TEST_FLAG+"${TEST_FLAG[@]}"} \
"${ROBOT_FILE}"
Loading