test/system: Try to handle /etc/resolv.conf on host as absolute symlink
Some Arch Linux hosts have /etc/resolv.conf as an absolute symbolic link
to /run/systemd/resolve/stub-resolv.conf, instead of being a relative
symbolic link to ../run/systemd/resolve/stub-resolv.conf or a regular
file.  eg., the images built by arch-boxes [1].
This changes the target that the Toolbx container's /etc/resolv.conf
points at and confuses the tests [2].
Ideally, these host operating systems should be fixed to use relative
symbolic links.  This is highlighted by skipping the tests, because
there's no point in failing them until that happens.
This is a step towards running the CI on Arch Linux.
[1] https://gitlab.archlinux.org/archlinux/arch-boxes
    https://geo.mirror.pkgbuild.com/images/latest/
[2] Commit 88a95b07af
    https://github.com/containers/toolbox/commit/88a95b07af335be2
    https://github.com/containers/toolbox/issues/187
https://github.com/containers/toolbox/issues/1438
			
			
This commit is contained in:
		
							parent
							
								
									f900585739
								
							
						
					
					
						commit
						b378596b14
					
				|  | @ -69,7 +69,13 @@ teardown() { | |||
|   run --keep-empty-lines --separate-stderr "$TOOLBX" run readlink /etc/resolv.conf | ||||
| 
 | ||||
|   assert_success | ||||
| 
 | ||||
|   if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then | ||||
|     skip "host has absolute symlink" | ||||
|   else | ||||
|     assert_line --index 0 "/run/host/etc/resolv.conf" | ||||
|   fi | ||||
| 
 | ||||
|   assert [ ${#lines[@]} -eq 1 ] | ||||
| 
 | ||||
|   # shellcheck disable=SC2154 | ||||
|  | @ -83,7 +89,13 @@ teardown() { | |||
|   run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro arch readlink /etc/resolv.conf | ||||
| 
 | ||||
|   assert_success | ||||
| 
 | ||||
|   if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then | ||||
|     skip "host has absolute symlink" | ||||
|   else | ||||
|     assert_line --index 0 "/run/host/etc/resolv.conf" | ||||
|   fi | ||||
| 
 | ||||
|   assert [ ${#lines[@]} -eq 1 ] | ||||
| 
 | ||||
|   # shellcheck disable=SC2154 | ||||
|  | @ -97,7 +109,13 @@ teardown() { | |||
|   run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro fedora --release 34 readlink /etc/resolv.conf | ||||
| 
 | ||||
|   assert_success | ||||
| 
 | ||||
|   if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then | ||||
|     skip "host has absolute symlink" | ||||
|   else | ||||
|     assert_line --index 0 "/run/host/etc/resolv.conf" | ||||
|   fi | ||||
| 
 | ||||
|   assert [ ${#lines[@]} -eq 1 ] | ||||
| 
 | ||||
|   # shellcheck disable=SC2154 | ||||
|  | @ -111,7 +129,13 @@ teardown() { | |||
|   run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro rhel --release 8.10 readlink /etc/resolv.conf | ||||
| 
 | ||||
|   assert_success | ||||
| 
 | ||||
|   if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then | ||||
|     skip "host has absolute symlink" | ||||
|   else | ||||
|     assert_line --index 0 "/run/host/etc/resolv.conf" | ||||
|   fi | ||||
| 
 | ||||
|   assert [ ${#lines[@]} -eq 1 ] | ||||
| 
 | ||||
|   # shellcheck disable=SC2154 | ||||
|  | @ -125,7 +149,13 @@ teardown() { | |||
|   run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro ubuntu --release 16.04 readlink /etc/resolv.conf | ||||
| 
 | ||||
|   assert_success | ||||
| 
 | ||||
|   if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then | ||||
|     skip "host has absolute symlink" | ||||
|   else | ||||
|     assert_line --index 0 "/run/host/etc/resolv.conf" | ||||
|   fi | ||||
| 
 | ||||
|   assert [ ${#lines[@]} -eq 1 ] | ||||
| 
 | ||||
|   # shellcheck disable=SC2154 | ||||
|  | @ -139,7 +169,13 @@ teardown() { | |||
|   run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro ubuntu --release 18.04 readlink /etc/resolv.conf | ||||
| 
 | ||||
|   assert_success | ||||
| 
 | ||||
|   if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then | ||||
|     skip "host has absolute symlink" | ||||
|   else | ||||
|     assert_line --index 0 "/run/host/etc/resolv.conf" | ||||
|   fi | ||||
| 
 | ||||
|   assert [ ${#lines[@]} -eq 1 ] | ||||
| 
 | ||||
|   # shellcheck disable=SC2154 | ||||
|  | @ -153,7 +189,13 @@ teardown() { | |||
|   run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro ubuntu --release 20.04 readlink /etc/resolv.conf | ||||
| 
 | ||||
|   assert_success | ||||
| 
 | ||||
|   if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then | ||||
|     skip "host has absolute symlink" | ||||
|   else | ||||
|     assert_line --index 0 "/run/host/etc/resolv.conf" | ||||
|   fi | ||||
| 
 | ||||
|   assert [ ${#lines[@]} -eq 1 ] | ||||
| 
 | ||||
|   # shellcheck disable=SC2154 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue