Beispiel #1
0
    def test_use_invalid_openjdk_version_fails(self, base, version, expected_message):
        class Options:
            gradle_options = []
            gradle_output_dir = "build/libs"
            gradle_version = gradle._DEFAULT_GRADLE_VERSION
            gradle_version_checksum = gradle._DEFAULT_GRADLE_CHECKSUM
            gradle_openjdk_version = version

        project = Project()
        project._snap_meta = Snap(name="test-snap", base=base, confinement="strict")

        with pytest.raises(gradle.UnsupportedJDKVersionError) as error:
            gradle.GradlePlugin("test-part", Options(), project)
            assert str(error) == expected_message
Beispiel #2
0
    def test_stage_and_build_packages(self):
        plugin = gradle.GradlePlugin("test-part", self.options, self.project)

        self.assertThat(
            plugin.stage_packages,
            Equals([
                "openjdk-{}-jre-headless".format(self.expected_java_version)
            ]),
        )
        self.assertThat(
            plugin.build_packages,
            Equals([
                "openjdk-{}-jdk-headless".format(self.expected_java_version),
                "ca-certificates-java",
            ]),
        )
Beispiel #3
0
def gradle_plugin(tmp_path, request):
    """Return an instance of GradlePlugin setup with different bases and java versions."""
    java_version, base = request.param

    class Options:
        gradle_options = []
        gradle_output_dir = "build/libs"
        gradle_version = gradle._DEFAULT_GRADLE_VERSION
        gradle_version_checksum = gradle._DEFAULT_GRADLE_CHECKSUM
        gradle_openjdk_version = java_version

    os.chdir(tmp_path)
    project = Project()
    project._snap_meta = Snap(name="test-snap", base=base, confinement="strict")

    return gradle.GradlePlugin("test-part", Options(), project)