-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OPCT-devel: openshift-tests replay plugin
- Loading branch information
Showing
2 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Run openshigt-tests replay plugin | ||
|
||
|
||
- Export KUBECONFIG | ||
|
||
- Create replay file | ||
|
||
> The tests must have double brackets sepparated by line | ||
```sh | ||
cat << EOF > ./example-replay.txt | ||
"[sig-network] services when running openshift ipv4 cluster ensures external ip policy is configured correctly on the cluster [apigroup:config.openshift.io] [Serial] [Suite:openshift/conformance/serial]" | ||
EOF | ||
``` | ||
|
||
- Download the Plugin spec (devel path): | ||
|
||
```sh | ||
wget -qO /tmp/replay-plugin.yaml https://raw.githubusercontent.com/mtulio/provider-certification-plugins/plugin-openshift-tests-replay/openshift-tests-replay/plugin.yaml | ||
``` | ||
|
||
- Create ConfigMap | ||
|
||
> The key must be `replay.list` | ||
```sh | ||
oc create ns tmp-opct | ||
oc create configmap -n tmp-opct openshift-tests-replay --from-file=replay.list=./example-replay.txt | ||
``` | ||
|
||
- Run plugin | ||
|
||
```sh | ||
opct-devel sonobuoy run \ | ||
-p /tmp/replay-plugin.yaml \ | ||
--plugin-env openshift-tests-replay.REPLAY_NAMESPACE=tmp-opct \ | ||
--plugin-env openshift-tests-replay.REPLAY_CONFIG=openshift-tests-replay \ | ||
--dns-namespace=openshift-dns \ | ||
--dns-pod-labels=dns.operator.openshift.io/daemonset-dns=default | ||
``` | ||
|
||
- Check the status: | ||
|
||
```sh | ||
opct-devel sonobuoy status | ||
``` | ||
|
||
- Follow the execution: | ||
|
||
```sh | ||
oc logs -n sonobuoy -l sonobuoy-plugin=openshift-tests-replay | ||
``` | ||
|
||
- Collect the results when it finished | ||
|
||
```sh | ||
opct-devel sonobuoy retrieve | ||
``` | ||
|
||
- Destroy the environment | ||
|
||
```sh | ||
opct-devel sonobuoy delete | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
config-map: | ||
replay-runner.sh: | | ||
echo "Starting openshift-tests replay..." | ||
declare -grx SA_CA_PATH="/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" | ||
declare -grx SA_TOKEN_PATH="/var/run/secrets/kubernetes.io/serviceaccount/token" | ||
declare -grx KUBE_API_INT="https://172.30.0.1:443" | ||
declare -grx KUBECONFIG=/tmp/kubeconfig | ||
export UTIL_OC_BIN=/usr/bin/oc | ||
registry_args="--auth-basic=image-puller:$(cat "${SA_TOKEN_PATH}")" | ||
registry_host="image-registry.openshift-image-registry.svc:5000" | ||
echo "Using> " | ||
echo "REPLAY_NAMESPACE=${REPLAY_NAMESPACE-}" | ||
echo "REPLAY_CONFIG=${REPLAY_CONFIG-}" | ||
cd /tmp | ||
export PATH=${PATH}:/tmp | ||
# extract openshift-tests | ||
echo "Login to API" | ||
tree /var/run || true | ||
$UTIL_OC_BIN login "${KUBE_API_INT}" \ | ||
--token="$(cat "${SA_TOKEN_PATH}")" \ | ||
--certificate-authority="${SA_CA_PATH}" || true; | ||
INT_URI="$(${UTIL_OC_BIN} get infrastructures cluster -o json | jq -r .status.apiServerInternalURI)" | ||
${UTIL_OC_BIN} login "${INT_URI}" \ | ||
--token="$(cat "${SA_TOKEN_PATH}")" \ | ||
--certificate-authority="${SA_CA_PATH}" || true; | ||
echo "Registry API" | ||
${UTIL_OC_BIN} registry login "${registry_args}" | ||
${UTIL_OC_BIN} image extract \ | ||
"${registry_host}"/openshift/tests:latest \ | ||
--insecure=true \ | ||
--file="/usr/bin/openshift-tests" | ||
# grant permissions | ||
chmod u+x ./openshift-tests | ||
# extract custom tests to replay | ||
oc extract configmap/${REPLAY_CONFIG} -n ${REPLAY_NAMESPACE} --to=/tmp --keys=replay.list | ||
cat /tmp/replay.list | ||
# run openshift-tests | ||
./openshift-tests run openshift/conformance -f /tmp/replay.list --max-parallel-tests 1 --junit-dir=/tmp/junits --monitor node-state-analyzer | ||
# save the results | ||
mkdir /tmp/final | ||
cp /tmp/junits/junit_*.xml /tmp/final/ | ||
tar cfz /tmp/final/junit_raw.tgz /tmp/junits/* | ||
cd /tmp/final/ && tar cfz /tmp/sonobuoy/results/results.tar.gz * | ||
echo "/tmp/sonobuoy/results/results.tar.gz" > /tmp/sonobuoy/results/done | ||
sonobuoy-config: | ||
driver: Job | ||
plugin-name: openshift-tests-replay | ||
result-format: raw | ||
source_url: https://raw.githubusercontent.com/redhat-ecosystem/provider-certification-plugins/main/openshift-tests-replay/plugin.yaml | ||
description: Replay custom tests using openshift-tests on OpenShift/OKD clusters. | ||
spec: | ||
name: plugin | ||
image: quay.io/opct/tools:v0.3.0 | ||
imagePullPolicy: Always | ||
command: | ||
- bash | ||
- /tmp/sonobuoy/config/replay-runner.sh | ||
env: | ||
- name: RESULTS_PATH | ||
value: /tmp/sonobuoy/results | ||
resources: | ||
requests: | ||
memory: "4096Mi" | ||
nodeSelector: | ||
node-role.kubernetes.io/tests: "" | ||
tolerations: | ||
- key: "node-role.kubernetes.io/tests" | ||
operator: "Equal" | ||
value: "" | ||
effect: "NoSchedule" | ||
volumeMounts: | ||
- mountPath: /tmp/sonobuoy/results | ||
name: results |