Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tests/integration_tests/modules/test_apt.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
TEST_SIGNED_BY_KEY = "A2EB 2DEC 0BD7 519B 7B38 BE38 376A 290E C806 8B11"


@pytest.mark.ci
@pytest.mark.ubuntu
@pytest.mark.user_data(USER_DATA)
class TestApt:
Expand Down
68 changes: 68 additions & 0 deletions tests/integration_tests/modules/test_combined.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from tests.integration_tests.clouds import ImageSpecification
from tests.integration_tests.instances import IntegrationInstance
from tests.integration_tests.util import (
retry,
verify_clean_log,
verify_ordered_items_in_text,
)
Expand All @@ -33,6 +34,11 @@
locale_configfile: /etc/default/locale
ntp:
servers: ['ntp.ubuntu.com']
package_update: true
random_seed:
data: 'MYUb34023nD:LFDK10913jk;dfnk:Df'
encoding: raw
file: /root/seed
rsyslog:
configs:
- "*.* @@127.0.0.1"
Expand All @@ -48,6 +54,14 @@
runcmd:
- echo 'hello world' > /var/tmp/runcmd_output
- logger "My test log"
snap:
squashfuse_in_container: true
commands:
- snap install hello-world
ssh_import_id:
- gh:powersj
- lp:smoser
timezone: US/Aleutian
"""


Expand Down Expand Up @@ -115,6 +129,20 @@ def test_configured_locale(self, class_client: IntegrationInstance):
'en_US.UTF-8'
], locale_gen)

def test_random_seed_data(self, class_client: IntegrationInstance):
"""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.
"""
client = class_client

# Only read the first 31 characters, because the rest could be
# binary data
result = client.execute("head -c 31 < /root/seed")
assert result.startswith("MYUb34023nD:LFDK10913jk;dfnk:Df")

def test_rsyslog(self, class_client: IntegrationInstance):
"""Test rsyslog is configured correctly."""
client = class_client
Expand All @@ -125,6 +153,46 @@ def test_runcmd(self, class_client: IntegrationInstance):
client = class_client
assert 'hello world' == client.read_from_file('/var/tmp/runcmd_output')

@retry(tries=30, delay=1)
def test_ssh_import_id(self, class_client: IntegrationInstance):
"""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.

TODO:
* This test assumes that SSH keys will be imported into the
/home/ubuntu; this will need modification to run on other OSes.
"""
client = class_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

def test_snap(self, class_client: IntegrationInstance):
"""Integration test for the snap module.

This test specifies a command to be executed by the ``snap`` module
and then checks that if that command was executed during boot.
"""
client = class_client
snap_output = client.execute("snap list")
assert "core " in snap_output
assert "hello-world " in snap_output

def test_timezone(self, class_client: IntegrationInstance):
"""Integration test for the timezone module.

This test specifies a timezone to be used by the ``timezone`` module
and then checks that if that timezone was respected during boot.
"""
client = class_client
timezone_output = client.execute(
'date "+%Z" --date="Thu, 03 Nov 2016 00:47:00 -0400"')
assert timezone_output.strip() == "HDT"

def test_no_problems(self, class_client: IntegrationInstance):
"""Test no errors, warnings, or tracebacks"""
client = class_client
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/modules/test_command_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"""


@pytest.mark.ci
@pytest.mark.user_data(USER_DATA)
def test_runcmd(client: IntegrationInstance):
log = client.read_from_file('/var/log/cloud-init-test-output')
Expand Down
3 changes: 0 additions & 3 deletions tests/integration_tests/modules/test_ntp_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
EXPECTED_POOLS = yaml.safe_load(USER_DATA)["ntp"]["pools"]


@pytest.mark.ci
@pytest.mark.user_data(USER_DATA)
class TestNtpServers:

Expand Down Expand Up @@ -83,7 +82,6 @@ def test_ntpq_servers(self, class_client: IntegrationInstance):
"""


@pytest.mark.ci
@pytest.mark.user_data(CHRONY_DATA)
def test_chrony(client: IntegrationInstance):
if client.execute('test -f /etc/chrony.conf').ok:
Expand All @@ -104,7 +102,6 @@ def test_chrony(client: IntegrationInstance):
"""


@pytest.mark.ci
@pytest.mark.user_data(TIMESYNCD_DATA)
def test_timesyncd(client: IntegrationInstance):
contents = client.read_from_file(
Expand Down
30 changes: 0 additions & 30 deletions tests/integration_tests/modules/test_seed_random_data.py

This file was deleted.

30 changes: 0 additions & 30 deletions tests/integration_tests/modules/test_snap.py

This file was deleted.

40 changes: 0 additions & 40 deletions tests/integration_tests/modules/test_ssh_import_id.py

This file was deleted.

25 changes: 0 additions & 25 deletions tests/integration_tests/modules/test_timezone.py

This file was deleted.