Merge ~powersj/cloud-init:cii-fix-kvm-tests into cloud-init:master

Proposed by Joshua Powers
Status: Merged
Merge reported by: Scott Moser
Merged at revision: 13e29b79db4efc46db725a793a3840b8832149c9
Proposed branch: ~powersj/cloud-init:cii-fix-kvm-tests
Merge into: cloud-init:master
Diff against target: 410 lines (+46/-75)
19 files modified
tests/cloud_tests/instances/base.py (+4/-1)
tests/cloud_tests/instances/nocloudkvm.py (+1/-1)
tests/cloud_tests/testcases/examples/run_commands.yaml (+2/-2)
tests/cloud_tests/testcases/examples/writing_out_arbitrary_files.yaml (+9/-10)
tests/cloud_tests/testcases/modules/keys_to_console.py (+4/-4)
tests/cloud_tests/testcases/modules/runcmd.yaml (+2/-2)
tests/cloud_tests/testcases/modules/seed_random_command.yaml (+2/-2)
tests/cloud_tests/testcases/modules/seed_random_data.yaml (+2/-2)
tests/cloud_tests/testcases/modules/set_password_expire.py (+1/-1)
tests/cloud_tests/testcases/modules/set_password_expire.yaml (+2/-0)
tests/cloud_tests/testcases/modules/set_password_list.yaml (+1/-0)
tests/cloud_tests/testcases/modules/set_password_list_string.yaml (+1/-0)
tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.py (+0/-8)
tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.yaml (+0/-1)
tests/cloud_tests/testcases/modules/ssh_keys_generate.py (+0/-5)
tests/cloud_tests/testcases/modules/ssh_keys_generate.yaml (+2/-5)
tests/cloud_tests/testcases/modules/ssh_keys_provided.py (+0/-11)
tests/cloud_tests/testcases/modules/ssh_keys_provided.yaml (+4/-10)
tests/cloud_tests/testcases/modules/write_files.yaml (+9/-10)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Chad Smith Approve
Review via email: mp+331736@code.launchpad.net

Commit message

tests: Enable all tests for nocloud-kvm backend

The original testcases were written using the lxd backend only. This
commit enables the use of the nocloud-kvm backend for all testcases. The
primary changes revolve around 3 areas:

* Ensure all tests execute as root per spec via sudo
* Move from /root to /var/tmp or $HOME - with lxd we login as root by
default, but that is not the case with nocloud-kvm or other backends.
* Update ssh key auth user to not be root and either update or remove a
few key checks.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:f1a66a42318242811556b71e565ce54de2c6e177
https://jenkins.ubuntu.com/server/job/cloud-init-ci/374/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: MAAS Compatability Testing
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/374/rebuild

review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :

probably use of /tmp is dangerous.
maybe not.
https://bugs.launchpad.net/cloud-init/+bug/1707222

Revision history for this message
Chad Smith (chad.smith) :
Revision history for this message
Chad Smith (chad.smith) wrote :

Integration tests nocloud-kvm work well on a fresh artful install when I do the following:
sudo apt install python3-simplestreams ubuntu-cloudimage-keyring
sudo mkdir -i /srv/citest
sudo chown me:me /srv/citest
python3 -m tests.cloud_tests run -p nocloud-kvm --os-name artful --preserve-data -data-dir restults --verbose -deb cloud-init_17.1-14-gfa66a42-1~bddeb_all.deb

review: Approve
Revision history for this message
Chad Smith (chad.smith) wrote :

for tox -e citest to work this branch was missing a rebase I think on master to pull in bzr:lp:simplestreams

review: Approve
Revision history for this message
Chad Smith (chad.smith) wrote :
Revision history for this message
Scott Moser (smoser) wrote :

At first I was not keen on the use of /var/tmp, as I knew that Ubuntu was carrying a patch to systemd upstream for that behavior, and figured that we were really just buying time before someone decided "oh lets remove /var/tmp/ also".

I dug a bit, patch [1] that does this is to fix Debian bug 675422 [2].
That bug references the FHS [3] which at least gives us a reasonable justification for
our use:

| The /var/tmp directory is made available for programs that require
| temporary files or directories that are preserved between system
| reboots. Therefore, data stored in /var/tmp is more persistent than
| data in /tmp.

