feat: add immutable partitioned data publication hub
This commit is contained in:
@@ -206,6 +206,59 @@ class UnitPhaseRunnerTests(unittest.TestCase):
|
||||
self.assertEqual(self.calls, [])
|
||||
self.assertFalse((self.root / "artifacts").exists())
|
||||
|
||||
def test_platform_exclusions_are_verified_and_recorded_before_execution(self):
|
||||
self.manifest["P00"][0]["platform_exclusions"] = {
|
||||
"non_windows": ["Example.OldTests.WindowsOnly"],
|
||||
"windows": ["Example.OldTests.UnixOnly"],
|
||||
}
|
||||
self.listing += " Example.OldTests.WindowsOnly\n Example.OldTests.UnixOnly\n"
|
||||
for platform, excluded in (("darwin", "Example.OldTests.WindowsOnly"),
|
||||
("win32", "Example.OldTests.UnixOnly")):
|
||||
with self.subTest(platform=platform):
|
||||
directory = self.run_gate(platform=platform)
|
||||
report = json.loads((directory / "run.json").read_text())["projects"][0]
|
||||
discovery = json.loads(next(directory.rglob("discovery.json")).read_text())
|
||||
self.assertEqual(report["platform"], platform)
|
||||
self.assertEqual(report["platform_exclusions"], [excluded])
|
||||
self.assertEqual(discovery["platform_exclusions"], [excluded])
|
||||
self.assertIn("FullyQualifiedName!=" + excluded, report["execution_filter"])
|
||||
self.assertNotIn("FullyQualifiedName!=", report["filter"])
|
||||
|
||||
def test_missing_platform_exclusion_fails_before_execution(self):
|
||||
self.manifest["P00"][0]["platform_exclusions"] = {"non_windows": ["Example.OldTests.Missing"]}
|
||||
with self.assertRaisesRegex(runner.GateError, "missing.*exclu"):
|
||||
self.run_gate(platform="darwin")
|
||||
self.assertFalse(any(a[0] == "dotnet" and "--list-tests" not in a for a, _ in self.calls))
|
||||
|
||||
def test_exclusions_cannot_mask_a_required_class(self):
|
||||
self.manifest["P00"][0]["platform_exclusions"] = {"non_windows": ["Example.OldTests.Works"]}
|
||||
with self.assertRaisesRegex(runner.GateError, "OldTests"):
|
||||
self.run_gate(platform="darwin")
|
||||
|
||||
def test_case_excludes_only_methods_in_selected_class(self):
|
||||
self.manifest["P00"][0]["platform_exclusions"] = {"non_windows": ["Example.OldTests.WindowsOnly"]}
|
||||
self.listing = "The following Tests are available:\n Example.NewTests.Works\n"
|
||||
self.run_gate(case="NewTests", platform="darwin")
|
||||
|
||||
def test_excluded_method_in_results_is_rejected(self):
|
||||
self.manifest["P00"][0]["platform_exclusions"] = {"non_windows": ["Example.OldTests.WindowsOnly"]}
|
||||
self.listing += " Example.OldTests.WindowsOnly\n"
|
||||
original = self.fake
|
||||
def unexpected(argv, **kwargs):
|
||||
result = original(argv, **kwargs)
|
||||
if argv[0] == "dotnet" and "--list-tests" not in argv:
|
||||
path = Path(argv[argv.index("--results-directory") + 1]) / "results.trx"
|
||||
path.write_text(path.read_text().replace('className="Example.OldTests" name="Works"',
|
||||
'className="Example.OldTests" name="WindowsOnly"'))
|
||||
return result
|
||||
with self.assertRaisesRegex(runner.GateError, "excluded.*result"):
|
||||
runner.run_phase(self.manifest, "P00", self.root, invoke=unexpected, platform="darwin")
|
||||
|
||||
def test_invalid_exclusion_is_rejected(self):
|
||||
self.manifest["P00"][0]["platform_exclusions"] = {"non_windows": ["Example.OldTests.Works|FullyQualifiedName~Other"]}
|
||||
with self.assertRaisesRegex(runner.GateError, "invalid.*exclu"):
|
||||
self.run_gate(platform="darwin")
|
||||
|
||||
def test_allowlist_removes_inherited_secrets_and_overrides_shared_sql(self):
|
||||
env = runner.unit_environment({"PATH": "/bin", "HOME": "/home/test",
|
||||
"OTOPCUA_CONFIG_TEST_SERVER": "shared-db", "OTOPCUA_CONFIG_CONNECTION": "secret",
|
||||
|
||||
Reference in New Issue
Block a user