summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lint_tests/test_lint_debputy.py75
-rw-r--r--tests/test_fs_metadata.py1
-rw-r--r--tests/test_install_rules.py2
-rw-r--r--tests/test_interpreter.py1
-rw-r--r--tests/test_migrations.py13
-rw-r--r--tests/test_parser.py1
6 files changed, 88 insertions, 5 deletions
diff --git a/tests/lint_tests/test_lint_debputy.py b/tests/lint_tests/test_lint_debputy.py
index 2af34ae..7464cdf 100644
--- a/tests/lint_tests/test_lint_debputy.py
+++ b/tests/lint_tests/test_lint_debputy.py
@@ -183,3 +183,78 @@ def test_debputy_lint_check_package_names(line_linter: LintWrapper) -> None:
msg = 'Unknown package "unknown-package".'
assert diag.message == msg
assert f"{diag.range}" == "2:4-2:19"
+
+
+def test_debputy_lint_integration_mode(line_linter: LintWrapper) -> None:
+ lines = textwrap.dedent(
+ """\
+ manifest-version: 0.1
+ installations: []
+ packages:
+ foo:
+ services:
+ - service: foo
+ """
+ ).splitlines(keepends=True)
+ line_linter.dctrl_lines = textwrap.dedent(
+ """\
+ Source: foo
+ Build-Depends: dh-sequence-zz-debputy-rrr,
+
+ Package: foo
+ """
+ ).splitlines(keepends=True)
+
+ diagnostics = line_linter(lines)
+ assert diagnostics and len(diagnostics) == 2
+ first_issue, second_issue = diagnostics
+
+ msg = 'Feature "installations" not supported in integration mode dh-sequence-zz-debputy-rrr'
+ assert first_issue.message == msg
+ assert f"{first_issue.range}" == "1:0-1:13"
+ assert first_issue.severity == DiagnosticSeverity.Error
+
+ msg = 'Feature "services" not supported in integration mode dh-sequence-zz-debputy-rrr'
+ assert second_issue.message == msg
+ assert f"{second_issue.range}" == "4:8-4:16"
+ assert second_issue.severity == DiagnosticSeverity.Error
+
+ # Changing the integration mode should fix both
+ line_linter.dctrl_lines = textwrap.dedent(
+ """\
+ Source: foo
+ Build-Depends: dh-sequence-zz-debputy,
+
+ Package: foo
+ """
+ ).splitlines(keepends=True)
+ diagnostics = line_linter(lines)
+ assert not diagnostics
+
+
+def test_debputy_lint_attr_value_checks(line_linter: LintWrapper) -> None:
+ lines = textwrap.dedent(
+ """\
+ manifest-version: 0.1
+ packages:
+ foo:
+ services:
+ - service: foo
+ enable-on-install: "true"
+ on-upgrade: "bar"
+ """
+ ).splitlines(keepends=True)
+
+ diagnostics = line_linter(lines)
+ assert diagnostics and len(diagnostics) == 2
+ first_issue, second_issue = diagnostics
+
+ msg = 'Not a supported value for "enable-on-install"'
+ assert first_issue.message == msg
+ assert f"{first_issue.range}" == "5:29-5:35"
+ assert first_issue.severity == DiagnosticSeverity.Error
+
+ msg = 'Not a supported value for "on-upgrade"'
+ assert second_issue.message == msg
+ assert f"{second_issue.range}" == "6:22-6:27"
+ assert second_issue.severity == DiagnosticSeverity.Error
diff --git a/tests/test_fs_metadata.py b/tests/test_fs_metadata.py
index f32afb0..7dd3d55 100644
--- a/tests/test_fs_metadata.py
+++ b/tests/test_fs_metadata.py
@@ -35,6 +35,7 @@ def manifest_parser_pkg_foo(
dpkg_arch_query,
no_profiles_or_build_options,
debputy_plugin_feature_set,
+ "full",
debian_dir=debian_dir,
)
diff --git a/tests/test_install_rules.py b/tests/test_install_rules.py
index c8ffb84..a361864 100644
--- a/tests/test_install_rules.py
+++ b/tests/test_install_rules.py
@@ -33,6 +33,7 @@ def manifest_parser_pkg_foo(
dpkg_arch_query,
no_profiles_or_build_options,
debputy_plugin_feature_set,
+ "full",
debian_dir=debian_dir,
)
@@ -58,6 +59,7 @@ def manifest_parser_pkg_foo_w_udeb(
dpkg_arch_query,
no_profiles_or_build_options,
debputy_plugin_feature_set,
+ "full",
debian_dir=debian_dir,
)
diff --git a/tests/test_interpreter.py b/tests/test_interpreter.py
index 154ee4a..be8ec8a 100644
--- a/tests/test_interpreter.py
+++ b/tests/test_interpreter.py
@@ -127,6 +127,7 @@ def empty_manifest(
dpkg_arch_query,
no_profiles_or_build_options,
debputy_plugin_feature_set,
+ "full",
debian_dir=debian_dir,
).build_manifest()
diff --git a/tests/test_migrations.py b/tests/test_migrations.py
index 9d43549..f53c716 100644
--- a/tests/test_migrations.py
+++ b/tests/test_migrations.py
@@ -1,6 +1,6 @@
import io
import textwrap
-from typing import Iterable, Callable, Optional, List, Tuple, Sequence
+from typing import Callable, Optional, List, Tuple, Sequence
import pytest
@@ -22,8 +22,6 @@ from debputy.dh_migration.migrators_impl import (
migrate_installinfo_file,
migrate_dh_installsystemd_files,
detect_obsolete_substvars,
- MIGRATION_TARGET_DH_DEBPUTY,
- MIGRATION_TARGET_DH_DEBPUTY_RRR,
detect_dh_addons_zz_debputy_rrr,
)
from debputy.dh_migration.models import (
@@ -34,6 +32,10 @@ from debputy.dh_migration.models import (
from debputy.highlevel_manifest import HighLevelManifest
from debputy.highlevel_manifest_parser import YAMLManifestParser
from debputy.plugin.api import virtual_path_def, VirtualPath
+from debputy.plugin.api.spec import (
+ INTEGRATION_MODE_DH_DEBPUTY_RRR,
+ INTEGRATION_MODE_DH_DEBPUTY,
+)
from debputy.plugin.api.test_api import (
build_virtual_file_system,
)
@@ -65,6 +67,7 @@ def manifest_parser_pkg_foo_factory(
dpkg_arch_query,
no_profiles_or_build_options,
debputy_plugin_feature_set,
+ "full",
debian_dir=debian_dir,
)
@@ -94,7 +97,7 @@ def run_migrator(
manifest: HighLevelManifest,
acceptable_migration_issues: AcceptableMigrationIssues,
*,
- migration_target=MIGRATION_TARGET_DH_DEBPUTY,
+ migration_target=INTEGRATION_MODE_DH_DEBPUTY,
) -> FeatureMigration:
feature_migration = FeatureMigration(migrator.__name__)
migrator(
@@ -1661,7 +1664,7 @@ def test_detect_dh_addons_rrr(
empty_fs,
empty_manifest_pkg_foo,
accept_no_migration_issues,
- migration_target=MIGRATION_TARGET_DH_DEBPUTY_RRR,
+ migration_target=INTEGRATION_MODE_DH_DEBPUTY_RRR,
)
assert migration.anything_to_do
assert migration.warnings == [no_ctrl_msg]
diff --git a/tests/test_parser.py b/tests/test_parser.py
index 4792842..4aee024 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -34,6 +34,7 @@ def manifest_parser_pkg_foo(
dpkg_arch_query,
no_profiles_or_build_options,
debputy_plugin_feature_set,
+ "full",
debian_dir=debian_dir,
)