| Files and directories located in /var/tmp must not be deleted when the
| system is booted. Although data stored in /var/tmp is typically deleted
| in a site-specific manner, it is recommended that deletions occur at a
| less frequent interval than /tmp.

So, it seems sane that /var/tmp can be used.
But for some use cases /run/my-dir is better (in that it is guaranteed
to *not* have stale data across a boot).

[1] https://git.launchpad.net/~usd-import-team/ubuntu/+source/systemd/tree/debian/patches/debian/Bring-tmpfiles.d-tmp.conf-in-line-with-Debian-defaul.patch?h=applied/ubuntu/artful
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=675422
[3] http://www.pathname.com/fhs/pub/fhs-2.3.html#VARTMPTEMPORARYFILESPRESERVEDBETWEE

Revision history for this message
Scott Moser (smoser) wrote :

With regard to "not logged in as root by default", that is kind of wrong.
Any 'instance.execute()' should assume execution is root. Using something
different would mean that the caller has to adjust their usage based on
the backend being used. That is kind of painful.

lets see if we can't just easily fix that.

Revision history for this message
Joshua Powers (powersj) wrote :

>lets see if we can't just easily fix that.

I looked a little bit at this, particularly at the tests/cloud_tests/instances/base.py:run_script() function.

I think this is better tackled by removing our method of pushing a script and then executing that script and instead of going to your proposed method of specifying what is collected, specifically:

# These files should be collected when we from the running instance
# at the end of boot. Anything ending in a '/' should include
# be recursive.
files:
  - /run/cloud-init/
  - /var/lib/cloud/
  - /etc/passwd

# These are exectuted and the dictionary available to the test results.
collect_scripts:
  hosts: [cat, /etc/hosts]
  ps-a: [ps, -a]

At that point, we can handle the execution of by root then and there.

Thoughts? Is there an easy mechanism I have overlooked?

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:6d9dd0da9b042352b8ad7b40e365f3251288354f
https://jenkins.ubuntu.com/server/job/cloud-init-ci/440/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    FAILED: Ubuntu LTS: Integration

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/440/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:6d9dd0da9b042352b8ad7b40e365f3251288354f
https://jenkins.ubuntu.com/server/job/cloud-init-ci/441/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: MAAS Compatability Testing
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/441/rebuild

