Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test regressions after JTH bump #9762

Merged
merged 3 commits into from
Sep 20, 2024
Merged

Conversation

jglick
Copy link
Member

@jglick jglick commented Sep 19, 2024

Supersedes #9759. Downstream of jenkinsci/jenkins-test-harness#842.

@@ -104,7 +104,7 @@ public void run(JenkinsRule r) throws Throwable {
p.setAssignedNode(agent);
FreeStyleBuild b = r.buildAndAssertSuccess(p);
if (webSocket) {
assertThat(agent.toComputer().getSystemProperties().get("java.class.path"), is(new File(r.jenkins.root, "agent.jar").getAbsolutePath()));
assertThat(agent.toComputer().getSystemProperties().get("java.class.path").toString(), endsWith("agent.jar"));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assertion introduced in #6780, if I recall correctly just to somehow use the Channel, and made more brittle in #7192. Does not need to check the exact path, or even really this property, it is just exercising Remoting.

@Test
public void runWithCurrentAgentJar() throws Throwable {
runWithRemoting(null, null, false);
}

private void runWithRemoting(String expectedRemotingVersion, String remotingResourcePath, boolean requestingJarFromAgent) throws Throwable {
if (expectedRemotingVersion != null) {
FileUtils.copyURLToFile(Security3430Test.class.getResource(remotingResourcePath), new File(jj.getHome(), "agent.jar"));
// TODO brittle; rather call InboundAgentRule.start(AgentArguments, Options) with a known agentJar
FileUtils.copyURLToFile(Security3430Test.class.getResource(remotingResourcePath), new File(System.getProperty("java.io.tmpdir"), "agent.jar"));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced in 5d26b53. jenkinsci/jenkins-test-harness#838 picks a different location.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jenkinsci/jenkins-test-harness#843 fixes location reuse that likely caused the failure being @Ignored here.

@@ -126,7 +129,7 @@ private static void _run(JenkinsRule j, String agentName, String expectedRemotin
if (requestingJarFromAgent) {
assertThat(logRecords, hasItem(logMessageContainsString("Allowing URL: file:/")));
} else {
assertThat(logRecords, is(empty()));
assertThat(logRecords.stream().map(LogRecord::getMessage).toList(), is(empty()));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous failure message was unhelpful (LogRecord does not override toString).

@jglick jglick marked this pull request as ready for review September 20, 2024 12:06
Copy link
Member

@basil basil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@basil basil merged commit ae2e780 into jenkinsci:master Sep 20, 2024
16 checks passed
@jglick jglick deleted the java.io.tmpdir branch September 20, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants