You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2026/10/19 20:25:17 UTC
(juneau) branch master updated: Close the connection when a request boundary rejects a request, so pooled clients don't reuse a connection the server is closing; drop the unused PGP passphrase row from push.py; make the QueryableSettings regex test independent of the wall-clock regex budget; update the perf baseline for the console-ui-freemarker test split; and have coverage.py run a module's sibling tests module.
This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 9ed6100ca4 Close the connection when a request boundary rejects a request, so pooled clients don't reuse a connection the server is closing; drop the unused PGP passphrase row from push.py; make the QueryableSettings regex test independent of the wall-clock regex budget; update the perf baseline for the console-ui-freemarker test split; and have coverage.py run a module's sibling tests module.
9ed6100ca4 is described below
commit 9ed6100ca4dbd950b02921012663c294693498fd
Author: James Bognar <ja...@apache.org>
AuthorDate: Mon Oct 19 16:25:10 2026 -0400
Close the connection when a request boundary rejects a request, so pooled clients don't reuse a connection the server is closing; drop the unused PGP passphrase row from push.py; make the QueryableSettings regex test independent of the wall-clock regex budget; update the perf baseline for the console-ui-freemarker test split; and have coverage.py run a module's sibling tests module.
---
.../juneau/petstore/jetty/PetstoreJetty_Test.java | 1 +
.../rest/server/filter/RequestBoundaryFilter.java | 6 +++
.../server/converter/QueryableSettings_Test.java | 6 ++-
.../server/filter/CsrfBoundaryFilter_Test.java | 1 +
perf-baseline.txt | 3 +-
scripts/coverage.py | 17 +++++--
scripts/push.py | 38 +--------------
scripts/tests/README.md | 2 +-
scripts/tests/test_coverage_modules.py | 57 ++++++++++++++++++++++
scripts/tests/test_push.py | 18 +++----
scripts/tests/test_run_adoption.py | 40 ++++++---------
11 files changed, 108 insertions(+), 81 deletions(-)
diff --git a/juneau-petstore/juneau-petstore-jetty/src/test/java/org/apache/juneau/petstore/jetty/PetstoreJetty_Test.java b/juneau-petstore/juneau-petstore-jetty/src/test/java/org/apache/juneau/petstore/jetty/PetstoreJetty_Test.java
index 8e0cfef3d7..a1876aad59 100644
--- a/juneau-petstore/juneau-petstore-jetty/src/test/java/org/apache/juneau/petstore/jetty/PetstoreJetty_Test.java
+++ b/juneau-petstore/juneau-petstore-jetty/src/test/java/org/apache/juneau/petstore/jetty/PetstoreJetty_Test.java
@@ -426,6 +426,7 @@ class PetstoreJetty_Test extends TestBase {
var resp = send("POST", "/petstore/pets", "application/json", self(), null, PET_JSON);
assertEquals(403, resp.statusCode(), "body: " + resp.body());
assertEquals("CSRF_TOKEN_MISSING", boundaryReason(resp));
+ assertEquals("close", resp.headers().firstValue("Connection").orElse(null), "a refusal leaves its body unread, so the pooled connection must not be reused");
}
// Shared-instance evidence, not presence evidence: the token the console boundary published is the one the API filter
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/server/filter/RequestBoundaryFilter.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/server/filter/RequestBoundaryFilter.java
index 1b11fda16e..a4ce95d425 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/server/filter/RequestBoundaryFilter.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/server/filter/RequestBoundaryFilter.java
@@ -302,6 +302,11 @@ public class RequestBoundaryFilter implements Filter {
* has been fixed.
*
* <p>
+ * The request body is never read, so the connection is marked {@code Connection: close}. Without it, a client that has
+ * not yet finished sending the body reuses the connection while the container is closing it, and the next request
+ * on it fails with an empty response.
+ *
+ * <p>
* The stream is written to but deliberately not closed: it belongs to the container, which commits and
* releases it once the filter returns. Closing it here would commit the response early and cut off any
* outer filter that wraps it.
@@ -314,6 +319,7 @@ public class RequestBoundaryFilter implements Filter {
res.setStatus(result.status());
res.setHeader(REJECTION_HEADER, result.reason().name());
res.setHeader("Cache-Control", "no-store");
+ res.setHeader("Connection", "close");
res.setContentType("application/json;charset=utf-8");
var body = "{\"reason\":\"" + result.reason().name() + "\",\"message\":\"" + escape(result.message()) + "\"}";
var bytes = body.getBytes(StandardCharsets.UTF_8);
diff --git a/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/server/converter/QueryableSettings_Test.java b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/server/converter/QueryableSettings_Test.java
index a5d8f3322e..4a783cdb7c 100644
--- a/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/server/converter/QueryableSettings_Test.java
+++ b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/server/converter/QueryableSettings_Test.java
@@ -111,8 +111,10 @@ class QueryableSettings_Test {
assertSize(100, s.find(new BeanQuery()).rows());
assertSize(1000, s.find(new BeanQuery().setLimit(5000)).rows());
}
- // Regex on a small set: the default regexTimeout is a wall-clock budget for the whole call, so 1200 rows can trip it under build load.
- try (var s = ctx(QueryableSettings.DEFAULT).getSession(people(101))) {
+ // Regex is allowed by default. The default regexTimeout is a 50ms wall-clock budget for the whole call, which build load
+ // can exceed, so widen it after DEFAULT is applied; DEFAULT itself sets no timeout.
+ var regexCtx = QueryableSettings.DEFAULT.applyTo(InMemoryBeanQueryContext.create(Person.class)).regexTimeout(Duration.ofSeconds(30)).build();
+ try (var s = regexCtx.getSession(people(101))) {
assertSize(100, s.find(new BeanQuery().setSearch("name=$regex(p.*)")).rows());
}
}
diff --git a/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/server/filter/CsrfBoundaryFilter_Test.java b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/server/filter/CsrfBoundaryFilter_Test.java
index c49fe48fe5..cc12202165 100644
--- a/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/server/filter/CsrfBoundaryFilter_Test.java
+++ b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/server/filter/CsrfBoundaryFilter_Test.java
@@ -321,6 +321,7 @@ class CsrfBoundaryFilter_Test extends TestBase {
verify(c.res()).setStatus(x.status());
assertEquals(List.of(reason.name()), c.header(RequestBoundaryFilter.REJECTION_HEADER));
assertEquals(List.of("no-store"), c.header("Cache-Control"));
+ assertEquals(List.of("close"), c.header("Connection"), "an unread request body must not leave the connection reusable");
for (var h : List.of("Expires", "ETag", "Last-Modified", "Set-Cookie"))
assertEquals(List.of(), c.header(h), h);
verify(req, never()).getSession(true);
diff --git a/perf-baseline.txt b/perf-baseline.txt
index 32af8d51a4..dd9a610c65 100644
--- a/perf-baseline.txt
+++ b/perf-baseline.txt
@@ -109,7 +109,8 @@ juneau-rest/juneau-rest-server-auth-saml = 27
juneau-rest/juneau-rest-server-bus = 12.6
juneau-rest/juneau-rest-server-bus-websocket = 6.1
juneau-rest/juneau-rest-server-console-ui = 10
-juneau-rest/juneau-rest-server-console-ui-freemarker = 35.2
+juneau-rest/juneau-rest-server-console-ui-freemarker = 0.6
+juneau-rest/juneau-rest-server-console-ui-freemarker-tests = 32.7
juneau-rest/juneau-rest-server-datatables = 10
juneau-rest/juneau-rest-server-management-logging = 2.8
juneau-rest/juneau-rest-server-mcp = 14.4
diff --git a/scripts/coverage.py b/scripts/coverage.py
index e49c68ae9b..83b367db11 100755
--- a/scripts/coverage.py
+++ b/scripts/coverage.py
@@ -120,6 +120,15 @@ def find_maven_module(path: Path) -> Path:
return None
+def modules_to_test(module: Path) -> list[Path]:
+ """
+ The modules whose tests exercise `module`: the module itself, plus its sibling `<name>-tests` module when one
+ exists (a module whose tests moved out to a dedicated module has none of its own).
+ """
+ tests = module.parent / f"{module.name}-tests"
+ return [module, tests] if (tests / "pom.xml").exists() else [module]
+
+
def path_to_jacoco_package(path: Path) -> tuple[str | None, str | None]:
"""
Given a source path, return (jacoco_package, filename).
@@ -311,17 +320,17 @@ def jacoco_cli_jar() -> Path:
def run_tests(module: Path):
- """Re-run a single module's tests to refresh its .exec file.
+ """Re-run a module's tests (and those of its sibling `-tests` module, if any) to refresh the .exec files.
Scoped to the owning module so single-file/class queries stay fast. Other
modules' existing execs are still merged in when the report is generated.
Requires upstream module artifacts to be available in the local repo (from a
prior full build, e.g. `mvn install -DskipTests`).
"""
- rel = module.relative_to(REPO_ROOT)
- print(f"Running tests for module {rel} to refresh coverage data...")
+ rels = ",".join(str(m.relative_to(REPO_ROOT)) for m in modules_to_test(module))
+ print(f"Running tests for module {rels} to refresh coverage data...")
result = subprocess.run(
- ["mvn", "-pl", str(rel), "test", "-Drat.skip=true", "-q"],
+ ["mvn", "-pl", rels, "test", "-Drat.skip=true", "-q"],
cwd=REPO_ROOT,
capture_output=True,
text=True
diff --git a/scripts/push.py b/scripts/push.py
index cf9715052f..a05d1aa9ab 100755
--- a/scripts/push.py
+++ b/scripts/push.py
@@ -108,35 +108,6 @@ def run_gate(cmd, cwd, step_id, title, label):
label=label).exit
-PGP_PROMPT = "prompt-pgp-passphrase.py"
-
-
-def prompt_pgp_passphrase(script_dir):
- """Run the dummy-sign prompt on the bare terminal: True or False for how it went, None if the script is absent."""
- prompt_script = script_dir / PGP_PROMPT
- if not prompt_script.exists():
- return None
- try:
- # check=False: a failed prompt never stops the push; signing just prompts again later.
- return subprocess.run([sys.executable, str(prompt_script)], check=False).returncode == 0
- except Exception as e:
- print(f"โ Could not run PGP passphrase prompt: {e}")
- return False
-
-
-def pgp_row(script_dir):
- """
- The PGP row: the dummy-sign prompt, with the console paused so the prompt has the bare terminal. A prompt that
- fails warns on the row and the push goes on (signing just prompts again later).
- """
- run = toolkit("run")
- with run.step("pgp", "PGP passphrase", label="PGP") as step:
- with run.paused():
- ok = prompt_pgp_passphrase(script_dir)
- if ok is False:
- step.warn("passphrase not cached; signing will prompt again")
-
-
def aborted(text, *hint):
"""
Stop the push after a failed row: text and the hint lines as error lines, or under a console view (where the
@@ -1113,7 +1084,7 @@ def main():
#: Each step's row label, for the labelled plan (a pending row until the step starts). build, tests and js-tests
#: are test.py's rows; the others are this script's.
PLAN_LABELS = {
- "prechecks": "Prechecks", "pgp": "PGP", "sonar": "Sonar", "tracker": "Tracker", "container-tags": "Tags",
+ "prechecks": "Prechecks", "sonar": "Sonar", "tracker": "Tracker", "container-tags": "Tags",
"bom": "BOM", "build": "Compile", "tests": "Tests", "py-tests": "Script tests", "js-tests": "Browser tests", "timing": "Timing",
"install": "Install", "starters": "Starters", "commit": "Commit", "push": "Push", "docs-smoke": "Docs build",
"docs-commit": "Docs", "docs-push": "Docs push",
@@ -1124,8 +1095,6 @@ def push_plan(args, script_dir, juneau_root, console):
"""The top-level steps this run will take, in order, as (id, label) pairs, for the console's pending rows and
Overall figure."""
ids = [] if args.test_only else ["prechecks"]
- if (script_dir / PGP_PROMPT).exists():
- ids.append("pgp")
if args.sonarqube:
ids.append("sonar")
if args.tracker_audit:
@@ -1337,8 +1306,6 @@ def _main(): # NOSONAR python:S3776 -- Cognitive complexity is acceptable for t
"(unstaged/untracked) changes and the branch isn't behind upstream (git fetch + compare) -- juneau, and "
"juneau-docs when present -- before any gate runs; the last two are checked again before the commit")
step_num += 1
- print(f" {step_num}. Prompt for PGP passphrase (dummy call)")
- step_num += 1
if args.sonarqube:
_branch = current_branch(juneau_root)
_branch_arg = f" --branch {_branch}" if _branch not in ("master", "unknown") else ""
@@ -1389,9 +1356,6 @@ def _push_steps(s, args, run, console, script_dir, juneau_root): # NOSONAR pyth
listed = prechecks(juneau_root)
docs_prechecked = any(c.name == "docs identity" for c in listed)
s.checks("prechecks", "Prechecks", listed)
- # The PGP prompt gets the bare terminal (the console pauses for it), before the long gates.
- if (script_dir / PGP_PROMPT).exists():
- pgp_row(script_dir)
if console and args.skip_tests:
say("โ Tests will be SKIPPED (--skip-tests)", "warn")
diff --git a/scripts/tests/README.md b/scripts/tests/README.md
index bf891c278e..5b8aaf2bca 100644
--- a/scripts/tests/README.md
+++ b/scripts/tests/README.md
@@ -71,7 +71,7 @@ Do **not** `pip install --user pytest` / `pip install pytest` on a Homebrew-mana
`sys.modules` (where release.py and the toolkit both look it up): every prompt goes through `prompt.text` (Ctrl-D
cancels, never takes the default), Maven gets `-B` and a PTY, the full log is always written, the steps are a
`steps.Registry` (its CLI, resume and checkpoint, with a legacy `last_step` file still resuming), each step is a
- labelled row (dim when skipped or done earlier), the PGP prompt is a `passthrough`, `run_git_diff` follows
+ labelled row (dim when skipped or done earlier), `run_git_diff` follows
`run_release_prepare` and pages through `show`, and the revert is four rows. `HOME` is a temp dir, so the state
file and logs never touch yours. Never runs mvn, svn or gpg.
diff --git a/scripts/tests/test_coverage_modules.py b/scripts/tests/test_coverage_modules.py
new file mode 100644
index 0000000000..6c0ea9ac11
--- /dev/null
+++ b/scripts/tests/test_coverage_modules.py
@@ -0,0 +1,57 @@
+# ***************************************************************************************************************************
+# * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
+# * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+# * with the License. You may obtain a copy of the License at
+# *
+# * http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+# * specific language governing permissions and limitations under the License.
+# ***************************************************************************************************************************
+"""coverage.py --run: a module whose tests live in a sibling `<name>-tests` module runs both modules."""
+
+import importlib.util
+from pathlib import Path
+from types import SimpleNamespace
+
+COVERAGE_PATH = Path(__file__).resolve().parent.parent / "coverage.py"
+
+
+def load_coverage(root):
+ spec = importlib.util.spec_from_file_location("coverage_under_test", COVERAGE_PATH)
+ mod = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(mod)
+ mod.REPO_ROOT = root
+ return mod
+
+
+def make_module(root, rel):
+ d = root / rel
+ d.mkdir(parents=True)
+ (d / "pom.xml").write_text("<project/>", encoding="utf-8")
+ return d
+
+
+def test_a_module_with_a_sibling_tests_module_runs_both(tmp_path):
+ cov = load_coverage(tmp_path)
+ src = make_module(tmp_path, "juneau-rest/juneau-rest-server-console-ui-freemarker")
+ tests = make_module(tmp_path, "juneau-rest/juneau-rest-server-console-ui-freemarker-tests")
+ assert cov.modules_to_test(src) == [src, tests]
+
+
+def test_a_module_without_a_tests_sibling_runs_alone(tmp_path):
+ cov = load_coverage(tmp_path)
+ src = make_module(tmp_path, "juneau-rest/juneau-rest-server-view-freemarker")
+ assert cov.modules_to_test(src) == [src]
+
+
+def test_run_tests_passes_both_modules_to_maven(tmp_path, monkeypatch):
+ cov = load_coverage(tmp_path)
+ src = make_module(tmp_path, "juneau-rest/a")
+ make_module(tmp_path, "juneau-rest/a-tests")
+ seen = []
+ monkeypatch.setattr(cov.subprocess, "run", lambda cmd, **kw: seen.append(cmd) or SimpleNamespace(returncode=0))
+ cov.run_tests(src)
+ assert seen[0][seen[0].index("-pl") + 1] == "juneau-rest/a,juneau-rest/a-tests"
diff --git a/scripts/tests/test_push.py b/scripts/tests/test_push.py
index 8599ae62ca..7d01401b84 100644
--- a/scripts/tests/test_push.py
+++ b/scripts/tests/test_push.py
@@ -998,7 +998,6 @@ def _stub_push_flow(push_module, monkeypatch, *, tests_pass, test_py=True):
calls = []
for name in ("run_timing_report", "verify_starter_repos"):
monkeypatch.setattr(push_module, name, lambda *a, **k: True)
- monkeypatch.setattr(push_module, "prompt_pgp_passphrase", lambda *a, **k: None)
monkeypatch.setattr(push_module, "run_command",
lambda cmd, *a, **k: tests_pass if cmd == ["mvn", "test"] else True)
monkeypatch.setattr(push_module, "_append_test_run_history", lambda *a: calls.append(a))
@@ -1252,15 +1251,14 @@ def test_the_gates_go_through_the_toolkit_gate(push_module, monkeypatch):
# Prechecks: unreviewed changes and a behind-upstream branch refuse before any gate runs.
# ---------------------------------------------------------------------------------------
class _PastPrechecks(Exception):
- """Raised by the stubbed PGP row: the push got past its Prechecks to the first gate."""
+ """Raised by the stubbed first gate: the push got past its Prechecks to the first gate."""
@pytest.fixture
def flow(push_module, repo, monkeypatch):
"""_main() pointed at `repo` (scripts/ beside it) with a stand-in session: the real Prechecks run, and the push
- stops at the PGP row. `gates` records "pgp" and "session" when the push got that far."""
+ stops at the first gate. `gates` records "gate" and "session" when the push got that far."""
(repo / "scripts").mkdir()
- (repo / "scripts" / push_module.PGP_PROMPT).write_text("", encoding="utf-8")
monkeypatch.setattr(push_module, "__file__", str(repo / "scripts" / "push.py"))
_run(repo, "git", "config", "user.email", push_module.REQUIRED_GIT_EMAIL)
gates = []
@@ -1282,11 +1280,11 @@ def flow(push_module, repo, monkeypatch):
gates.append("session")
return 0
- def pgp(script_dir):
- gates.append("pgp")
+ def first_gate(*a, **k):
+ gates.append("gate")
raise _PastPrechecks()
- monkeypatch.setattr(push_module, "pgp_row", pgp)
+ monkeypatch.setattr(push_module, "maybe_run_tracker_audit_gate", first_gate)
monkeypatch.setattr(push_module, "_in_session", in_session)
monkeypatch.setattr(push_module, "resolve_commit_message", lambda m: m)
monkeypatch.setattr(push_module, "current_branch", lambda root: "master")
@@ -1311,13 +1309,13 @@ def _push_from_elsewhere(tmp_path: Path, remote_repo: Path) -> None:
class TestPrechecks:
def test_up_to_date_and_clean_proceeds_to_the_gates(self, flow):
assert flow("message") == 0
- assert flow.gates == ["pgp", "session"]
+ assert flow.gates == ["gate", "session"]
def test_behind_refuses_before_any_gate_with_ff_only_hint(self, flow, tmp_path, remote_repo, capsys):
_push_from_elsewhere(tmp_path, remote_repo)
assert flow("message") == 1
- assert flow.gates == [] # no PGP prompt, no gate, mvn or test.py was reached
+ assert flow.gates == [] # no gate, mvn or test.py was reached
out = capsys.readouterr().out
assert "โ upstream: 1 commit behind upstream" in out
assert "git merge --ff-only @{upstream}" in out
@@ -1382,7 +1380,7 @@ class TestPrechecks:
_push_from_elsewhere(tmp_path, remote_repo)
assert flow("--test-only") == 0 # nothing is committed or pushed, so behind-upstream is irrelevant
- assert flow.gates == ["pgp", "session"]
+ assert flow.gates == ["gate", "session"]
def test_dry_run_reports_would_refuse_and_exits_zero(self, flow, tmp_path, repo, remote_repo, capsys):
_push_from_elsewhere(tmp_path, remote_repo)
diff --git a/scripts/tests/test_run_adoption.py b/scripts/tests/test_run_adoption.py
index 8306ebb354..f47c8d4251 100644
--- a/scripts/tests/test_run_adoption.py
+++ b/scripts/tests/test_run_adoption.py
@@ -260,7 +260,7 @@ def test_push_test_only_emits_mode_test_and_never_commits(push_mod, gates, monke
events = markers(capsys.readouterr().out)
project = Path(push_mod.__file__).resolve().parent.parent.name
assert events[0] == {"ev": "run", "v": 1, "mode": "test", "project": project}
- assert [e["id"] for e in events if e["ev"] == "step"] == ["pgp", "container-tags", "bom", "install", "starters"]
+ assert [e["id"] for e in events if e["ev"] == "step"] == ["container-tags", "bom", "install", "starters"]
assert events[-2] == {"ev": "note", "level": "info", "text": "Test-only run: nothing was committed or pushed"}
assert events[-1] == {"ev": "done", "status": "ok"}
assert not {"identity", "commit", "docs"} & set(gates.calls)
@@ -310,9 +310,8 @@ def test_push_failed_gate_ends_the_run_with_done_fail(push_mod, gates, monkeypat
monkeypatch.setattr(sys, "argv", ["push.py", "--test-only"])
assert push_mod.main() == 1
events = markers(capsys.readouterr().out)
- assert events[1] == {"ev": "step", "id": "pgp", "n": 1, "title": "PGP passphrase"}
- assert events[3] == {"ev": "step", "id": "container-tags", "n": 2, "title": "Container test tags"}
- assert events[4]["status"] == "fail"
+ assert events[1] == {"ev": "step", "id": "container-tags", "n": 1, "title": "Container test tags"}
+ assert events[2]["status"] == "fail"
assert events[-1] == {"ev": "done", "status": "fail"}
@@ -359,7 +358,7 @@ def test_push_reserves_step_numbers_for_the_steps_test_py_contributes(push_mod,
env = _capture_child_env(push_mod, monkeypatch, gates)
monkeypatch.setattr(sys, "argv", ["push.py", "--test-only"])
assert push_mod.main() == 0
- assert env["JUNEAU_RUN_N_BASE"] == "3" # after PGP, Tags and BOM
+ assert env["JUNEAU_RUN_N_BASE"] == "2" # after Tags and BOM
def test_push_test_only_fallback_runs_mvn_test_as_a_maven_step(push_mod, gates, monkeypatch, capsys):
@@ -443,7 +442,7 @@ def test_sigterm_ends_the_run_as_cancelled_and_leaves_no_orphan(script, tmp_path
for variable in ("JUNEAU_RUN_ACTIVE", "JUNEAU_RUN_N_BASE", "JUNEAU_MVN_WRAPPER"):
env.pop(variable, None)
# A scratch tree holding only copies of the two scripts (and the real juneau-run), so push.py's other gates
- # (container tags, BOM, PGP prompt) have nothing to run and nothing real is built.
+ # (container tags, BOM) have nothing to run and nothing real is built.
root = tmp_path / "tree"
(root / "scripts").mkdir(parents=True)
for name in ("push.py", "test.py", "_juneau.py"):
@@ -665,31 +664,20 @@ def test_push_rejects_an_unknown_detail_level(push_mod, gates, monkeypatch, caps
assert "actionable" in capsys.readouterr().err
-def test_push_identity_and_pgp_are_rows_not_header_marks(push_mod, gates, monkeypatch, capsys):
+def test_push_identity_is_a_row_not_a_header_mark(push_mod, gates, monkeypatch, capsys):
monkeypatch.setenv("JUNEAU_RUN_CONSOLE", "condensed")
events = push_mod._juneau.load()[0].subscribe(Events())
monkeypatch.setattr(sys, "argv", ["push.py", "Quick fix", "--skip-tests"])
assert push_mod.main() == 0
[session] = events.of("session")
assert session["title"] == "๐ Juneau push ยท main"
- assert not [line for line in session["header"] if "โ" in line or "PGP" in line]
- assert [f["id"] for f in events.of("step_start")][:2] == ["prechecks", "pgp"]
+ assert not [line for line in session["header"] if "โ" in line]
+ assert [f["id"] for f in events.of("step_start")][:1] == ["prechecks"]
out = capsys.readouterr().out
assert "=" * 70 not in out
assert "Juneau Build and Push Script" not in out
-def test_push_prompts_for_pgp_before_the_gates(push_mod, gates, monkeypatch):
- order = []
- monkeypatch.setattr(push_mod.subprocess, "run", lambda cmd, *a, **k: order.append(
- "pgp" if "prompt-pgp-passphrase.py" in " ".join(map(str, cmd)) else "other") or
- subprocess.CompletedProcess(cmd, 0, "", ""))
- monkeypatch.setattr(push_mod, "run_sonarqube_gate", lambda root, n: order.append("sonar") or "pass")
- monkeypatch.setattr(sys, "argv", ["push.py", "Quick fix", "--skip-tests", "--sonarqube"])
- assert push_mod.main() == 0
- assert order.index("pgp") < order.index("sonar")
-
-
def test_push_hands_the_console_to_test_py(push_mod, gates, standalone, monkeypatch):
run, _, _ = standalone
calls = []
@@ -699,8 +687,8 @@ def test_push_hands_the_console_to_test_py(push_mod, gates, standalone, monkeypa
("test.py", env.get("JUNEAU_RUN_LABEL_WIDTH"))) or subprocess.CompletedProcess(cmd, 0))
monkeypatch.setattr(sys, "argv", ["push.py", "--test-only"])
assert push_mod.main() == 0
- # the PGP row pauses first; the final line may pause again
- assert calls[:5] == ["pause", "resume", "pause", ("test.py", "13"), "resume"]
+ # the final line may pause again
+ assert calls[:3] == ["pause", ("test.py", "13"), "resume"]
def test_push_ctrl_c_with_a_console_is_a_clean_cancel(push_mod, gates, standalone, monkeypatch):
@@ -1000,7 +988,7 @@ def test_push_child_env_carries_push_active_and_n_base_under_markers(push_mod, g
monkeypatch.setattr(sys, "argv", ["push.py", "--test-only"])
assert push_mod.main() == 0
assert env["JUNEAU_PUSH_ACTIVE"] == "1"
- assert env["JUNEAU_RUN_N_BASE"] == "3" # after PGP, Tags and BOM
+ assert env["JUNEAU_RUN_N_BASE"] == "2" # after Tags and BOM
def test_push_child_env_has_push_active_but_no_n_base_without_markers(push_mod, gates, monkeypatch):
@@ -1060,9 +1048,9 @@ def test_push_plain_ctrl_c_in_the_session_exits_130(push_mod, gates, monkeypatch
@pytest.mark.parametrize("argv, expected", [
- (["--test-only"], ["pgp", "container-tags", "bom", "build", "tests", "py-tests", "js-tests", "timing", "install", "starters"]),
+ (["--test-only"], ["container-tags", "bom", "build", "tests", "py-tests", "js-tests", "timing", "install", "starters"]),
(["Quick fix", "--skip-tests", "--tracker-audit"],
- ["prechecks", "pgp", "tracker", "tests", "install", "starters", "commit", "push"]),
+ ["prechecks", "tracker", "tests", "install", "starters", "commit", "push"]),
])
def test_push_session_plan_lists_the_steps_this_run_will_take(push_mod, gates, standalone, monkeypatch, argv, expected):
_, events, _ = standalone
@@ -1096,7 +1084,7 @@ def test_push_plan_puts_the_opt_in_gates_first_and_forced_browser_tests_after_te
args = argparse.Namespace(sonarqube=True, tracker_audit=True, skip_tests=False, js_tests=True, test_only=False)
assert [step_id for step_id, _ in push_mod.push_plan(args, script_dir, script_dir.parent, False)] == [
"prechecks", "sonar", "tracker", "bom", "build", "tests", "py-tests", "js-tests", "install", "starters", "commit", "push",
- "docs-smoke", "docs-commit", "docs-push"] # no prompt-pgp-passphrase.py here, so no PGP row
+ "docs-smoke", "docs-commit", "docs-push"]
# The one loader push.py, test.py and release.py share (scripts/_juneau.py).