Step: openshift-e2e-libvirt-test

The LIBVIRT test step executes the common end-to-end test suite.

Container image used for this step: tests

tests resolves to an image built or imported by the ci-operator configuration (documentation).

Environment

In addition to the default environment, the step exposes the following:

Variable Name Type Variable Content
OPENSHIFT_UPGRADE_RELEASE_IMAGE_OVERRIDE Dependency[?] Pull specification for release:latest image
ARCH Parameter[?]
BRANCH Parameter[?]
GATHER_BOOTSTRAP_LOGS Parameter[?] Force the gathering of logs from the bootstrap node. This usually only occurs when there is a failure during installation. (default: false)
TEST_TYPE Parameter[?] The type of test to perform. * 'suite' - Run the test suite defined by TEST_SUITE. By default this executes the OpenShift parallel conformance suite. All product components must run the default suite on pull requests prior to merge. * 'conformance-parallel' - Runs the test suite defined by TEST_SUITE, then runs the product conformance/parallel suite to verify the cluster is still functional. This is typically used for testing disruption from one suite, then confirming that the disruption did not degrade the product. * 'conformance-serial' - Runs the test suite defined by TEST_SUITE, then runs the product conformance/serial suite to verify the cluster is still functional. This is typically used for testing disruption from one suite, then confirming that the disruption did not degrade the product. * 'upgrade' - Perform an upgrade to the image defined by OPENSHIFT_UPGRADE_RELEASE_IMAGE_OVERRIDE. The TEST_UPGRADE_OPTIONS flag may be optionally set. All product components must run the default upgrade test (verify an upgrade completes) on pull requests prior to merge. * 'jenkins-e2e-rhel-only' - Runs the test suite defined by TEST_SUITE, then runs the product jenkins-e2e-rhel-only suite to verify the cluster is still functional. This is typically used for testing disruption from one suite, then confirming that the disruption did not degrade the product. * 'image-ecosystem' - Runs the test suite defined by TEST_SUITE, then runs the product image-ecosystem suite to verify the cluster is still functional. This is typically used for testing disruption from one suite, then confirming that the disruption did not degrade the product. (default: suite)
TEST_SUITE Parameter[?] The test suite to run. Use 'openshift-test run --help' to list available suites. (default: openshift/conformance/parallel)
TEST_UPGRADE_OPTIONS Parameter[?] Options controlling how an upgrade is performed. See `openshift-test run-upgrade --help` for more details.
TOUCH Parameter[?] Forces testing when writing new code.

Source Code

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

export PATH=/usr/libexec/origin:$PATH
# Initial check
if [[ "${CLUSTER_TYPE}" != "libvirt-ppc64le" ]] && [[ "${CLUSTER_TYPE}" != "libvirt-s390x" ]] ; then
    echo "Unsupported cluster type '${CLUSTER_TYPE}'"
    exit 1
fi

function upgrade() {
    set -x
    openshift-tests run-upgrade all \
        --to-image "${OPENSHIFT_UPGRADE_RELEASE_IMAGE_OVERRIDE}" \
        --options "${TEST_UPGRADE_OPTIONS-}" \
        --provider "${TEST_PROVIDER:-}" \
        -o "${ARTIFACT_DIR}/e2e.log" \
        --junit-dir "${ARTIFACT_DIR}/junit" &
    wait "$!"
}

function log_to_file() {
	local LOG_FILE=$1

	# Close STDOUT file descriptor
	exec 1<&-
	# Close STDERR FD
	exec 2<&-
	# Open STDOUT as $LOG_FILE file for read and write.
	exec 1<>${LOG_FILE}
	# Redirect STDERR to STDOUT
	exec 2>&1
}

function urlencode() {
	local DATA=$1

	echo "${DATA}" | jq -sRr @uri
}

function prometheus_var_init() {
	HOSTNAME=$(oc get routes/prometheus-k8s -n openshift-monitoring -o json | jq -r '.spec.host')
	TOKEN=$(oc -n openshift-monitoring sa get-token prometheus-k8s)
	export HOSTNAME
	export TOKEN
}

function prometheus_query() {
	local DATA=$1
	local EDATA
	local URL

	EDATA=$(urlencode "${DATA}")
	URL="https://${HOSTNAME}/api/v1/query?query=${EDATA}"
	RESPONSE=$(curl --silent --insecure --header "Authorization: Bearer ${TOKEN}" "${URL}")
	RC=$?
	if [[ ${RC} -gt 0 ]]
	then
		echo "Error: ${URL} returned ${RC}"
		exit 1
	fi
	STATUS=$(echo "${RESPONSE}" | jq -r '.status')
	if [[ "${STATUS}" != "success" ]]
	then
		echo "Error: Status is not success (${STATUS})"
		exit 1
	fi
	RETURNED=$(echo "${RESPONSE}" | jq -r '.data.result[0].value[1]')
	echo "${RETURNED}"
}

