-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Migrate tests to JUnit5 * Migrate annotations and imports * Migrate assertions * Remove public visibility for test classes and methods * Minor code cleanup * Update pom.xml Co-authored-by: Ivan Fernandez Calvo <[email protected]> --------- Co-authored-by: strangelookingnerd <[email protected]> Co-authored-by: Ivan Fernandez Calvo <[email protected]>
- Loading branch information
1 parent
a2157c6
commit e2c6128
Showing
38 changed files
with
834 additions
and
788 deletions.
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
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
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
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
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
54 changes: 29 additions & 25 deletions
54
src/test/java/hudson/plugins/sshslaves/agents/AgentCurve25519Sha256ConnectionTest.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 |
---|---|---|
@@ -1,44 +1,48 @@ | ||
package hudson.plugins.sshslaves.agents; | ||
|
||
import java.io.IOException; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.experimental.categories.Category; | ||
import static hudson.plugins.sshslaves.tags.TestTags.AGENT_SSH_TEST; | ||
import static hudson.plugins.sshslaves.tags.TestTags.SSH_KEX_TEST; | ||
|
||
import org.junit.jupiter.api.Tag; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.images.builder.ImageFromDockerfile; | ||
import hudson.model.Descriptor; | ||
import hudson.model.Node; | ||
import hudson.plugins.sshslaves.categories.AgentSSHTest; | ||
import hudson.plugins.sshslaves.categories.SSHKexTest; | ||
import static org.junit.Assert.assertTrue; | ||
import org.testcontainers.junit.jupiter.Container; | ||
|
||
/** | ||
* Connect to a remote SSH Agent | ||
* | ||
* @author Kuisathaverat | ||
*/ | ||
@Category({ AgentSSHTest.class, SSHKexTest.class}) | ||
public class AgentCurve25519Sha256ConnectionTest extends AgentConnectionBase { | ||
public static final String SSH_AGENT_NAME = "ssh-agent-curve25519-sha256"; | ||
public static final String SSH_KEY_PATH = "ssh/rsa-key"; | ||
public static final String SSH_KEY_PUB_PATH = "ssh/rsa-key.pub"; | ||
|
||
@Rule | ||
public GenericContainer agentContainer = new GenericContainer( | ||
@Tag(AGENT_SSH_TEST) | ||
@Tag(SSH_KEX_TEST) | ||
class AgentCurve25519Sha256ConnectionTest extends AgentConnectionBaseTest { | ||
private static final String SSH_AGENT_NAME = "ssh-agent-curve25519-sha256"; | ||
private static final String SSH_KEY_PATH = "ssh/rsa-key"; | ||
private static final String SSH_KEY_PUB_PATH = "ssh/rsa-key.pub"; | ||
|
||
@Container | ||
private static final GenericContainer<?> agentContainer = new GenericContainer<>( | ||
new ImageFromDockerfile(SSH_AGENT_NAME, false) | ||
.withFileFromClasspath(SSH_AUTHORIZED_KEYS, AGENTS_RESOURCES_PATH + "/" + SSH_AGENT_NAME + "/" + SSH_AUTHORIZED_KEYS) | ||
.withFileFromClasspath(SSH_KEY_PATH, AGENTS_RESOURCES_PATH + "/" + SSH_AGENT_NAME + "/" + SSH_KEY_PATH) | ||
.withFileFromClasspath(SSH_KEY_PUB_PATH, AGENTS_RESOURCES_PATH + "/" + SSH_AGENT_NAME + "/" + SSH_KEY_PUB_PATH) | ||
.withFileFromClasspath(SSH_SSHD_CONFIG, AGENTS_RESOURCES_PATH + "/" + SSH_AGENT_NAME + "/" + SSH_SSHD_CONFIG) | ||
.withFileFromClasspath(DOCKERFILE, AGENTS_RESOURCES_PATH + "/" + SSH_AGENT_NAME + "/" + DOCKERFILE)) | ||
.withExposedPorts(22); | ||
|
||
@Test | ||
public void connectionTests() throws IOException, InterruptedException, Descriptor.FormException { | ||
Node node = createPermanentAgent(SSH_AGENT_NAME, agentContainer.getHost(), agentContainer.getMappedPort(SSH_PORT), | ||
SSH_AGENT_NAME + "/" + SSH_KEY_PATH, ""); | ||
waitForAgentConnected(node); | ||
assertTrue(isSuccessfullyConnected(node)); | ||
.withExposedPorts(SSH_PORT); | ||
|
||
@Override | ||
protected String getAgentName() { | ||
return SSH_AGENT_NAME; | ||
} | ||
|
||
@Override | ||
protected GenericContainer<?> getAgentContainer() { | ||
return agentContainer; | ||
} | ||
|
||
@Override | ||
protected String getAgentSshKeyPath() { | ||
return SSH_AGENT_NAME + "/" + SSH_KEY_PATH; | ||
} | ||
|
||
} |
Oops, something went wrong.