-
Notifications
You must be signed in to change notification settings - Fork 837
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b05b1a
commit b10805f
Showing
10 changed files
with
478 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""Integration test for the runcmd module. | ||
This test specifies a command to be executed by the ``runcmd`` module | ||
and then checks if that command was executed during boot. | ||
(This is ported from | ||
``tests/cloud_tests/testcases/modules/runcmd.yaml``.)""" | ||
|
||
import pytest | ||
|
||
|
||
USER_DATA = """\ | ||
#cloud-config | ||
runcmd: | ||
- echo cloud-init run cmd test > /var/tmp/run_cmd | ||
""" | ||
|
||
|
||
class TestRuncmd: | ||
|
||
@pytest.mark.user_data(USER_DATA) | ||
def test_runcmd(self, client): | ||
runcmd_output = client.read_from_file("/var/tmp/run_cmd") | ||
assert runcmd_output.strip() == "cloud-init run cmd test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Integration test for the random seed module. | ||
This test specifies a command to be executed by the ``seed_random`` module, by | ||
providing a different data to be used as seed data. We will then check | ||
if that seed data was actually used. | ||
(This is ported from | ||
``tests/cloud_tests/testcases/modules/seed_random_data.yaml``.)""" | ||
|
||
import pytest | ||
|
||
|
||
USER_DATA = """\ | ||
#cloud-config | ||
random_seed: | ||
data: 'MYUb34023nD:LFDK10913jk;dfnk:Df' | ||
encoding: raw | ||
file: /root/seed | ||
""" | ||
|
||
|
||
class TestSeedRandomData: | ||
|
||
@pytest.mark.user_data(USER_DATA) | ||
def test_seed_random_data(self, client): | ||
seed_output = client.read_from_file("/root/seed") | ||
assert seed_output.strip() == "MYUb34023nD:LFDK10913jk;dfnk:Df" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""Integration test for the set_hostname module. | ||
This test specifies a hostname and fqdn through the ``set_hostname`` module | ||
and then checks if the system hostname is the one specified. | ||
(This is ported from | ||
``tests/cloud_tests/testcases/modules/set_hostname.yaml`` and | ||
``tests/cloud_tests/testcases/modules/set_hostname_fqdn.yaml``.)""" | ||
|
||
import pytest | ||
|
||
|
||
USER_DATA_HOSTNAME = """\ | ||
#cloud-config | ||
hostname: cloudinit2 | ||
""" | ||
|
||
USER_DATA_FQDN = """\ | ||
#cloud-config | ||
manage_etc_hosts: true | ||
hostname: cloudinit1 | ||
fqdn: cloudinit2.i9n.cloud-init.io | ||
""" | ||
|
||
|
||
class TestHostname: | ||
|
||
@pytest.mark.user_data(USER_DATA_HOSTNAME) | ||
def test_hostname(self, client): | ||
hostname_output = client.execute("hostname") | ||
assert "cloudinit2" in hostname_output.strip() | ||
|
||
@pytest.mark.user_data(USER_DATA_FQDN) | ||
def test_hostname_and_fqdn(self, client): | ||
hostname_output = client.execute("hostname") | ||
assert "cloudinit1" in hostname_output.strip() | ||
|
||
fqdn_output = client.execute("hostname --fqdn") | ||
assert "cloudinit2.i9n.cloud-init.io" in fqdn_output.strip() | ||
|
||
host_output = client.execute("grep ^127 /etc/hosts") | ||
assert '127.0.1.1 {} {}'.format( | ||
fqdn_output, hostname_output) in host_output | ||
assert '127.0.0.1 localhost' in host_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Integration test for the snap module. | ||
This test specifies a command to be executed by the ``runcmd`` module | ||
and then checks that if that command was executed during boot. | ||
(This is ported from | ||
``tests/cloud_tests/testcases/modules/runcmd.yaml``.)""" | ||
|
||
import pytest | ||
|
||
|
||
USER_DATA = """\ | ||
#cloud-config | ||
package_update: true | ||
snap: | ||
squashfuse_in_container: true | ||
commands: | ||
- snap install hello-world | ||
""" | ||
|
||
|
||
class TestSnap: | ||
|
||
@pytest.mark.user_data(USER_DATA) | ||
def test_snap(self, client): | ||
snap_output = client.execute("snap list") | ||
assert "core" in snap_output | ||
assert "hello-world" in snap_output |
46 changes: 46 additions & 0 deletions
46
tests/integration_tests/modules/test_ssh_auth_key_fingerprints.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"""Integration test for the ssh_authkey_fingerprints module. | ||
This test specifies a command to be executed by the | ||
``ssh_authkey_fingerprints`` module and then checks that if the commands | ||
were respected during boot. | ||
(This is ported from | ||
``tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.yaml``, | ||
``tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_enable.yaml``. | ||
)""" | ||
import re | ||
|
||
import pytest | ||
|
||
|
||
USER_DATA_SSH_AUTHKEY_DISABLE = """\ | ||
#cloud-config | ||
no_ssh_fingerprints: true | ||
""" | ||
|
||
USER_DATA_SSH_AUTHKEY_ENABLE="""\ | ||
#cloud-config | ||
ssh_genkeytypes: | ||
- ecdsa | ||
- ed25519 | ||
ssh_authorized_keys: | ||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDXW9Gg5H7ehjdSc6qDzwNtgCy94XYHhEYlXZMO2+FJrH3wfHGiMfCwOHxcOMt2QiXItULthdeQWS9QjBSSjVRXf6731igFrqPFyS9qBlOQ5D29C4HBXFnQggGVpBNJ82IRJv7szbbe/vpgLBP4kttUza9Dr4e1YM1ln4PRnjfXea6T0m+m1ixNb5432pTXlqYOnNOxSIm1gHgMLxPuDrJvQERDKrSiKSjIdyC9Jd8t2e1tkNLY0stmckVRbhShmcJvlyofHWbc2Ca1mmtP7MlS1VQnfLkvU1IrFwkmaQmaggX6WR6coRJ6XFXdWcq/AI2K6GjSnl1dnnCxE8VCEXBlXgFzad+PMSG4yiL5j8Oo1ZVpkTdgBnw4okGqTYCXyZg6X00As9IBNQfZMFlQXlIo4FiWgj3CO5QHQOyOX6FuEumaU13GnERrSSdp9tCs1Qm3/DG2RSCQBWTfcgMcStIvKqvJ3IjFn0vGLvI3Ampnq9q1SHwmmzAPSdzcMA76HyMUA5VWaBvWHlUxzIM6unxZASnwvuCzpywSEB5J2OF+p6H+cStJwQ32XwmOG8pLp1srlVWpqZI58Du/lzrkPqONphoZx0LDV86w7RUz1ksDzAdcm0tvmNRFMN1a0frDs506oA3aWK0oDk4Nmvk8sXGTYYw3iQSkOvDUUlIsqdaO+w== | ||
""" # noqa | ||
|
||
|
||
class TestSshAuthkeyFingerprints: | ||
|
||
@pytest.mark.user_data(USER_DATA_SSH_AUTHKEY_DISABLE) | ||
def test_ssh_authkey_fingerprints_disable(self, client): | ||
cloudinit_output = client.read_from_file("/var/log/cloud-init.log") | ||
assert ( | ||
"Skipping module named ssh-authkey-fingerprints, " | ||
"logging of SSH fingerprints disabled") in cloudinit_output | ||
|
||
@pytest.mark.user_data(USER_DATA_SSH_AUTHKEY_ENABLE) | ||
def test_ssh_authkey_fingerprints_enable(self, client): | ||
syslog_output = client.read_from_file("/var/log/syslog") | ||
|
||
assert re.search(r'256 SHA256:.*(ECDSA)', syslog_output) is not None | ||
assert re.search(r'256 SHA256:.*(ED25519)', syslog_output) is not None | ||
assert re.search(r'1024 SHA256:.*(DSA)', syslog_output) is None | ||
assert re.search(r'2048 SHA256:.*(RSA)', syslog_output) is None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
"""Integration test for the ssh module. | ||
This test specifies keys to be generated by the ``ssh`` module | ||
and then checks that if those keys were successfully created. | ||
(This is ported from | ||
``tests/cloud_tests/testcases/modules/ssh_keys_generate.yaml``.)""" | ||
|
||
import pytest | ||
|
||
|
||
USER_DATA = """\ | ||
#cloud-config | ||
ssh_genkeytypes: | ||
- ecdsa | ||
- ed25519 | ||
authkey_hash: sha512 | ||
""" | ||
|
||
|
||
class TestSshKeysGenerate: | ||
|
||
@pytest.mark.user_data(USER_DATA) | ||
def test_ssh_keys_generate(self, client): | ||
"""Test dsa public key not generated.""" | ||
out = client.execute( | ||
"cat /etc/ssh/ssh_host_dsa_key.pub > /dev/null || echo 'not found'" | ||
) | ||
assert "not found" == out | ||
|
||
"""Test dsa private key not generated.""" | ||
out = client.execute( | ||
"cat /etc/ssh/ssh_host_dsa_key > /dev/null || echo 'not found'" | ||
) | ||
assert "not found" == out | ||
|
||
"""Test rsa public key not generated.""" | ||
out = client.execute( | ||
"cat /etc/ssh/ssh_host_rsa_key.pub > /dev/null || echo 'not found'" | ||
) | ||
assert "not found" == out | ||
|
||
"""Test rsa private key not generated.""" | ||
out = client.execute( | ||
"cat /etc/ssh/ssh_host_rsa_key > /dev/null || echo 'not found'" | ||
) | ||
assert "not found" == out | ||
|
||
"""Test ecdsa public key generated.""" | ||
out = client.read_from_file("/etc/ssh/ssh_host_ecdsa_key.pub") | ||
assert "" != out | ||
|
||
"""Test ecdsa private key generated.""" | ||
out = client.read_from_file("/etc/ssh/ssh_host_ecdsa_key") | ||
assert "" != out | ||
|
||
"""Test ed25519 public key generated.""" | ||
out = client.read_from_file("/etc/ssh/ssh_host_ed25519_key.pub") | ||
assert "" != out | ||
|
||
"""Test ed25519 private key generated.""" | ||
out = client.read_from_file("/etc/ssh/ssh_host_ed25519_key") | ||
assert "" != out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Integration test for the ssh_import_id module. | ||
This test specifies ssh keys to be imported by the ``ssh_import_id`` module | ||
and then checks that if the ssh keys were successfully imported. | ||
(This is ported from | ||
``tests/cloud_tests/testcases/modules/ssh_import_id.yaml``.)""" | ||
|
||
import pytest | ||
|
||
|
||
USER_DATA = """\ | ||
#cloud-config | ||
ssh_import_id: | ||
- gh:powersj | ||
- lp:smoser | ||
""" | ||
|
||
|
||
class TestSshImportId: | ||
|
||
@pytest.mark.user_data(USER_DATA) | ||
def test_ssh_import_id(self, client): | ||
ssh_output = client.read_from_file( | ||
"/home/ubuntu/.ssh/authorized_keys") | ||
|
||
assert '# ssh-import-id gh:powersj' in ssh_output | ||
assert '# ssh-import-id lp:smoser' in ssh_output |
130 changes: 130 additions & 0 deletions
130
tests/integration_tests/modules/test_ssh_keys_provided.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
"""Integration test for the ssh module. | ||
This test specifies keys to be provided to the system through the ``ssh`` | ||
module and then checks that if those keys were successfully added to the | ||
system. | ||
(This is ported from | ||
``tests/cloud_tests/testcases/modules/ssh_keys_provided.yaml''``.)""" | ||
|
||
import pytest | ||
|
||
|
||
USER_DATA = """\ | ||
#cloud-config | ||
disable_root: false | ||
ssh_authorized_keys: | ||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDXW9Gg5H7ehjdSc6qDzwNtgCy94XYHhEYlXZMO2+FJrH3wfHGiMfCwOHxcOMt2QiXItULthdeQWS9QjBSSjVRXf6731igFrqPFyS9qBlOQ5D29C4HBXFnQggGVpBNJ82IRJv7szbbe/vpgLBP4kttUza9Dr4e1YM1ln4PRnjfXea6T0m+m1ixNb5432pTXlqYOnNOxSIm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iLIVl03otGOqvSzs+ | ||
A3tFPEOxauXpzCt8f8eXsz0WQXAgIKW2h8zu5QHjomioU3i27mtE | ||
-----END RSA PRIVATE KEY----- | ||
rsa_public: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0/Ho+o3eJISydO2JvIgTLnZOtrxPl+fSvJfKDjoOLY0HB2eOjy2s2/2N6d9X9SGZ4+XnyVeNPjfBXw4IyXoqxhfIF16Azfk022iejgjiYssoUxH31M60OfqJhxo16dWEXdkKP1nac06VOt1zS5yEeooyvEuMJEJSsv3VR/7GKhMX3TVhEz5moLmVP3bIAvvoXio8X4urVC1R819QjDC86nlxwNks/GKPRi/IHO5tjJ72Eke7KNsm/vxHgkdX4vZaHNKhfdb/pavFXN5eoUaofz3hxw5oL/u2epI/pXyUhDp8Tb5wO6slykzcIlGCSd0YeO1TnljvViRx0uSxIy97N root@xenial-lxd | ||
dsa_private: | | ||
-----BEGIN DSA PRIVATE KEY----- | ||
MIIBuwIBAAKBgQD5Fstc23IVSDe6k4DNP8smPKuEWUvHDTOGaXrhOVAfzZ6+jklP | ||
55mzvC7jO53PWWC31hq10xBoWdev0WtcNF9Tv+4bAa1263y51Rqo4GI7xx+xic1d | ||
mLqqfYijBT9k48J/1tV0cs1Wjs6FP/IJTD/kYVC930JjYQMi722lBnUxsQIVAL7i | ||
z3fTGKTvSzvW0wQlwnYpS2QFAoGANp+KdyS9V93HgxGQEN1rlj/TSv/a3EVdCKtE | ||
nQf55aPHxDAVDVw5JtRh4pZbbRV4oGRPc9KOdjo5BU28vSM3Lmhkb+UaaDXwHkgI | ||
nK193o74DKjADWZxuLyyiKHiMOhxozoxDfjWxs8nz6uqvSW0pr521EwIY6RajbED | ||
nZ2a3GkCgYEAyoUomNRB6bmpsIfzt8zdtqLP5umIj2uhr9MVPL8/QdbxmJ72Z7pf | ||
Q2z1B7QAdIBGOlqJXtlau7ABhWK29Efe+99ObyTSSdDc6RCDeAwUmBAiPRQhDH2E | ||
wExw3doDSCU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kNVOEnb5AAAAD3Jvb3RAeGVuaWFsLWx4ZAECAwQFBg== | ||
-----END OPENSSH PRIVATE KEY----- | ||
ed25519_public: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINudAZSu4vjZpVWzId5pXmZg1M6G15dqjQ2XkNVOEnb5 root@xenial-lxd | ||
ecdsa_private: | | ||
-----BEGIN EC PRIVATE KEY----- | ||
MHcCAQEEIDuK+QFc1wmyJY8uDqQVa1qHte30Rk/fdLxGIBkwJAyOoAoGCCqGSM49 | ||
AwEHoUQDQgAEWxLlO+TL8gL91eET9p/HFQbqR1A691AkJgZk3jY5mpZqxgX4vcgb | ||
7f/CtXuM6s2svcDJqAeXr6Wk8OJJcMxylA== | ||
-----END EC PRIVATE KEY----- | ||
ecdsa_public: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFsS5Tvky/IC/dXhE/afxxUG6kdQOvdQJCYGZN42OZqWasYF+L3IG+3/wrV7jOrNrL3AyagHl6+lpPDiSXDMcpQ= root@xenial-lxd | ||
""" # noqa | ||
|
||
|
||
class TestSshKeysProvided: | ||
|
||
@pytest.mark.user_data(USER_DATA) | ||
def test_ssh_keys_provided(self, client): | ||
"""Test dsa public key was imported.""" | ||
out = client.read_from_file("/etc/ssh/ssh_host_dsa_key.pub") | ||
assert ( | ||
"AAAAB3NzaC1kc3MAAACBAPkWy1zbchVIN7qTgM0/yyY8q4R" | ||
"ZS8cNM4ZpeuE5UB/Nnr6OSU/nmbO8LuM") in out | ||
|
||
"""Test dsa private key was imported.""" | ||
out = client.read_from_file("/etc/ssh/ssh_host_dsa_key") | ||
assert ( | ||
"MIIBuwIBAAKBgQD5Fstc23IVSDe6k4DNP8smPKuEWUvHDTOGaXr" | ||
"hOVAfzZ6+jklP") in out | ||
|
||
"""Test rsa public key was imported.""" | ||
out = client.read_from_file("/etc/ssh/ssh_host_rsa_key.pub") | ||
assert ( | ||
"AAAAB3NzaC1yc2EAAAADAQABAAABAQC0/Ho+o3eJISydO2JvIgT" | ||
"LnZOtrxPl+fSvJfKDjoOLY0HB2eOjy2s2/2N6d9X9SGZ4") in out | ||
|
||
"""Test rsa private key was imported.""" | ||
out = client.read_from_file("/etc/ssh/ssh_host_rsa_key") | ||
assert ( | ||
"4DOkqNiUGl80Zp1RgZNohHUXlJMtAbrIlAVEk+mTmg7vjfyp2un" | ||
"RQvLZpMRdywBm") in out | ||
|
||
"""Test ecdsa public key was imported.""" | ||
out = client.read_from_file("/etc/ssh/ssh_host_ecdsa_key.pub") | ||
assert ( | ||
"AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAAB" | ||
"BBFsS5Tvky/IC/dXhE/afxxU") in out | ||
|
||
"""Test ecdsa private key generated.""" | ||
out = client.read_from_file("/etc/ssh/ssh_host_ecdsa_key") | ||
assert ( | ||
"AwEHoUQDQgAEWxLlO+TL8gL91eET9p/HFQbqR1A691AkJgZk3jY" | ||
"5mpZqxgX4vcgb") in out | ||
|
||
"""Test ed25519 public key was imported.""" | ||
out = client.read_from_file("/etc/ssh/ssh_host_ed25519_key.pub") | ||
assert ( | ||
"AAAAC3NzaC1lZDI1NTE5AAAAINudAZSu4vjZpVWzId5pXmZg1M6" | ||
"G15dqjQ2XkNVOEnb5") in out | ||
|
||
"""Test ed25519 private key was imported.""" | ||
out = client.read_from_file("/etc/ssh/ssh_host_ed25519_key") | ||
assert ( | ||
"XAAAAAtzc2gtZWQyNTUxOQAAACDbnQGUruL42aVVsyHeaV5mYNT" | ||
"OhteXao0Nl5DVThJ2+Q") in out |
Oops, something went wrong.