function prometheus_all_alerts() {
	local URL="https://${HOSTNAME}/api/v1/alerts"

	RESPONSE=$(curl --silent --insecure --header "Authorization: Bearer ${TOKEN}" "${URL}")
	RC=$?
	if [[ ${RC} -gt 0 ]]
	then
		echo "Error: ${URL} returned ${RC}"
		exit 1
	fi
	jq -r '.data.alerts[]' <<< "${RESPONSE}"
}

function prometheus_alert() {
	local ALERT=$1
	local RESPONSE

	RESPONSE=$(prometheus_all_alerts)

	jq -r 'select(.labels.alertname=="'${ALERT}'")' <<< "${RESPONSE}"
	RC=$?
	if [ ${RC} -gt 0 ]
	then
		echo "ERROR: \'${RESPONSE}\'"
	fi
}

function prometheus_kaebb_loop() {
	local BR1h
	local BR5m
	local BR6h
	local BR30m
	local BR1d
	local BR2h
	local BR3d
	local BR6h

	log_to_file "${ARTIFACT_DIR}/prometheus-kaebb.log"

	while true
	do
		echo "8<----------8<---------- $(date +%s) 8<----------8<----------"

		BR1h=$(prometheus_query 'sum(apiserver_request:burnrate1h)')
		BR5m=$(prometheus_query 'sum(apiserver_request:burnrate5m)')
		BR6h=$(prometheus_query 'sum(apiserver_request:burnrate6h)')
		BR30m=$(prometheus_query 'sum(apiserver_request:burnrate30m)')
		BR1d=$(prometheus_query 'sum(apiserver_request:burnrate1d)')
		BR2h=$(prometheus_query 'sum(apiserver_request:burnrate2h)')
		BR3d=$(prometheus_query 'sum(apiserver_request:burnrate3d)')
		BR6h=$(prometheus_query 'sum(apiserver_request:burnrate6h)')

		echo "BR1h=${BR1h}"
		echo "BR5m=${BR5m}"
		echo "BR6h=${BR6h}"
		echo "BR30m=${BR30m}"
		echo "BR1d=${BR1d}"
		echo "BR2h=${BR2h}"
		echo "BR3d=${BR3d}"
		echo "BR6h=${BR6h}"

		prometheus_alert "KubeAPIErrorBudgetBurn"

		sleep 5m
	done
}

function prometheus_cmrss_loop() {
	local CMRSS_DATA
	local CMRSS_EDATA
	local URL

	CMRSS_DATA='( container_memory_rss{id="/system.slice"} and container_memory_rss{node=~".*worker.*"} )'
	CMRSS_EDATA=$(urlencode "${CMRSS_DATA}")
	URL="https://${HOSTNAME}/api/v1/query?query=${CMRSS_EDATA}"

	log_to_file "${ARTIFACT_DIR}/prometheus-cmrss.log"

	while true
	do
		echo "8<----------8<---------- $(date +%s) 8<----------8<----------"

		RESPONSE=$(curl --silent --insecure --header "Authorization: Bearer ${TOKEN}" "${URL}")
		RC=$?
		if [[ ${RC} -gt 0 ]]
		then
			echo "Error: ${URL} returned ${RC}"
			exit 1
		fi
		STATUS=$(echo "${RESPONSE}" | jq -r '.status')
		if [[ "${STATUS}" != "success" ]]
		then
			echo "Error: Status is not success (${STATUS})"
			exit 1
		fi
		RETURNED1=$(echo "${RESPONSE}" | jq -r '.data.result[0].value[1]')
		RETURNED2=$(echo "${RESPONSE}" | jq -r '.data.result[1].value[1]')
		echo "${RETURNED1} ${RETURNED2}"

		prometheus_alert "SystemMemoryExceedsReservation"

		sleep 5m
	done
}

