diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-02-19 13:48:32 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-02-19 13:48:32 +0000 |
commit | 81bdef1ee772115812cac70f14e3c3166356b47c (patch) | |
tree | 7b11f8789ac91193341dd6a02fa36147cd30e2f6 | |
parent | 9e24500d13d6f3c0e10c519923b9d79bbdfd2031 (diff) | |
download | system-tests-81bdef1ee772115812cac70f14e3c3166356b47c.tar.gz |
Add test of user accounts
This fails so far because of an issue in baserock-system-config-sync.
-rw-r--r-- | test_trove_upgrades.py | 39 |
1 files changed, 38 insertions, 1 deletions
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'] |