File: test_features.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 (38 lines) | stat: -rw-r--r-- 1,569 bytes parent folder | download
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
29
30
31
32
33
34
35
36
37
38
# This file is part of cloud-init. See LICENSE file for license information.
"""
This file is for testing the feature flag functionality itself,
NOT for testing any individual feature flag
"""
from unittest import mock

from cloudinit import features


class TestGetFeatures:
    def test_feature_without_override(self):
        # Since features are intended to be overridden downstream, mock them
        # all here so that downstream changes to features do not require
        # changes to this test.
        with mock.patch.multiple(
            "cloudinit.features",
            ERROR_ON_USER_DATA_FAILURE=True,
            ALLOW_EC2_MIRRORS_ON_NON_AWS_INSTANCE_TYPES=True,
            EXPIRE_APPLIES_TO_HASHED_USERS=False,
            NETPLAN_CONFIG_ROOT_READ_ONLY=True,
            DEPRECATION_INFO_BOUNDARY="devel",
            NOCLOUD_SEED_URL_APPEND_FORWARD_SLASH=False,
            APT_DEB822_SOURCE_LIST_FILE=True,
            MANUAL_NETWORK_WAIT=False,
            STRIP_INVALID_MTU=False,
        ):
            assert {
                "ERROR_ON_USER_DATA_FAILURE": True,
                "ALLOW_EC2_MIRRORS_ON_NON_AWS_INSTANCE_TYPES": True,
                "EXPIRE_APPLIES_TO_HASHED_USERS": False,
                "NETPLAN_CONFIG_ROOT_READ_ONLY": True,
                "NOCLOUD_SEED_URL_APPEND_FORWARD_SLASH": False,
                "APT_DEB822_SOURCE_LIST_FILE": True,
                "DEPRECATION_INFO_BOUNDARY": "devel",
                "MANUAL_NETWORK_WAIT": False,
                "STRIP_INVALID_MTU": False,
            } == features.get_features()