mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-06 15:20:54 +03:00
- Experimenting with travis
This commit is contained in:
10
.travis.yml
10
.travis.yml
@@ -1,6 +1,14 @@
|
||||
language: java
|
||||
dist: trusty
|
||||
sudo: false
|
||||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
before_install:
|
||||
- docker build -t sshj/test-sshd .
|
||||
- docker run -d -p 127.0.0.1:2222:22 sshj/test-sshd
|
||||
- docker ps -a
|
||||
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
|
||||
@@ -18,6 +18,10 @@ package com.hierynomus.sshj;
|
||||
import net.schmizz.sshj.DefaultConfig;
|
||||
import net.schmizz.sshj.SSHClient;
|
||||
import net.schmizz.sshj.transport.verification.OpenSSHKnownHosts;
|
||||
import net.schmizz.sshj.transport.verification.PromiscuousVerifier;
|
||||
import net.schmizz.sshj.userauth.keyprovider.KeyProvider;
|
||||
import net.schmizz.sshj.userauth.keyprovider.KeyProviderUtil;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -28,12 +32,12 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
public class IntegrationTest {
|
||||
|
||||
@Test @Ignore // Should only be enabled for testing against VM
|
||||
@Test // Should only be enabled for testing against VM
|
||||
public void shouldConnect() throws IOException {
|
||||
SSHClient sshClient = new SSHClient(new DefaultConfig());
|
||||
sshClient.addHostKeyVerifier(new OpenSSHKnownHosts(new File("/Users/ajvanerp/.ssh/known_hosts")));
|
||||
sshClient.connect("172.16.37.147");
|
||||
sshClient.authPublickey("jeroen");
|
||||
sshClient.addHostKeyVerifier(new PromiscuousVerifier());
|
||||
sshClient.connect("192.168.99.100", 2222);
|
||||
sshClient.authPublickey("sickp", "src/test/resources/id_rsa.ppk");
|
||||
assertThat("Is connected", sshClient.isAuthenticated());
|
||||
}
|
||||
}
|
||||
|
||||
8
src/test/resources/Dockerfile
Normal file
8
src/test/resources/Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
||||
FROM sickp/alpine-sshd:7.5
|
||||
ADD https://raw.githubusercontent.com/Igerly/sshj/master/src/test/resources/id_rsa.pub /home/sickp/.ssh/authorized_keys
|
||||
RUN \
|
||||
echo "root:sunshine" | chpasswd && \
|
||||
adduser -D -s /bin/ash sickp && \
|
||||
passwd -u sickp && \
|
||||
chown -R sickp:sickp /home/sickp
|
||||
|
||||
Reference in New Issue
Block a user