Skip to content

Commit

Permalink
Bugfix: SSH retry count and wait config was being ignored (#677)
Browse files Browse the repository at this point in the history
* SSH retry count and wait time correction
* unit test
  • Loading branch information
ccureau authored and pjdarton committed Aug 30, 2018
1 parent aba6d0a commit cab4c41
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,3 +6,4 @@ work
*~

dependency-reduced-pom.xml
.DS_Store
Expand Up @@ -70,6 +70,8 @@ public class DockerComputerSSHConnector extends DockerComputerConnector {
public DockerComputerSSHConnector(SSHKeyStrategy sshKeyStrategy) {
this.sshKeyStrategy = sshKeyStrategy;
this.port = 22;
this.maxNumRetries = 30;
this.retryWaitTime = 2;
}

public SSHKeyStrategy getSshKeyStrategy() {
Expand Down Expand Up @@ -225,10 +227,10 @@ protected ComputerLauncher createLauncher(DockerAPI api, String workdir, Inspect
// TODO we could (also) have a more generic mechanism relying on healthcheck (inspect State.Health.Status)
final PortUtils.ConnectionCheck connectionCheck =
PortUtils.connectionCheck( address )
.withRetries( 30 )
.withEveryRetryWaitFor( 2, TimeUnit.SECONDS );
.withRetries( maxNumRetries )
.withEveryRetryWaitFor( retryWaitTime, TimeUnit.SECONDS );
if (!connectionCheck.execute() || !connectionCheck.useSSH().execute()) {
throw new IOException("SSH service didn't started after 60s.");
throw new IOException("SSH service didn't start after " + retryWaitTime*maxNumRetries + "s.");
}

return sshKeyStrategy.getSSHLauncher(address, this);
Expand Down
@@ -0,0 +1 @@
The number of attempts to connect to the newly-spun Docker container
@@ -0,0 +1 @@
Number of seconds to wait between attempts to connect to the newly-spun Docker container

0 comments on commit cab4c41

Please sign in to comment.