- Experimenting with travis

This commit is contained in:
Iger
2017-12-03 19:10:08 +02:00
parent 661f63eab7
commit 7a884d0938
3 changed files with 25 additions and 5 deletions

View File

@@ -1,7 +1,15 @@
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

View File

@@ -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());
}
}

View 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