Merge lp:~clint-fewbar/pyjuju/fix-tests-with-no-ssh-key into lp:pyjuju

Proposed by Clint Byrum
Status: Merged
Approved by: Gustavo Niemeyer
Approved revision: 338
Merged at revision: 359
Proposed branch: lp:~clint-fewbar/pyjuju/fix-tests-with-no-ssh-key
Merge into: lp:pyjuju
Diff against target: 35 lines (+5/-3)
2 files modified
ensemble/lib/testing.py (+1/-0)
ensemble/providers/ec2/tests/test_provider.py (+4/-3)
To merge this branch: bzr merge lp:~clint-fewbar/pyjuju/fix-tests-with-no-ssh-key
Reviewer Review Type Date Requested Status
Gustavo Niemeyer Approve
Review via email: mp+73849@code.launchpad.net

Description of the change

This allows the tests to run without a pre-existing SSH key in one's home
directory. Its difficult to test the failure because you need a user with
no ssh key, even if you override HOME, because os.path.expanduser() falls
back to using 'getent()' to find the user's home directory if HOME is
not set (hence the preservation of HOME in ensemble.lib.testing.TestCase).

To post a comment you must log in.
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Looks mostly ok, but the test is being rendered non-useful by
this change:

[1]

30 - self.env_name, {"access-key": "secret-12345"})
31 + self.env_name, config)

The original test verified that the config loaded from the environment
is the one expected. Now the serialized data is built having the
expected config at hand already, so the test that verified that it
was actually loaded from the environment is gone.

review: Needs Fixing
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

I suppose it would help to read the description of the test before changing it! :)

Pushed a fixed version up and re-opening as Ready for Review.

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Thanks!

review: Approve
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Please feel free to merge this.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ensemble/lib/testing.py'
2--- ensemble/lib/testing.py 2011-08-03 06:04:37 +0000
3+++ ensemble/lib/testing.py 2011-09-12 16:46:04 +0000
4@@ -100,6 +100,7 @@
5 "AWS_SECRET_ACCESS_KEY",
6 "EC2_PRIVATE_KEY",
7 "EC2_CERT",
8+ "HOME",
9 "ZOOKEEPER_ADDRESS"]:
10 if env not in kw:
11 kw[env] = os.environ.get(env, "")
12
13=== modified file 'ensemble/providers/ec2/tests/test_provider.py'
14--- ensemble/providers/ec2/tests/test_provider.py 2011-08-29 02:23:11 +0000
15+++ ensemble/providers/ec2/tests/test_provider.py 2011-09-12 16:46:04 +0000
16@@ -102,7 +102,8 @@
17 the environment, when serializing.
18 """
19 config = {"access-key": "secret-12345",
20- "secret-key": "secret-abc"}
21+ "secret-key": "secret-abc",
22+ "authorized-keys": "0123456789abcdef"}
23
24 environ = {
25 "AWS_SECRET_ACCESS_KEY": "secret-abc",
26@@ -110,9 +111,9 @@
27
28 self.change_environment(**environ)
29 provider = MachineProvider(
30- self.env_name, {"access-key": "secret-12345"})
31+ self.env_name, {"access-key": "secret-12345",
32+ "authorized-keys": "0123456789abcdef"})
33 serialized = provider.get_serialization_data()
34- serialized.pop("authorized-keys", None)
35 self.assertEqual(config, serialized)
36
37

Subscribers

People subscribed via source and target branches

to status/vote changes: