-
Notifications
You must be signed in to change notification settings - Fork 196
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
Adding test of serial form of program.dat
including pickles
#489
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
buildPlugin(useContainerAgent: true, configurations: [ | ||
[ platform: "linux", jdk: "8" ], | ||
[ platform: "docker", jdk: "8" ], | ||
[ platform: "windows", jdk: "8" ], | ||
[ platform: "linux", jdk: "11" ] | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
src/test/java/org/jenkinsci/plugins/workflow/cps/SerialFormTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright 2021 CloudBees, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
package org.jenkinsci.plugins.workflow.cps; | ||
|
||
import hudson.model.Node; | ||
import hudson.model.Slave; | ||
import hudson.slaves.SlaveComputer; | ||
import java.net.URL; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.is; | ||
import static org.hamcrest.Matchers.notNullValue; | ||
import org.jenkinsci.plugins.workflow.job.WorkflowJob; | ||
import org.jenkinsci.plugins.workflow.job.WorkflowRun; | ||
import org.jenkinsci.plugins.workflow.pickles.Pickle; | ||
import org.junit.AfterClass; | ||
import org.junit.Test; | ||
import org.junit.Assume; | ||
import org.junit.BeforeClass; | ||
import org.junit.Rule; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
import org.jvnet.hudson.test.RealJenkinsRule; | ||
import org.jvnet.hudson.test.recipes.LocalData; | ||
import org.testcontainers.DockerClientFactory; | ||
import org.testcontainers.Testcontainers; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.utility.MountableFile; | ||
|
||
/** | ||
* Test compatibility of the format of {@code program.dat} as well as various {@link Pickle}s. | ||
*/ | ||
public class SerialFormTest { | ||
|
||
private static final String AGENT_NAME = "remote"; | ||
private static final String AGENT_SECRET = "defebc83e8736659464a172801f43de376f751891e69cb6ece89e856d6cc3b48"; | ||
|
||
private static GenericContainer<?> agentContainer; | ||
|
||
@BeforeClass public static void dockerCheck() throws Exception { | ||
try { | ||
DockerClientFactory.instance().client(); | ||
} catch (Exception x) { | ||
Assume.assumeNoException("does not look like Docker is available", x); | ||
} | ||
} | ||
|
||
@AfterClass public static void terminateContainer() throws Exception { | ||
if (agentContainer != null && agentContainer.isRunning()) { | ||
agentContainer.stop(); | ||
} | ||
} | ||
|
||
@Rule public RealJenkinsRule rr = new RealJenkinsRule(); | ||
|
||
@LocalData | ||
@Test public void persistence() throws Throwable { | ||
rr.startJenkins(); | ||
URL u = rr.getUrl(); | ||
Testcontainers.exposeHostPorts(u.getPort()); | ||
agentContainer = new GenericContainer<>("jenkins/inbound-agent"). | ||
withEnv("JENKINS_URL", new URL(u.getProtocol(), "host.testcontainers.internal", u.getPort(), u.getFile()).toString()). | ||
withEnv("JENKINS_AGENT_NAME", AGENT_NAME). | ||
withEnv("JENKINS_SECRET", AGENT_SECRET). | ||
withEnv("JENKINS_WEB_SOCKET", "true"); | ||
agentContainer.start(); | ||
agentContainer.copyFileToContainer(MountableFile.forClasspathResource(SerialFormTest.class.getName().replace('.', '/') + "/persistence-workspace"), "/home/jenkins/agent/workspace"); | ||
rr.runRemotely(SerialFormTest::_persistence); | ||
} | ||
private static void _persistence(JenkinsRule r) throws Throwable { | ||
Node agent = r.jenkins.getNode(AGENT_NAME); | ||
assertThat(agent, notNullValue()); | ||
assertThat(((SlaveComputer) agent.toComputer()).getJnlpMac(), is(AGENT_SECRET)); | ||
r.waitOnline((Slave) agent); | ||
WorkflowJob p = r.jenkins.getItemByFullName("p", WorkflowJob.class); | ||
WorkflowRun b = p.getBuildByNumber(1); | ||
r.assertBuildStatusSuccess(r.waitForCompletion(b)); | ||
} | ||
|
||
} |
Empty file.
133 changes: 133 additions & 0 deletions
133
.../workflow/cps/SerialFormTest/persistence-workspace/p@tmp/durable-dae459c1/jenkins-log.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
+ touch running | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 | ||
+ [ -f running ] | ||
+ sleep 1 |
1 change: 1 addition & 0 deletions
1
...rkflow/cps/SerialFormTest/persistence-workspace/p@tmp/durable-dae459c1/jenkins-result.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 |
1 change: 1 addition & 0 deletions
1
...lugins/workflow/cps/SerialFormTest/persistence-workspace/p@tmp/durable-dae459c1/script.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
touch running; while [ -f running ]; do sleep 1; done |
50 changes: 50 additions & 0 deletions
50
...s/org/jenkinsci/plugins/workflow/cps/SerialFormTest/persistence/jobs/p/builds/1/build.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?xml version='1.1' encoding='UTF-8'?> | ||
<flow-build plugin="[email protected]"> | ||
<actions> | ||
<jenkins.metrics.impl.TimeInQueueAction plugin="[email protected]"> | ||
<queuingDurationMillis>34</queuingDurationMillis> | ||
</jenkins.metrics.impl.TimeInQueueAction> | ||
</actions> | ||
<queueId>1</queueId> | ||
<timestamp>1638308102618</timestamp> | ||
<startTime>1638308102633</startTime> | ||
<duration>0</duration> | ||
<charset>UTF-8</charset> | ||
<keepLog>false</keepLog> | ||
<execution class="org.jenkinsci.plugins.workflow.cps.CpsFlowExecution"> | ||
<result>SUCCESS</result> | ||
<script>node('remote') {sh 'touch running; while [ -f running ]; do sleep 1; done'}</script> | ||
<loadedScripts class="map"/> | ||
<durabilityHint>MAX_SURVIVABILITY</durabilityHint> | ||
<timings class="map"> | ||
<entry> | ||
<string>flowNode</string> | ||
<long>71664725</long> | ||
</entry> | ||
<entry> | ||
<string>classLoad</string> | ||
<long>503032612</long> | ||
</entry> | ||
<entry> | ||
<string>run</string> | ||
<long>2013078534</long> | ||
</entry> | ||
<entry> | ||
<string>parse</string> | ||
<long>634788612</long> | ||
</entry> | ||
<entry> | ||
<string>saveProgram</string> | ||
<long>157243273</long> | ||
</entry> | ||
</timings> | ||
<sandbox>true</sandbox> | ||
<iota>5</iota> | ||
<head>1:5</head> | ||
<start>2</start> | ||
<done>false</done> | ||
<resumeBlocked>false</resumeBlocked> | ||
</execution> | ||
<completed>false</completed> | ||
<checkouts class="hudson.util.PersistedList"/> | ||
</flow-build> |
10 changes: 10 additions & 0 deletions
10
...sources/org/jenkinsci/plugins/workflow/cps/SerialFormTest/persistence/jobs/p/builds/1/log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Started | ||
Running in Durability level: MAX_SURVIVABILITY | ||
[8mha:////4C4s8GpgRgC7jL1Vc6+MQZUhj5+pxM2y2IilVjG9e5RaAAAAoh+LCAAAAAAAAP9tjTEOwjAQBM8BClpKHuFItIiK1krDC0x8GCfWnbEdkooX8TX+gCESFVvtrLSa5wtWKcKBo5UdUu8otU4GP9jS5Mixv3geZcdn2TIl9igbHBs2eJyx4YwwR1SwULBGaj0nRzbDRnX6rmuvydanHMu2V1A5c4MHCFXMWcf8hSnC9jqYxPTz/BXAFEIGsfuclm8zQVqFvQAAAA==[0m[Pipeline] Start of Pipeline | ||
[8mha:////4MwOmZDnQUlX3FPa62Hf2kYUe6i49FlqM4oh1HuXCGDxAAAApR+LCAAAAAAAAP9tjTEOwjAUQ3+KOrAycohUghExsUZZOEFIQkgb/d8mKe3EibgadyBQiQlLlmxL1nu+oE4RjhQdby12HpP2vA+jK4lPFLtroIm3dOGaMFGwXNpJkrGnpUrKFhaxClYC1hZ1oOTRZdiIVt1VExS65pxj2Q4CKm8GeAAThZxVzN8yR9jeRpMIf5y/AJj7DGxXvP/86jduZBmjwAAAAA==[0m[Pipeline] node | ||
Running on [8mha:////4CLaJebQ3Knjt6rAddxf+RuWnS4i436VjAMYkt3tHTz2AAAAnB+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAy2EgZB/eT83ILSktQi/aLUXKAafQAiQtsUxgAAAA==[0mremote in /home/jenkins/agent/workspace/p | ||
[8mha:////4DkY9lqEYg4baTEkb2FhC5+BuwytGxWEN+/Kps71hDEwAAAApR+LCAAAAAAAAP9tjTEOwjAUQ3+KOrAycoh0gA0xsUZZOEFIQkgb/d8mKe3EibgadyBQiQlLlmxL1nu+oE4RjhQdby12HpP2vA+jK4lPFLtroIm3dOGaMFGwXNpJkrGnpUrKFhaxClYC1hZ1oOTRZdiIVt1VExS65pxj2Q4CKm8GeAAThZxVzN8yR9jeRpMIf5y/AJj7DGxXvP/86jfoP95RwAAAAA==[0m[Pipeline] { | ||
[8mha:////4N75xltGAcmBKGhiYVX84T5NICPl/mFx9RvMgEd8+nJ1AAAAoh+LCAAAAAAAAP9tjTEOAiEURD9rLGwtPQTbaGWsbAmNJ0AWEZb8zwLrbuWJvJp3kLiJlZNMMm+a93rDOic4UbLcG+wdZu14DKOti0+U+lugiXu6ck2YKRguzSSpM+cFJRUDS1gDKwEbgzpQdmgLbIVXD9UGhba9lFS/o4DGdQM8gYlqLiqVL8wJdvexy4Q/z18BzLEA29ce4gdpL1fxvAAAAA==[0m[Pipeline] sh | ||
+ touch running | ||
+ [ -f running ] | ||
+ sleep 1 |
4 changes: 4 additions & 0 deletions
4
...s/org/jenkinsci/plugins/workflow/cps/SerialFormTest/persistence/jobs/p/builds/1/log-index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
670 3 | ||
998 | ||
1595 5 | ||
1638 |
Binary file added
BIN
+7.98 KB
...org/jenkinsci/plugins/workflow/cps/SerialFormTest/persistence/jobs/p/builds/1/program.dat
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
.../jenkinsci/plugins/workflow/cps/SerialFormTest/persistence/jobs/p/builds/1/workflow/2.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version='1.1' encoding='UTF-8'?> | ||
<Tag plugin="[email protected]"> | ||
<node class="org.jenkinsci.plugins.workflow.graph.FlowStartNode" plugin="[email protected]"> | ||
<parentIds/> | ||
<id>2</id> | ||
</node> | ||
<actions> | ||
<wf.a.TimingAction plugin="[email protected]"> | ||
<startTime>1638308103597</startTime> | ||
</wf.a.TimingAction> | ||
</actions> | ||
</Tag> |
34 changes: 34 additions & 0 deletions
34
.../jenkinsci/plugins/workflow/cps/SerialFormTest/persistence/jobs/p/builds/1/workflow/3.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version='1.1' encoding='UTF-8'?> | ||
<Tag plugin="[email protected]"> | ||
<node class="cps.n.StepStartNode" plugin="workflow-cps@999999-SNAPSHOT"> | ||
<parentIds> | ||
<string>2</string> | ||
</parentIds> | ||
<id>3</id> | ||
<descriptorId>org.jenkinsci.plugins.workflow.support.steps.ExecutorStep</descriptorId> | ||
</node> | ||
<actions> | ||
<s.a.LogStorageAction/> | ||
<cps.a.ArgumentsActionImpl plugin="workflow-cps@999999-SNAPSHOT"> | ||
<arguments> | ||
<entry> | ||
<string>label</string> | ||
<string>remote</string> | ||
</entry> | ||
</arguments> | ||
<sensitiveVariables/> | ||
<isUnmodifiedBySanitization>true</isUnmodifiedBySanitization> | ||
</cps.a.ArgumentsActionImpl> | ||
<wf.a.TimingAction plugin="[email protected]"> | ||
<startTime>1638308103856</startTime> | ||
</wf.a.TimingAction> | ||
<org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution_-QueueItemActionImpl plugin="[email protected]"> | ||
<id>2</id> | ||
</org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution_-QueueItemActionImpl> | ||
<s.a.WorkspaceActionImpl> | ||
<node>remote</node> | ||
<path>/home/jenkins/agent/workspace/p</path> | ||
<labels class="sorted-set"/> | ||
</s.a.WorkspaceActionImpl> | ||
</actions> | ||
</Tag> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Personally I prefer to use ZIP files with
@LocalData
so this kind of stuff does not come up in GitHub searches, but maybe you prefer doing things this way for other reasons.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be an issue I suppose. I normally prefer exploded
$JENKINS_HOME
because it is easier to review, and occasionally it even makes sense to change one line of one file, which in a ZIP would just be an opaque blob.