-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
System property to override default Slave Connect Timeout in seconds #432
System property to override default Slave Connect Timeout in seconds #432
Conversation
|
||
assertNotNull(timeoutTemplate); | ||
assertEquals(10, timeoutTemplate.getSlaveConnectTimeout()); | ||
r.assertLogNotContains("Hello from container!", b); |
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.
this could be a race condition, couldn't it?
|
||
@Test | ||
public void runInPodValidateOverrideSlaveConnectTimeout() throws Exception { | ||
System.setProperty(org.csanchez.jenkins.plugins.kubernetes.PodTemplate.class.getName()+".connectionTimeout", "10"); |
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.
you need to clear the property after the test or it will affect other tests
you could just do this test as part of another test to avoid increasing the test time during build
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.
Cool. I'm iterating a few times as I was not aware of the ITs setup :(
@@ -76,6 +76,9 @@ public static void isKubernetesConfigured() throws Exception { | |||
assumeKubernetes(); | |||
} | |||
|
|||
@BeforeClass | |||
protected void overrideSystemProperties() { } |
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.
this method is not needed
@Override | ||
@BeforeClass | ||
protected void overrideSystemProperties() { | ||
System.setProperty(PodTemplate.class.getName()+".connectionTimeout", "10"); |
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.
you don't need a separate class, you can just add to your test the System.setProperty
and add to the class
@After
public void cleanup() {
System.clearProperty(PodTemplate.class.getName()+".connectionTimeout");
}
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.
aha! That's even better. So I'll proceed with your approach
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.
I'll need to iterate a few more times as it seems some issues with the context of the system.properties outside of the @Before
and @BeforeClass
annotations
…imeout and remove changes in the abstract as it's not required
Enable
-Dorg.csanchez.jenkins.plugins.kubernetes.PodTemplate.connectionTimeout=XYZ
property to override the agent connect timeout which it's 100 seconds by default.Highlights