Beispiel #1
0
    def test_static_distro(self, sample_static_distro):
        distro = Distro(sample_static_distro, None)

        assert len(distro.settings.hosts) == len(
            sample_static_distro["settings"]["hosts"])
        for host in sample_static_distro["settings"]["hosts"]:
            assert host["name"] in distro.settings.hosts
Beispiel #2
0
    def test_get_attributes(self, sample_aws_distro):
        distro = Distro(sample_aws_distro, None)

        assert distro.name == sample_aws_distro['name']
        assert distro.provider == sample_aws_distro['provider']
        assert distro.planner_settings.version == sample_aws_distro['planner_settings']['version']
        assert distro.finder_settings.version == sample_aws_distro['finder_settings']['version']
Beispiel #3
0
    def test_settings(self, sample_aws_distro):
        distro = Distro(sample_aws_distro, None)
        settings = distro.settings
        setting_json = sample_aws_distro['settings']

        assert settings.ami == setting_json['ami']

        mount_point = settings.mount_points[0]
        assert mount_point.device_name == setting_json['mount_points'][0]['device_name']
Beispiel #4
0
    def all_distros(self):
        """
        Get all distros in evergreen.

        :return: List of all distros in evergreen.
        """
        url = self._create_url('/distros')
        distro_list = self._paginate(url)
        return [Distro(distro, self) for distro in distro_list]
Beispiel #5
0
    def test_get_attributes(self, sample_aws_distro):
        distro = Distro(sample_aws_distro, None)

        assert distro.name == sample_aws_distro["name"]
        assert distro.provider == sample_aws_distro["provider"]
        assert distro.planner_settings.version == sample_aws_distro[
            "planner_settings"]["version"]
        assert distro.finder_settings.version == sample_aws_distro[
            "finder_settings"]["version"]
Beispiel #6
0
    def all_distros(self) -> List[Distro]:
        """
        Get all distros in evergreen.

        :return: List of all distros in evergreen.
        """
        url = self._create_url("/distros")
        distro_list = self._paginate(url)
        return [Distro(distro, self) for distro in distro_list]  # type: ignore[arg-type]
Beispiel #7
0
    def test_settings(self, sample_aws_distro):
        distro = Distro(sample_aws_distro, None)
        settings = distro.settings
        setting_json = sample_aws_distro["settings"]

        assert settings.ami == setting_json["ami"]

        mount_point = settings.mount_points[0]
        assert mount_point.device_name == setting_json["mount_points"][0][
            "device_name"]
Beispiel #8
0
    def test_unknown_provider_distro(self, sample_aws_distro):
        sample_aws_distro['provider'] = 'some_unknown_provider'
        distro = Distro(sample_aws_distro, None)

        assert distro.settings == sample_aws_distro['settings']
Beispiel #9
0
    def test_static_distro_missing_hosts(self, sample_static_distro):
        del sample_static_distro['settings']['hosts']
        distro = Distro(sample_static_distro, None)

        assert not distro.settings.hosts
Beispiel #10
0
    def test_static_distro(self, sample_static_distro):
        distro = Distro(sample_static_distro, None)

        assert len(distro.settings.hosts) == len(sample_static_distro['settings']['hosts'])
        for host in sample_static_distro['settings']['hosts']:
            assert host['name'] in distro.settings.hosts
Beispiel #11
0
    def test_missing_mount_points(self, sample_aws_distro):
        del sample_aws_distro['settings']['mount_points']
        distro = Distro(sample_aws_distro, None)

        assert not distro.settings.mount_points
Beispiel #12
0
    def test_missing_attributes(self, sample_aws_distro):
        del sample_aws_distro['settings']
        distro = Distro(sample_aws_distro, None)

        assert not distro.settings
Beispiel #13
0
    def test_expansions(self, sample_aws_distro):
        distro = Distro(sample_aws_distro, None)

        for expansion in sample_aws_distro['expansions']:
            assert distro.expansions[expansion['key']] == expansion['value']
Beispiel #14
0
    def test_unknown_provider_distro(self, sample_aws_distro):
        sample_aws_distro["provider"] = "some_unknown_provider"
        distro = Distro(sample_aws_distro, None)

        assert distro.settings == sample_aws_distro["settings"]
Beispiel #15
0
    def test_expansions(self, sample_aws_distro):
        distro = Distro(sample_aws_distro, None)

        for expansion in sample_aws_distro["expansions"]:
            assert distro.expansions[expansion["key"]] == expansion["value"]