function prometheus_GRPCRequestsSlow_loop() {
	local EDWFDSB_DATA
	local EDWFDSB_EDATA
	local GSHSB_DATA
	local GSHSB_EDATA
	local ENPRTTSB_DATA
	local ENPRTTSB_EDATA
	local SLEEP_TIME="10m"

	# historgram_quantile:sum:rate:etcd_disk_wal_fsync_duration_seconds_bucket topk(1, histogram_quantile(0.99, rate(etcd_disk_wal_fsync_duration_seconds_bucket{job=~".*etcd.*"}[5m])))
	EDWFDSB_DATA='histogram_quantile(0.99, rate(etcd_disk_wal_fsync_duration_seconds_bucket{job=~".*etcd.*"}['${SLEEP_TIME}']))'
	EDWFDSB_EDATA=$(urlencode "${EDWFDSB_DATA}")
	# historgram_quantile:sum:rate:grpc_server_handling_seconds_bucket topk(1,histogram_quantile(0.99, sum(rate(grpc_server_handling_seconds_bucket{job=~".*etcd.*", grpc_type="unary"}[5m])) without(grpc_type)))
	GSHSB_DATA='histogram_quantile(0.99, sum(rate(grpc_server_handling_seconds_bucket{job=~".*etcd.*", grpc_type="unary"}['${SLEEP_TIME}'])) without(grpc_type)) >= 0'
	GSHSB_EDATA=$(urlencode "${GSHSB_DATA}")
	# historgram_quantile:sum:rate:etcd_network_peer_round_trip_time_seconds_bucket topk(1, histogram_quantile(0.99, rate(etcd_network_peer_round_trip_time_seconds_bucket{job=~".*etcd.*"}[5m])))
	ENPRTTSB_DATA='histogram_quantile(0.99, rate(etcd_network_peer_round_trip_time_seconds_bucket{job=~".*etcd.*"}['${SLEEP_TIME}']))'
	ENPRTTSB_EDATA=$(urlencode "${ENPRTTSB_DATA}")

	log_to_file "${ARTIFACT_DIR}/prometheus-GRPCRequestsSlow.log"

	while true
	do
		echo "8<----------8<---------- $(date +%s) 8<----------8<----------"
		echo "${EDWFDSB_DATA}"

		RESPONSE=$(curl --silent --insecure --header "Authorization: Bearer ${TOKEN}" "https://${HOSTNAME}/api/v1/query?query=${EDWFDSB_EDATA}")
		RC=$?
		if [[ ${RC} -gt 0 ]]
		then
			echo "Error: ${URL} returned ${RC}"
			exit 1
		fi
		STATUS=$(echo "${RESPONSE}" | jq -r '.status')
		if [[ "${STATUS}" != "success" ]]
		then
			echo "Error: Status is not success (${STATUS})"
			exit 1
		fi

		echo "${RESPONSE}" | jq -r '.data.result[] | [ .metric.pod , .value[1] ]'

		echo "8<----------8<----------"
		echo "${GSHSB_DATA}"

		RESPONSE=$(curl --silent --insecure --header "Authorization: Bearer ${TOKEN}" "https://${HOSTNAME}/api/v1/query?query=${GSHSB_EDATA}")
		RC=$?
		if [[ ${RC} -gt 0 ]]
		then
			echo "Error: ${URL} returned ${RC}"
			exit 1
		fi
		STATUS=$(echo "${RESPONSE}" | jq -r '.status')
		if [[ "${STATUS}" != "success" ]]
		then
			echo "Error: Status is not success (${STATUS})"
			exit 1
		fi

		echo "${RESPONSE}" | jq -r '.data.result'

		echo "8<----------8<----------"
		echo "${ENPRTTSB_DATA}"

		RESPONSE=$(curl --silent --insecure --header "Authorization: Bearer ${TOKEN}" "https://${HOSTNAME}/api/v1/query?query=${ENPRTTSB_EDATA}")
		RC=$?
		if [[ ${RC} -gt 0 ]]
		then
			echo "Error: ${URL} returned ${RC}"
			exit 1
		fi
		STATUS=$(echo "${RESPONSE}" | jq -r '.status')
		if [[ "${STATUS}" != "success" ]]
		then
			echo "Error: Status is not success (${STATUS})"
			exit 1
		fi

		echo "${RESPONSE}" | jq -r '.data.result'

		echo "8<----------8<----------"

		prometheus_alert "etcdGRPCRequestsSlow"

		sleep ${SLEEP_TIME}
	done
}

function oc_adm_top_nodes_loop() {
	log_to_file "${ARTIFACT_DIR}/oc-adm-top-nodes.log"

	while true
	do
		echo "8<----------8<---------- $(date +%s) 8<----------8<----------"

		oc adm top nodes --use-protocol-buffers

		sleep 5m
	done
}

function suite() {
    if [ -f "${SHARED_DIR}/excluded_tests" ]; then
        cat > ${SHARED_DIR}/invert_excluded.py <<EOSCRIPT
#!/usr/libexec/platform-python
import sys
all_tests = set()
excluded_tests = set()
for l in sys.stdin.readlines():
    all_tests.add(l.strip())
with open(sys.argv[1], "r") as f:
    for l in f.readlines():
        excluded_tests.add(l.strip())
test_suite = all_tests - excluded_tests
for t in test_suite:
    print(t)
EOSCRIPT
      chmod +x ${SHARED_DIR}/invert_excluded.py
      openshift-tests run "${TEST_SUITE}" --dry-run | ${SHARED_DIR}/invert_excluded.py ${SHARED_DIR}/excluded_tests > ${SHARED_DIR}/tests
      TEST_ARGS="${TEST_ARGS:-} --file ${SHARED_DIR}/tests"
    fi

    if [ "$BRANCH" = "4.6" ]; then
# use s390x or ppc64le builds of e2e test images
# this is a multi-arch image
        cat << EOREGISTRY > ${SHARED_DIR}/kube-test-repo-list
dockerGluster: quay.io/sjenning
dockerLibraryRegistry: quay.io/sjenning
e2eRegistry: quay.io/multiarch-k8s-e2e
e2eVolumeRegistry: quay.io/multiarch-k8s-e2e
quayIncubator: quay.io/multiarch-k8s-e2e
quayK8sCSI: quay.io/multiarch-k8s-e2e
k8sCSI: quay.io/multiarch-k8s-e2e
promoterE2eRegistry: quay.io/multiarch-k8s-e2e
sigStorageRegistry: quay.io/multiarch-k8s-e2e
EOREGISTRY
export KUBE_TEST_REPO_LIST=${SHARED_DIR}/kube-test-repo-list
    else
        TEST_ARGS="${TEST_ARGS:-} --from-repository=quay.io/multi-arch/community-e2e-images"
    fi

    VERBOSITY="" # "--v 9"
    set -x
    openshift-tests run \
        ${VERBOSITY} \
        "${TEST_SUITE}" \
        ${TEST_ARGS:-} \
        -o "${ARTIFACT_DIR}/e2e.log" \
        --junit-dir "${ARTIFACT_DIR}/junit" &
    wait "$!"
}

echo "$(date +%s)" > "${SHARED_DIR}/TEST_TIME_TEST_START"
trap 'echo "$(date +%s)" > "${SHARED_DIR}/TEST_TIME_TEST_END"' EXIT

declare -a WATCHERS

trap 'echo "Killing WATCHERS"; for PID in ${WATCHERS[@]}; do kill -9 ${PID} >/dev/null 2>&1 || true; done' TERM

prometheus_var_init

prometheus_cmrss_loop &
WATCHERS+=( "$!" )

prometheus_kaebb_loop &
WATCHERS+=( "$!" )

prometheus_GRPCRequestsSlow_loop &
WATCHERS+=( "$!" )

oc_adm_top_nodes_loop &
WATCHERS+=( "$!" )

case "${TEST_TYPE}" in
conformance-parallel)
    TEST_LIMIT_START_TIME="$(date +%s)" TEST_SUITE=openshift/conformance/parallel suite
    ;;
conformance-serial)
    TEST_LIMIT_START_TIME="$(date +%s)" TEST_SUITE=openshift/conformance/serial suite
    ;;
jenkins-e2e-rhel-only)
    TEST_LIMIT_START_TIME="$(date +%s)" TEST_SUITE=openshift/jenkins-e2e-rhel-only suite
    ;;
image-ecosystem)
    TEST_LIMIT_START_TIME="$(date +%s)" TEST_SUITE=openshift/image-ecosystem suite
    ;;
upgrade)
    upgrade
    ;;
suite)
    suite
    ;;
*)
    echo >&2 "Unsupported test type '${TEST_TYPE}'"
    exit 1
    ;;
esac

Properties

Property Value Description
Termination grace period[?] 10m0s Period of time until SIGKILL signal is sent to the test pod (after SIGTERM signal is sent).
Resource requests (cpu) 4 Used in .resources.requests of the pod running this step.
Resource requests (memory) 600Mi Used in .resources.requests of the pod running this step.
Resource limits (memory) 6Gi Used in .resources.limits of the pod running this step.

GitHub Link:

https://github.com/openshift/release/blob/master/ci-operator/step-registry/openshift/e2e/libvirt/test/openshift-e2e-libvirt-test-ref.yaml

Owners:

Approvers:

Source code for this page located on GitHub