[users] In tests, adjust failure expectations

Some distro's let the user change the hostname at will;
others don't, and yet others don't have systemd to change
the hostname with at all. Check if we **can** change the
hostname (as a non-root user), before setting expectations.
This commit is contained in:
Adriaan de Groot 2022-06-28 23:50:56 +02:00
parent 6a9d9700d4
commit b4c23b8b70

View File

@ -131,7 +131,10 @@ UsersTests::testHostnamed()
// root, assume it will succeed.
if ( geteuid() != 0 )
{
QEXPECT_FAIL( "", "Hostname changes are access-controlled", Continue );
if ( !setSystemdHostname( QStringLiteral( "tubophone.calamares.io" ) ) )
{
QEXPECT_FAIL( "", "Hostname changes are access-controlled", Continue );
}
}
QVERIFY( setSystemdHostname( QStringLiteral( "tubophone.calamares.io" ) ) );
if ( !m_originalHostName.isEmpty() )