Merge pull request #25120 from bluca/test_machineid
unit tests: do not fail when machine-id is missing
This commit is contained in:
@@ -27,7 +27,6 @@ ExecStart=sh -c 'test %g = $$(id -gn)'
|
||||
ExecStart=sh -c 'test %G = $$(id -g)'
|
||||
ExecStart=test %h = /root
|
||||
ExecStart=sh -c 'test -x %s'
|
||||
ExecStart=sh -c 'test %m = $$(cat /etc/machine-id)'
|
||||
ExecStart=sh -c 'test %b = $$(cat /proc/sys/kernel/random/boot_id | sed -e 's/-//g')'
|
||||
ExecStart=sh -c 'test %H = $$(uname -n)'
|
||||
ExecStart=sh -c 'test %v = $$(uname -r)'
|
||||
|
||||
@@ -24,7 +24,6 @@ ExecStart=sh -c 'test %g = $$(id -gn)'
|
||||
ExecStart=sh -c 'test %G = $$(id -g)'
|
||||
ExecStart=test %h = /root
|
||||
ExecStart=sh -c 'test -x %s'
|
||||
ExecStart=sh -c 'test %m = $$(cat /etc/machine-id)'
|
||||
ExecStart=sh -c 'test %b = $$(cat /proc/sys/kernel/random/boot_id | sed -e 's/-//g')'
|
||||
ExecStart=sh -c 'test %H = $$(uname -n)'
|
||||
ExecStart=sh -c 'test %v = $$(uname -r)'
|
||||
|
||||
@@ -87,7 +87,7 @@ def test_content(line, expected, *, user, extra={}, subpath='/arg', path_cb=None
|
||||
|
||||
def test_valid_specifiers(*, user):
|
||||
test_content('f {} - - - - two words', 'two words', user=user)
|
||||
if id128:
|
||||
if id128 and os.path.isfile('/etc/machine-id'):
|
||||
try:
|
||||
test_content('f {} - - - - %m', '{}'.format(id128.get_machine().hex), user=user)
|
||||
except AssertionError as e:
|
||||
|
||||
+2
-2
@@ -1980,8 +1980,8 @@ EOF
|
||||
not_exp_links => ["notthere"],
|
||||
}],
|
||||
rules => <<EOF
|
||||
TEST=="/etc/machine-id", SYMLINK+="there"
|
||||
TEST!="/etc/machine-id", SYMLINK+="notthere"
|
||||
TEST=="/etc/passwd", SYMLINK+="there"
|
||||
TEST!="/etc/passwd", SYMLINK+="notthere"
|
||||
EOF
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user