mirror of
				https://github.com/kata-containers/kata-containers.git
				synced 2025-10-31 09:26:52 +00:00 
			
		
		
		
	ci: crio: Trail '\r' from exec_host() output
We've faced this as part of the CI, only happening with the CRI-O tests: ``` not ok 1 Test readonly volume for pods # (from function `exec_host' in file tests_common.sh, line 51, # in test file k8s-file-volume.bats, line 25) # `exec_host "echo "$file_body" > $tmp_file"' failed with status 127 # [bats-exec-test:38] INFO: k8s configured to use runtimeclass # bash: line 1: $'\r': command not found # # Error from server (NotFound): pods "test-file-volume" not found ``` I must say I didn't dig into figuring out why this is happening, but we may be safe enough to just trail the '\r', as long as all the tests keep passing on containerd. Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
		| @@ -44,7 +44,16 @@ exec_host() { | |||||||
| 	# `kubectl debug` always returns 0, so we hack it to return the right exit code. | 	# `kubectl debug` always returns 0, so we hack it to return the right exit code. | ||||||
| 	command="$@" | 	command="$@" | ||||||
| 	command+='; echo -en \\n$?' | 	command+='; echo -en \\n$?' | ||||||
| 	output="$(kubectl debug -qit "${node}" --image=alpine:latest -- chroot /host bash -c "${command}")" | 	# We're trailing the `\r` here due to: https://github.com/kata-containers/kata-containers/issues/8051 | ||||||
|  | 	# tl;dr: When testing with CRI-O we're facing the foillowing error: | ||||||
|  | 	# ``` | ||||||
|  | 	# (from function `exec_host' in file tests_common.sh, line 51, | ||||||
|  | 	# in test file k8s-file-volume.bats, line 25) | ||||||
|  | 	# `exec_host "echo "$file_body" > $tmp_file"' failed with status 127 | ||||||
|  | 	# [bats-exec-test:38] INFO: k8s configured to use runtimeclass | ||||||
|  | 	# bash: line 1: $'\r': command not found | ||||||
|  | 	# ``` | ||||||
|  | 	output="$(kubectl debug -qit "${node}" --image=alpine:latest -- chroot /host bash -c "${command}" | tr -d '\r')" | ||||||
| 	kubectl get pods -o name | grep node-debugger | xargs kubectl delete > /dev/null | 	kubectl get pods -o name | grep node-debugger | xargs kubectl delete > /dev/null | ||||||
| 	exit_code="$(echo "${output}" | tail -1)" | 	exit_code="$(echo "${output}" | tail -1)" | ||||||
| 	echo "$(echo "${output}" | head -n -1)" | 	echo "$(echo "${output}" | head -n -1)" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user