File: test_ubuntu_autoinstall.py

package info (click to toggle)
cloud-init 25.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,412 kB
  • sloc: python: 135,894; sh: 3,883; makefile: 141; javascript: 30; xml: 22
file content (28 lines) | stat: -rw-r--r-- 830 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Integration tests for cc_ubuntu_autoinstall happy path"""

import pytest

from tests.integration_tests.releases import IS_UBUNTU

USER_DATA = """\
#cloud-config
autoinstall:
  version: 1
  cloudinitdoesnotvalidateotherkeyschema: true
snap:
  commands:
    - snap install subiquity --classic
"""


LOG_MSG = "Valid autoinstall schema. Config will be processed by subiquity"


@pytest.mark.skipif(not IS_UBUNTU, reason="Test is Ubuntu specific")
@pytest.mark.user_data(USER_DATA)
class TestUbuntuAutoinstall:
    def test_autoinstall_schema_valid_when_snap_present(self, class_client):
        """autoinstall directives will pass when snap is present"""
        assert "subiquity" in class_client.execute(["snap", "list"]).stdout
        log = class_client.read_from_file("/var/log/cloud-init.log")
        assert LOG_MSG in log