From 81bdef1ee772115812cac70f14e3c3166356b47c Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Wed, 19 Feb 2014 13:48:32 +0000 Subject: Add test of user accounts This fails so far because of an issue in baserock-system-config-sync. --- test_trove_upgrades.py | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test_trove_upgrades.py b/test_trove_upgrades.py index 898383f..ab9b0a2 100644 --- a/test_trove_upgrades.py +++ b/test_trove_upgrades.py @@ -684,6 +684,42 @@ class TestUpgrades(BaseTestSuite): content = instance.runcmd(['cat', test_file]) assert content == "Test user data\n" + def test_scenario_trove_upgrade_user_accounts( + self, fixture_dir, workspace_dir, reuse_fixture=False): + ''' + Ensure a user account added in the original system version still works + in the new system version. + + This tests /etc syncing, although all tests exercise this to a certain + degree because if e.g. /etc/hostname is not correct in the upgraded + system then the test will lose SSH access and fail. + + SCENARIO Bob upgrades his Trove + GIVEN a running an out-of-date Trove system + AND a user account 'bob' + WHEN Bob builds and upgrades to the current version of Trove with + AUTOSTART=1 + THEN The user account 'bob' is present and functional + + ''' + with self.given_out_of_date_trove_instance( + fixture_dir, reuse=reuse_fixture) as instance: + # Set up Bob's account without a password. + instance.runcmd(['adduser', '-D', 'bob']) + whoami = instance.runcmd(['su', 'bob', '-c', 'whoami']) + home = instance.runcmd(['su', 'bob', '-c', '\"cd && pwd\"']) + assert whoami == "bob\n" + assert home == "/home/bob\n" + + self.upgrade_to_latest_trove(workspace_dir, instance) + + whoami = instance.runcmd(['su', 'bob', '-c', 'whoami']) + home = instance.runcmd(['su', 'bob', '-c', '\"cd && pwd\"']) + + assert whoami == "bob\n" + assert home == "/home/bob\n" + + class SimpleTestRunner(cliapp.Application): ''' Run a Baserock system test suite. @@ -749,7 +785,8 @@ class SimpleTestRunner(cliapp.Application): def run_test(self): #test = TestUpgrades().test_scenario_trove_upgrade #test = TestUpgrades().test_scenario_trove_kernel_upgrade - test = TestUpgrades().test_scenario_trove_upgrade_shared_user_data + #test = TestUpgrades().test_scenario_trove_upgrade_shared_user_data + test = TestUpgrades().test_scenario_trove_upgrade_user_accounts if self.settings['reuse-fixture'] is not None: fixture_dir = self.settings['reuse-fixture'] -- cgit v1.2.1