review: Approve (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:806f48840ef5689c4f1647aac464f09768ec39ce
https://jenkins.ubuntu.com/server/job/cloud-init-ci/444/
Executed test runs:
    SUCCESS: Checkout
    FAILED: Unit & Style Tests

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/444/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:59d162eecd48079d7a67831b79292c20f1dd3620
https://jenkins.ubuntu.com/server/job/cloud-init-ci/445/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: MAAS Compatability Testing
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/445/rebuild

review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :

tmpfile should look more like this:

    def tmpfile(self):
        path = "/tmp/%s-%04d" % (type(self).__name__, self._tmp_count)
        self._tmp_count += 1
        return path

then we're good.
as is, the tmpfile name never changed, which is kind of not very tmpfile-like

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:6c3c9fc43cd75bb6f1c7fd6a086ef03b952612d6
https://jenkins.ubuntu.com/server/job/cloud-init-ci/448/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: MAAS Compatability Testing
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/448/rebuild

review: Approve (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:13e29b79db4efc46db725a793a3840b8832149c9
https://jenkins.ubuntu.com/server/job/cloud-init-ci/451/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: MAAS Compatability Testing
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/451/rebuild

review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :

pushed a branch of mine to
 https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/333059
which takes this and adds.

Revision history for this message
Scott Moser (smoser) wrote :

I've called this merged as my branch went in.
thanks josh.

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tests/cloud_tests/instances/base.py b/tests/cloud_tests/instances/base.py
2index 9bdda60..8f58c69 100644
3--- a/tests/cloud_tests/instances/base.py
4+++ b/tests/cloud_tests/instances/base.py
5@@ -22,6 +22,7 @@ class Instance(object):
6 self.properties = properties
7 self.config = config
8 self.features = features
9+ self._tmp_count = 0
10
11 def execute(self, command, stdout=None, stderr=None, env=None,
12 rcs=None, description=None):
13@@ -97,7 +98,9 @@ class Instance(object):
14
15 @return_value: path to new file in target
16 """
17- return self.execute(['mktemp'])[0].strip()
18+ path = "/tmp/%s-%04d" % (type(self).__name__, self._tmp_count)
19+ self._tmp_count += 1
20+ return path
21
22 def console_log(self):
23 """Instance console.
24diff --git a/tests/cloud_tests/instances/nocloudkvm.py b/tests/cloud_tests/instances/nocloudkvm.py
25index 8a0e531..cf5d571 100644
26--- a/tests/cloud_tests/instances/nocloudkvm.py
27+++ b/tests/cloud_tests/instances/nocloudkvm.py
28@@ -76,7 +76,7 @@ class NoCloudKVMInstance(base.Instance):
29 command = ['sh', '-c', command]
30
31 if self.pid:
32- return self.ssh(command)
33+ return self.ssh(['sudo'] + list(command))
34 else:
35 return self.mount_image_callback(command) + (0,)
36
37diff --git a/tests/cloud_tests/testcases/examples/run_commands.yaml b/tests/cloud_tests/testcases/examples/run_commands.yaml
38index b0e311b..f80eb8c 100644
39--- a/tests/cloud_tests/testcases/examples/run_commands.yaml
40+++ b/tests/cloud_tests/testcases/examples/run_commands.yaml
41@@ -7,10 +7,10 @@ enabled: False
42 cloud_config: |
43 #cloud-config
44 runcmd:
45- - echo cloud-init run cmd test > /tmp/run_cmd
46+ - echo cloud-init run cmd test > /var/tmp/run_cmd
47 collect_scripts:
48 run_cmd: |
49 #!/bin/bash
50- cat /tmp/run_cmd
51+ cat /var/tmp/run_cmd
52
53 # vi: ts=4 expandtab
54diff --git a/tests/cloud_tests/testcases/examples/writing_out_arbitrary_files.yaml b/tests/cloud_tests/testcases/examples/writing_out_arbitrary_files.yaml
55index 6f78f99..d5da0ca 100644
56--- a/tests/cloud_tests/testcases/examples/writing_out_arbitrary_files.yaml
57+++ b/tests/cloud_tests/testcases/examples/writing_out_arbitrary_files.yaml
58@@ -9,37 +9,36 @@ cloud_config: |
59 write_files:
60 - encoding: b64
61 content: CiMgVGhpcyBmaWxlIGNvbnRyb2xzIHRoZSBzdGF0ZSBvZiBTRUxpbnV4
62- owner: root:root
63- path: /root/file_b64
64+ path: /var/tmp/file_b64
65 permissions: '0644'
66 - content: |
67- # My new /root/file_text
68+ # My new /var/tmp/file_text
69
70 SMBDOPTIONS="-D"
71- path: /root/file_text
72+ path: /var/tmp/file_text
73 - content: !!binary |
74 f0VMRgIBAQAAAAAAAAAAAAIAPgABAAAAwARAAAAAAABAAAAAAAAAAJAVAAAAAAAAAAAAAEAAOAAI
75 AEAAHgAdAAYAAAAFAAAAQAAAAAAAAABAAEAAAAAAAEAAQAAAAAAAwAEAAAAAAADAAQAAAAAAAAgA
76 AAAAAAAAAwAAAAQAAAAAAgAAAAAAAAACQAAAAAAAAAJAAAAAAAAcAAAAAAAAABwAAAAAAAAAAQAA
77- path: /root/file_binary
78+ path: /var/tmp/file_binary
79 permissions: '0555'
80 - encoding: gzip
81 content: !!binary |
82 H4sIAIDb/U8C/1NW1E/KzNMvzuBKTc7IV8hIzcnJVyjPL8pJ4QIA6N+MVxsAAAA=
83- path: /root/file_gzip
84+ path: /var/tmp/file_gzip
85 permissions: '0755'
86 collect_scripts:
87 file_b64: |
88 #!/bin/bash
89- file /root/file_b64
90+ file /var/tmp/file_b64
91 file_text: |
92 #!/bin/bash
93- file /root/file_text
94+ file /var/tmp/file_text
95 file_binary: |
96 #!/bin/bash
97- file /root/file_binary
98+ file /var/tmp/file_binary
99 file_gzip: |
100 #!/bin/bash
101- file /root/file_gzip
102+ file /var/tmp/file_gzip
103
104 # vi: ts=4 expandtab
105diff --git a/tests/cloud_tests/testcases/modules/keys_to_console.py b/tests/cloud_tests/testcases/modules/keys_to_console.py
106index 88b6812..07f3811 100644
107--- a/tests/cloud_tests/testcases/modules/keys_to_console.py
108+++ b/tests/cloud_tests/testcases/modules/keys_to_console.py
109@@ -10,13 +10,13 @@ class TestKeysToConsole(base.CloudTestCase):
110 def test_excluded_keys(self):
111 """Test excluded keys missing."""
112 out = self.get_data_file('syslog')
113- self.assertNotIn('DSA', out)
114- self.assertNotIn('ECDSA', out)
115+ self.assertNotIn('(DSA)', out)
116+ self.assertNotIn('(ECDSA)', out)
117
118 def test_expected_keys(self):
119 """Test expected keys exist."""
120 out = self.get_data_file('syslog')
121- self.assertIn('ED25519', out)
122- self.assertIn('RSA', out)
123+ self.assertIn('(ED25519)', out)
124+ self.assertIn('(RSA)', out)
125
126 # vi: ts=4 expandtab
127diff --git a/tests/cloud_tests/testcases/modules/runcmd.yaml b/tests/cloud_tests/testcases/modules/runcmd.yaml
128index 04e5a05..8309a88 100644
129--- a/tests/cloud_tests/testcases/modules/runcmd.yaml
130+++ b/tests/cloud_tests/testcases/modules/runcmd.yaml
131@@ -4,10 +4,10 @@
132 cloud_config: |
133 #cloud-config
134 runcmd:
135- - echo cloud-init run cmd test > /tmp/run_cmd
136+ - echo cloud-init run cmd test > /var/tmp/run_cmd
137 collect_scripts:
138 run_cmd: |
139 #!/bin/bash
140- cat /tmp/run_cmd
141+ cat /var/tmp/run_cmd
142
143 # vi: ts=4 expandtab
144diff --git a/tests/cloud_tests/testcases/modules/seed_random_command.yaml b/tests/cloud_tests/testcases/modules/seed_random_command.yaml
145index 6a9157e..a201c0a 100644
146--- a/tests/cloud_tests/testcases/modules/seed_random_command.yaml
147+++ b/tests/cloud_tests/testcases/modules/seed_random_command.yaml
148@@ -9,10 +9,10 @@ cloud_config: |
149 random_seed:
150 command: ["cat", "/proc/sys/kernel/random/uuid"]
151 command_required: true
152- file: /root/seed
153+ file: /var/tmp/seed
154 collect_scripts:
155 seed_data: |
156 #!/bin/bash
157- cat /root/seed
158+ cat /var/tmp/seed
159
160 # vi: ts=4 expandtab
161diff --git a/tests/cloud_tests/testcases/modules/seed_random_data.yaml b/tests/cloud_tests/testcases/modules/seed_random_data.yaml
162index a9b2c88..2e6e134 100644
163--- a/tests/cloud_tests/testcases/modules/seed_random_data.yaml
164+++ b/tests/cloud_tests/testcases/modules/seed_random_data.yaml
165@@ -6,10 +6,10 @@ cloud_config: |
166 random_seed:
167 data: 'MYUb34023nD:LFDK10913jk;dfnk:Df'
168 encoding: raw
169- file: /root/seed
170+ file: /var/tmp/seed
171 collect_scripts:
172 seed_data: |
173 #!/bin/bash
174- cat /root/seed
175+ cat /var/tmp/seed
176
177 # vi: ts=4 expandtab
178diff --git a/tests/cloud_tests/testcases/modules/set_password_expire.py b/tests/cloud_tests/testcases/modules/set_password_expire.py
179index a1c3aa0..967aca7 100644
180--- a/tests/cloud_tests/testcases/modules/set_password_expire.py
181+++ b/tests/cloud_tests/testcases/modules/set_password_expire.py
182@@ -18,6 +18,6 @@ class TestPasswordExpire(base.CloudTestCase):
183 def test_sshd_config(self):
184 """Test sshd config allows passwords."""
185 out = self.get_data_file('sshd_config')
186- self.assertIn('PasswordAuthentication no', out)
187+ self.assertIn('PasswordAuthentication yes', out)
188
189 # vi: ts=4 expandtab
190diff --git a/tests/cloud_tests/testcases/modules/set_password_expire.yaml b/tests/cloud_tests/testcases/modules/set_password_expire.yaml
191index 789604b..ba6344b 100644
192--- a/tests/cloud_tests/testcases/modules/set_password_expire.yaml
193+++ b/tests/cloud_tests/testcases/modules/set_password_expire.yaml
194@@ -6,7 +6,9 @@ required_features:
195 cloud_config: |
196 #cloud-config
197 chpasswd: { expire: True }
198+ ssh_pwauth: yes
199 users:
200+ - default
201 - name: tom
202 password: $1$xyz$sPMsLNmf66Ohl.ol6JvzE.
203 lock_passwd: false
204diff --git a/tests/cloud_tests/testcases/modules/set_password_list.yaml b/tests/cloud_tests/testcases/modules/set_password_list.yaml
205index a2a89c9..fd3e1e4 100644
206--- a/tests/cloud_tests/testcases/modules/set_password_list.yaml
207+++ b/tests/cloud_tests/testcases/modules/set_password_list.yaml
208@@ -5,6 +5,7 @@ cloud_config: |
209 #cloud-config
210 ssh_pwauth: yes
211 users:
212+ - default
213 - name: tom
214 # md5 gotomgo
215 passwd: "$1$S7$tT1BEDIYrczeryDQJfdPe0"
216diff --git a/tests/cloud_tests/testcases/modules/set_password_list_string.yaml b/tests/cloud_tests/testcases/modules/set_password_list_string.yaml
217index c2a0f63..e9fe54b 100644
218--- a/tests/cloud_tests/testcases/modules/set_password_list_string.yaml
219+++ b/tests/cloud_tests/testcases/modules/set_password_list_string.yaml
220@@ -5,6 +5,7 @@ cloud_config: |
221 #cloud-config
222 ssh_pwauth: yes
223 users:
224+ - default
225 - name: tom
226 # md5 gotomgo
227 passwd: "$1$S7$tT1BEDIYrczeryDQJfdPe0"
228diff --git a/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.py b/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.py
229index 8222321..e7329d4 100644
230--- a/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.py
231+++ b/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.py
232@@ -13,12 +13,4 @@ class TestSshKeyFingerprintsDisable(base.CloudTestCase):
233 self.assertIn('Skipping module named ssh-authkey-fingerprints, '
234 'logging of ssh fingerprints disabled', out)
235
236- def test_syslog(self):
237- """Verify output of syslog."""
238- out = self.get_data_file('syslog')
239- self.assertNotRegex(out, r'256 SHA256:.*(ECDSA)')
240- self.assertNotRegex(out, r'256 SHA256:.*(ED25519)')
241- self.assertNotRegex(out, r'1024 SHA256:.*(DSA)')
242- self.assertNotRegex(out, r'2048 SHA256:.*(RSA)')
243-
244 # vi: ts=4 expandtab
245diff --git a/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.yaml b/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.yaml
246index 746653e..d93893e 100644
247--- a/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.yaml
248+++ b/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.yaml
249@@ -5,7 +5,6 @@ required_features:
250 - syslog
251 cloud_config: |
252 #cloud-config
253- ssh_genkeytypes: []
254 no_ssh_fingerprints: true
255 collect_scripts:
256 syslog: |
257diff --git a/tests/cloud_tests/testcases/modules/ssh_keys_generate.py b/tests/cloud_tests/testcases/modules/ssh_keys_generate.py
258index fd6d9ba..b68f556 100644
259--- a/tests/cloud_tests/testcases/modules/ssh_keys_generate.py
260+++ b/tests/cloud_tests/testcases/modules/ssh_keys_generate.py
261@@ -9,11 +9,6 @@ class TestSshKeysGenerate(base.CloudTestCase):
262
263 # TODO: Check cloud-init-output for the correct keys being generated
264
265- def test_ubuntu_authorized_keys(self):
266- """Test passed in key is not in list for ubuntu."""
267- out = self.get_data_file('auth_keys_ubuntu')
268- self.assertEqual('', out)
269-
270 def test_dsa_public(self):
271 """Test dsa public key not generated."""
272 out = self.get_data_file('dsa_public')
273diff --git a/tests/cloud_tests/testcases/modules/ssh_keys_generate.yaml b/tests/cloud_tests/testcases/modules/ssh_keys_generate.yaml
274index 659fd93..a702f66 100644
275--- a/tests/cloud_tests/testcases/modules/ssh_keys_generate.yaml
276+++ b/tests/cloud_tests/testcases/modules/ssh_keys_generate.yaml
277@@ -10,12 +10,9 @@ cloud_config: |
278 - ed25519
279 authkey_hash: sha512
280 collect_scripts:
281- auth_keys_root: |
282+ auth_keys: |
283 #!/bin/bash
284- cat /root/.ssh/authorized_keys
285- auth_keys_ubuntu: |
286- #!/bin/bash
287- cat /home/ubuntu/ssh/authorized_keys
288+ cat $HOME/.ssh/authorized_keys
289 dsa_public: |
290 #!/bin/bash
291 cat /etc/ssh/ssh_host_dsa_key.pub
292diff --git a/tests/cloud_tests/testcases/modules/ssh_keys_provided.py b/tests/cloud_tests/testcases/modules/ssh_keys_provided.py
293index 544649d..add3f46 100644
294--- a/tests/cloud_tests/testcases/modules/ssh_keys_provided.py
295+++ b/tests/cloud_tests/testcases/modules/ssh_keys_provided.py
296@@ -7,17 +7,6 @@ from tests.cloud_tests.testcases import base
297 class TestSshKeysProvided(base.CloudTestCase):
298 """Test ssh keys module."""
299
300- def test_ubuntu_authorized_keys(self):
301- """Test passed in key is not in list for ubuntu."""
302- out = self.get_data_file('auth_keys_ubuntu')
303- self.assertEqual('', out)
304-
305- def test_root_authorized_keys(self):
306- """Test passed in key is in authorized list for root."""
307- out = self.get_data_file('auth_keys_root')
308- self.assertIn('lzrkPqONphoZx0LDV86w7RUz1ksDzAdcm0tvmNRFMN1a0frDs50'
309- '6oA3aWK0oDk4Nmvk8sXGTYYw3iQSkOvDUUlIsqdaO+w==', out)
310-
311 def test_dsa_public(self):
312 """Test dsa public key passed in."""
313 out = self.get_data_file('dsa_public')
314diff --git a/tests/cloud_tests/testcases/modules/ssh_keys_provided.yaml b/tests/cloud_tests/testcases/modules/ssh_keys_provided.yaml
315index 5ceb362..9adabf4 100644
316--- a/tests/cloud_tests/testcases/modules/ssh_keys_provided.yaml
317+++ b/tests/cloud_tests/testcases/modules/ssh_keys_provided.yaml
318@@ -39,7 +39,7 @@ cloud_config: |
319 vek8Uo8ap8AEsv4Rfs9opUcUZevLp3g2741eOaidHVLm0l4iLIVl03otGOqvSzs+
320 A3tFPEOxauXpzCt8f8eXsz0WQXAgIKW2h8zu5QHjomioU3i27mtE
321 -----END RSA PRIVATE KEY-----
322- rsa_public: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0/Ho+o3eJISydO2JvIgTLnZOtrxPl+fSvJfKDjoOLY0HB2eOjy2s2/2N6d9X9SGZ4+XnyVeNPjfBXw4IyXoqxhfIF16Azfk022iejgjiYssoUxH31M60OfqJhxo16dWEXdkKP1nac06VOt1zS5yEeooyvEuMJEJSsv3VR/7GKhMX3TVhEz5moLmVP3bIAvvoXio8X4urVC1R819QjDC86nlxwNks/GKPRi/IHO5tjJ72Eke7KNsm/vxHgkdX4vZaHNKhfdb/pavFXN5eoUaofz3hxw5oL/u2epI/pXyUhDp8Tb5wO6slykzcIlGCSd0YeO1TnljvViRx0uSxIy97N root@xenial-lxd
323+ rsa_public: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0/Ho+o3eJISydO2JvIgTLnZOtrxPl+fSvJfKDjoOLY0HB2eOjy2s2/2N6d9X9SGZ4+XnyVeNPjfBXw4IyXoqxhfIF16Azfk022iejgjiYssoUxH31M60OfqJhxo16dWEXdkKP1nac06VOt1zS5yEeooyvEuMJEJSsv3VR/7GKhMX3TVhEz5moLmVP3bIAvvoXio8X4urVC1R819QjDC86nlxwNks/GKPRi/IHO5tjJ72Eke7KNsm/vxHgkdX4vZaHNKhfdb/pavFXN5eoUaofz3hxw5oL/u2epI/pXyUhDp8Tb5wO6slykzcIlGCSd0YeO1TnljvViRx0uSxIy97N ubuntu@xenial-lxd
324 dsa_private: |
325 -----BEGIN DSA PRIVATE KEY-----
326 MIIBuwIBAAKBgQD5Fstc23IVSDe6k4DNP8smPKuEWUvHDTOGaXrhOVAfzZ6+jklP
327@@ -53,7 +53,7 @@ cloud_config: |
328 wExw3doDSCUb28L1B50wBzQ8mC3KXp6C7IkBXWspb16DLHUHFSI8bkICFA5kVUcW
329 nCPOXEQsayANi8+Cb7BH
330 -----END DSA PRIVATE KEY-----
331- dsa_public: ssh-dss AAAAB3NzaC1kc3MAAACBAPkWy1zbchVIN7qTgM0/yyY8q4RZS8cNM4ZpeuE5UB/Nnr6OSU/nmbO8LuM7nc9ZYLfWGrXTEGhZ16/Ra1w0X1O/7hsBrXbrfLnVGqjgYjvHH7GJzV2Yuqp9iKMFP2Tjwn/W1XRyzVaOzoU/8glMP+RhUL3fQmNhAyLvbaUGdTGxAAAAFQC+4s930xik70s71tMEJcJ2KUtkBQAAAIA2n4p3JL1X3ceDEZAQ3WuWP9NK/9rcRV0Iq0SdB/nlo8fEMBUNXDkm1GHillttFXigZE9z0o52OjkFTby9IzcuaGRv5RpoNfAeSAicrX3ejvgMqMANZnG4vLKIoeIw6HGjOjEN+NbGzyfPq6q9JbSmvnbUTAhjpFqNsQOdnZrcaQAAAIEAyoUomNRB6bmpsIfzt8zdtqLP5umIj2uhr9MVPL8/QdbxmJ72Z7pfQ2z1B7QAdIBGOlqJXtlau7ABhWK29Efe+99ObyTSSdDc6RCDeAwUmBAiPRQhDH2EwExw3doDSCUb28L1B50wBzQ8mC3KXp6C7IkBXWspb16DLHUHFSI8bkI= root@xenial-lxd
332+ dsa_public: ssh-dss AAAAB3NzaC1kc3MAAACBAPkWy1zbchVIN7qTgM0/yyY8q4RZS8cNM4ZpeuE5UB/Nnr6OSU/nmbO8LuM7nc9ZYLfWGrXTEGhZ16/Ra1w0X1O/7hsBrXbrfLnVGqjgYjvHH7GJzV2Yuqp9iKMFP2Tjwn/W1XRyzVaOzoU/8glMP+RhUL3fQmNhAyLvbaUGdTGxAAAAFQC+4s930xik70s71tMEJcJ2KUtkBQAAAIA2n4p3JL1X3ceDEZAQ3WuWP9NK/9rcRV0Iq0SdB/nlo8fEMBUNXDkm1GHillttFXigZE9z0o52OjkFTby9IzcuaGRv5RpoNfAeSAicrX3ejvgMqMANZnG4vLKIoeIw6HGjOjEN+NbGzyfPq6q9JbSmvnbUTAhjpFqNsQOdnZrcaQAAAIEAyoUomNRB6bmpsIfzt8zdtqLP5umIj2uhr9MVPL8/QdbxmJ72Z7pfQ2z1B7QAdIBGOlqJXtlau7ABhWK29Efe+99ObyTSSdDc6RCDeAwUmBAiPRQhDH2EwExw3doDSCUb28L1B50wBzQ8mC3KXp6C7IkBXWspb16DLHUHFSI8bkI= ubuntu@xenial-lxd
333 ed25519_private: |
334 -----BEGIN OPENSSH PRIVATE KEY-----
335 b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
336@@ -62,21 +62,15 @@ cloud_config: |
337 AAAEDQlFZpz9q8+/YJHS9+jPAqy2ZT6cGEv8HTB6RZtTjd/dudAZSu4vjZpVWzId5pXmZg
338 1M6G15dqjQ2XkNVOEnb5AAAAD3Jvb3RAeGVuaWFsLWx4ZAECAwQFBg==
339 -----END OPENSSH PRIVATE KEY-----
340- ed25519_public: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINudAZSu4vjZpVWzId5pXmZg1M6G15dqjQ2XkNVOEnb5 root@xenial-lxd
341+ ed25519_public: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINudAZSu4vjZpVWzId5pXmZg1M6G15dqjQ2XkNVOEnb5 ubuntu@xenial-lxd
342 ecdsa_private: |
343 -----BEGIN EC PRIVATE KEY-----
344 MHcCAQEEIDuK+QFc1wmyJY8uDqQVa1qHte30Rk/fdLxGIBkwJAyOoAoGCCqGSM49
345 AwEHoUQDQgAEWxLlO+TL8gL91eET9p/HFQbqR1A691AkJgZk3jY5mpZqxgX4vcgb
346 7f/CtXuM6s2svcDJqAeXr6Wk8OJJcMxylA==
347 -----END EC PRIVATE KEY-----
348- ecdsa_public: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFsS5Tvky/IC/dXhE/afxxUG6kdQOvdQJCYGZN42OZqWasYF+L3IG+3/wrV7jOrNrL3AyagHl6+lpPDiSXDMcpQ= root@xenial-lxd
349+ ecdsa_public: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFsS5Tvky/IC/dXhE/afxxUG6kdQOvdQJCYGZN42OZqWasYF+L3IG+3/wrV7jOrNrL3AyagHl6+lpPDiSXDMcpQ= ubuntu@xenial-lxd
350 collect_scripts:
351- auth_keys_root: |
352- #!/bin/bash
353- cat /root/.ssh/authorized_keys
354- auth_keys_ubuntu: |
355- #!/bin/bash
356- cat /home/ubuntu/ssh/authorized_keys
357 dsa_public: |
358 #!/bin/bash
359 cat /etc/ssh/ssh_host_dsa_key.pub
360diff --git a/tests/cloud_tests/testcases/modules/write_files.yaml b/tests/cloud_tests/testcases/modules/write_files.yaml
361index ce936b7..c5b48c0 100644
362--- a/tests/cloud_tests/testcases/modules/write_files.yaml
363+++ b/tests/cloud_tests/testcases/modules/write_files.yaml
364@@ -10,37 +10,36 @@ cloud_config: |
365 write_files:
366 - encoding: b64
367 content: CiMgVGhpcyBmaWxlIGNvbnRyb2xzIHRoZSBzdGF0ZSBvZiBTRUxpbnV4
368- owner: root:root
369- path: /root/file_b64
370+ path: /var/tmp/file_b64
371 permissions: '0644'
372 - content: |
373- # My new /root/file_text
374+ # My new /var/tmp/file_text
375
376 SMBDOPTIONS="-D"
377- path: /root/file_text
378+ path: /var/tmp/file_text
379 - content: !!binary |
380 f0VMRgIBAQAAAAAAAAAAAAIAPgABAAAAwARAAAAAAABAAAAAAAAAAJAVAAAAAAAAAAAAAEAAOAAI
381 AEAAHgAdAAYAAAAFAAAAQAAAAAAAAABAAEAAAAAAAEAAQAAAAAAAwAEAAAAAAADAAQAAAAAAAAgA
382 AAAAAAAAAwAAAAQAAAAAAgAAAAAAAAACQAAAAAAAAAJAAAAAAAAcAAAAAAAAABwAAAAAAAAAAQAA
383- path: /root/file_binary
384+ path: /var/tmp/file_binary
385 permissions: '0555'
386 - encoding: gzip
387 content: !!binary |
388 H4sIAIDb/U8C/1NW1E/KzNMvzuBKTc7IV8hIzcnJVyjPL8pJ4QIA6N+MVxsAAAA=
389- path: /root/file_gzip
390+ path: /var/tmp/file_gzip
391 permissions: '0755'
392 collect_scripts:
393 file_b64: |
394 #!/bin/bash
395- file /root/file_b64
396+ file /var/tmp/file_b64
397 file_text: |
398 #!/bin/bash
399- file /root/file_text
400+ file /var/tmp/file_text
401 file_binary: |
402 #!/bin/bash
403- file /root/file_binary
404+ file /var/tmp/file_binary
405 file_gzip: |
406 #!/bin/bash
407- file /root/file_gzip
408+ file /var/tmp/file_gzip
409
410 # vi: ts=4 expandtab

Subscribers

People subscribed via source and target branches