More GH Actions goodies (#3441)
* More GH Actions goodies * Add RabbitMQ, MongoDB & Redis services into GH actions * Remove Travis * * Add `distributionSha256Sum` into `gradle-wrapper.properties` * Try `TERM: dumb` to see difference for Gradle output in GH action * Add `-S` to see the reason of test failure * * Try MQTT plugin for RabbitMQ image * * Try `-i` for test failure in Gradle on Actions * * Use `eclipse-mosquitto` image for MQTT on actions * Fix `FtpServerOutboundTests` for the proper FTP file list * Output file list for the failed session in the `RotatingServersTests` * * Adjust SOUT in the test for Checkstyle * * Make some change to `RotatingServersTests`. Looks like the order for `@BeforeAll` methods is not determined and we may start to interaction with FTP server which is not started yet * Fix SSL Handshake Test - we already made this change for the NIO test, but the NET test is failing the same way - the cert failure switched to the server so the expected exception was not thrown on the client side. Due to JVM changes. * * Fix SFTP tests for wrong host and auto-startup state * Remove `-i` for Gradle in the GH Actions * * Try `--no-parallel` for Gradle in the GH Actions * * Try GH actions without Mosquitto * * Try `cyrilix/rabbitmq-mqtt` for GH Actions Co-authored-by: Gary Russell <grussell@pivotal.io>
This commit is contained in:
16
.github/workflows/pr-build-workflow.yml
vendored
16
.github/workflows/pr-build-workflow.yml
vendored
@@ -10,12 +10,26 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
services:
|
||||
|
||||
rabbitmq:
|
||||
image: rabbitmq
|
||||
image: cyrilix/rabbitmq-mqtt
|
||||
ports:
|
||||
- 5672:5672
|
||||
- 15672:15672
|
||||
- 1883:1883
|
||||
|
||||
mongodb:
|
||||
image: mongo
|
||||
ports:
|
||||
- 27017:27017
|
||||
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379:6379
|
||||
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up JDK 11
|
||||
|
||||
18
.travis.yml
18
.travis.yml
@@ -1,18 +0,0 @@
|
||||
dist: trusty
|
||||
language: java
|
||||
jdk: oraclejdk11
|
||||
sudo: false
|
||||
services:
|
||||
- mongodb
|
||||
- rabbitmq
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.gradle/caches/
|
||||
- $HOME/.gradle/wrapper/
|
||||
install: true
|
||||
env:
|
||||
- TERM=dumb SI_FATAL_WHEN_NO_BEANFACTORY=true NO_REFERENCE_TASK=true
|
||||
script:
|
||||
- ./gradlew checkAsciidocLinks check --refresh-dependencies --no-daemon
|
||||
1
gradle/wrapper/gradle-wrapper.properties
vendored
1
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -3,3 +3,4 @@ distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionSha256Sum=3239b5ed86c3838a37d983ac100573f64c1f3fd8e1eb6c89fa5f9529b5ec091d
|
||||
@@ -46,7 +46,6 @@ import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit.jupiter.DisabledIf;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
/**
|
||||
@@ -90,8 +89,6 @@ public class AmqpOutboundEndpointTests2 {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisabledIf("#{systemEnvironment['TRAVIS'] ?: false}")
|
||||
// needs RabbitMQ 3.7
|
||||
void testWithReject(@Autowired IntegrationFlow flow, @Autowired RabbitAdmin admin,
|
||||
@Autowired RabbitTemplate template) {
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.net.ftp.FTPFile;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInfo;
|
||||
@@ -73,8 +72,8 @@ public class RotatingServersTests extends FtpTestSupport {
|
||||
|
||||
private static String tmpDir = getLocalTempFolder().getAbsolutePath() + File.separator + "multiSF";
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
FtpRemoteFileTemplate rft = new FtpRemoteFileTemplate(sessionFactory());
|
||||
rft.execute(s -> {
|
||||
s.mkdir("foo");
|
||||
@@ -117,15 +116,18 @@ public class RotatingServersTests extends FtpTestSupport {
|
||||
|
||||
@AfterEach
|
||||
public void extraCleanUp(TestInfo info) {
|
||||
if (info.getTestMethod().get().getName().equals("testFairStreaming")) {
|
||||
FtpRemoteFileTemplate rft = new FtpRemoteFileTemplate(sessionFactory());
|
||||
rft.execute(s -> {
|
||||
FtpRemoteFileTemplate rft = new FtpRemoteFileTemplate(sessionFactory());
|
||||
rft.execute(s -> {
|
||||
if (info.getTestMethod().get().getName().equals("testFairStreaming")) {
|
||||
s.remove("foo/f4");
|
||||
s.remove("baz/f5");
|
||||
s.remove("fiz/f6");
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
s.remove("foo/f1");
|
||||
s.remove("baz/f2");
|
||||
s.remove("fiz/f3");
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -326,7 +328,7 @@ public class RotatingServersTests extends FtpTestSupport {
|
||||
.filter(new FtpPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), "rotate"))
|
||||
.localDirectory(localDir())
|
||||
.remoteDirectory("."),
|
||||
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
|
||||
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
|
||||
.channel(MessageChannels.queue("files"))
|
||||
.get();
|
||||
}
|
||||
@@ -349,6 +351,7 @@ public class RotatingServersTests extends FtpTestSupport {
|
||||
protected File localDir() {
|
||||
return new File(tmpDir, "fair");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@@ -362,7 +365,7 @@ public class RotatingServersTests extends FtpTestSupport {
|
||||
.localDirectory(new File(tmpDir, "variable"))
|
||||
.localFilenameExpression("#remoteDirectory + T(java.io.File).separator + #root")
|
||||
.remoteDirectory("."),
|
||||
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
|
||||
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
|
||||
.channel(MessageChannels.queue("files"))
|
||||
.get();
|
||||
}
|
||||
@@ -378,7 +381,7 @@ public class RotatingServersTests extends FtpTestSupport {
|
||||
return IntegrationFlows.from(Ftp.inboundStreamingAdapter(new FtpRemoteFileTemplate(sf()))
|
||||
.filter(new FtpPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), "rotate"))
|
||||
.remoteDirectory("."),
|
||||
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
|
||||
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
|
||||
.channel(MessageChannels.queue("files"))
|
||||
.get();
|
||||
}
|
||||
@@ -405,7 +408,7 @@ public class RotatingServersTests extends FtpTestSupport {
|
||||
.filter(new FtpPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), "rotate"))
|
||||
.remoteDirectory(".")
|
||||
.maxFetchSize(1),
|
||||
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
|
||||
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
|
||||
.channel(MessageChannels.queue("files"))
|
||||
.get();
|
||||
}
|
||||
|
||||
@@ -668,10 +668,10 @@ public class FtpServerOutboundTests extends FtpTestSupport {
|
||||
assertThat(files.size()).isEqualTo(3);
|
||||
assertThat(files).contains("subFtpSource", " ftpSource1.txt", "ftpSource2.txt");
|
||||
|
||||
FTPFile[] ftpFiles = ftpSessionFactory.getSession().list(null);
|
||||
FTPFile[] ftpFiles = ftpSessionFactory.getSession().list("ftpSource");
|
||||
for (FTPFile ftpFile : ftpFiles) {
|
||||
if (!ftpFile.isDirectory()) {
|
||||
assertThat(files.contains(ftpFile.getName())).isTrue();
|
||||
assertThat(files).contains(ftpFile.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ import org.springframework.integration.ip.util.TestingUtilities;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.support.ErrorMessage;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
|
||||
/**
|
||||
@@ -415,10 +416,11 @@ public class SocketSupportTests {
|
||||
.isThrownBy(() -> testNetClientAndServerSSLDifferentContexts(true));
|
||||
}
|
||||
|
||||
private void testNetClientAndServerSSLDifferentContexts(boolean badClient) throws Exception {
|
||||
private void testNetClientAndServerSSLDifferentContexts(boolean badServer) throws Exception {
|
||||
System.setProperty("javax.net.debug", "all"); // SSL activity in the console
|
||||
TcpNetServerConnectionFactory server = new TcpNetServerConnectionFactory(0);
|
||||
TcpSSLContextSupport serverSslContextSupport = new DefaultTcpSSLContextSupport("server.ks",
|
||||
TcpSSLContextSupport serverSslContextSupport = new DefaultTcpSSLContextSupport(
|
||||
badServer ? "client.ks" : "server.ks",
|
||||
"server.truststore.ks", "secret", "secret");
|
||||
DefaultTcpNetSSLSocketFactorySupport serverTcpSocketFactorySupport =
|
||||
new DefaultTcpNetSSLSocketFactorySupport(serverSslContextSupport);
|
||||
@@ -426,8 +428,10 @@ public class SocketSupportTests {
|
||||
final List<Message<?>> messages = new ArrayList<Message<?>>();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
server.registerListener(message -> {
|
||||
messages.add(message);
|
||||
latch.countDown();
|
||||
if (!(message instanceof ErrorMessage)) {
|
||||
messages.add(message);
|
||||
latch.countDown();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
server.setTcpSocketSupport(new DefaultTcpSocketSupport(false) {
|
||||
@@ -442,8 +446,7 @@ public class SocketSupportTests {
|
||||
TestingUtilities.waitListening(server, null);
|
||||
|
||||
TcpNetClientConnectionFactory client = new TcpNetClientConnectionFactory("localhost", server.getPort());
|
||||
TcpSSLContextSupport clientSslContextSupport = new DefaultTcpSSLContextSupport(
|
||||
badClient ? "server.ks" : "client.ks",
|
||||
TcpSSLContextSupport clientSslContextSupport = new DefaultTcpSSLContextSupport("client.ks",
|
||||
"client.truststore.ks", "secret", "secret");
|
||||
DefaultTcpNetSSLSocketFactorySupport clientTcpSocketFactorySupport =
|
||||
new DefaultTcpNetSSLSocketFactorySupport(clientSslContextSupport);
|
||||
|
||||
@@ -816,7 +816,7 @@ public class TcpNioConnectionTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled("Timing is too short for CI/Travis")
|
||||
@Disabled("Timing is too short for CI")
|
||||
public void testNoDelayOnClose() throws Exception {
|
||||
TcpNioServerConnectionFactory cf = new TcpNioServerConnectionFactory(0);
|
||||
final CountDownLatch reading = new CountDownLatch(1);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</channel>
|
||||
|
||||
<beans:bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
|
||||
<beans:property name="host" value="loclahost"/>
|
||||
<beans:property name="host" value="localhost"/>
|
||||
<beans:property name="knownHostsResource" value="#{ new org.springframework.core.io.ByteArrayResource('local, foo.com, bar.foo'.bytes)}"/>
|
||||
<beans:property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftp_rsa"/>
|
||||
<beans:property name="privateKeyPassphrase" value="ghj"/>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<channel id="requestChannel"/>
|
||||
|
||||
<beans:bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
|
||||
<beans:property name="host" value="loclahost"/>
|
||||
<beans:property name="host" value="localhost"/>
|
||||
<beans:property name="knownHostsResource"
|
||||
value="#{ new org.springframework.core.io.ByteArrayResource('local, foo.com, bar.foo'.bytes)}"/>
|
||||
<beans:property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftpTest"/>
|
||||
@@ -25,6 +25,7 @@
|
||||
channel="requestChannel"
|
||||
session-factory="sftpSessionFactory"
|
||||
filter="filter"
|
||||
auto-startup="false"
|
||||
remote-directory="/foo"
|
||||
local-directory="file:foo"
|
||||
auto-create-local-directory="false"
|
||||
|
||||
@@ -3,24 +3,19 @@
|
||||
xmlns="http://www.springframework.org/schema/integration"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xmlns:tool="http://www.springframework.org/schema/tool"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xmlns:sftp="http://www.springframework.org/schema/integration/sftp"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/tool https://www.springframework.org/schema/tool/spring-tool.xsd
|
||||
http://www.springframework.org/schema/lang https://www.springframework.org/schema/lang/spring-lang.xsd
|
||||
|
||||
|
||||
|
||||
|
||||
http://www.springframework.org/schema/integration/sftp https://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd">
|
||||
|
||||
<channel id="requestChannel"/>
|
||||
|
||||
<beans:bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.SimpleSftpSessionFactory">
|
||||
<beans:property name="host" value="loclahost"/>
|
||||
<beans:property name="host" value="localhost"/>
|
||||
<beans:property name="knownHostsResource" value="local, foo.com, bar.foo"/>
|
||||
<beans:property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftpTest"/>
|
||||
<beans:property name="privateKeyPassphrase" value="ghj"/>
|
||||
@@ -30,14 +25,15 @@
|
||||
</beans:bean>
|
||||
|
||||
<sftp:inbound-channel-adapter id="sftpAdapterNoAutoCreate"
|
||||
channel="requestChannel"
|
||||
session-factory="sftpSessionFactory"
|
||||
filter="filter"
|
||||
filename-pattern="."
|
||||
remote-directory="/foo"
|
||||
local-directory="file:local-test-dir"
|
||||
auto-create-local-directory="false"
|
||||
auto-delete-remote-files-on-sync="false">
|
||||
channel="requestChannel"
|
||||
session-factory="sftpSessionFactory"
|
||||
filter="filter"
|
||||
filename-pattern="."
|
||||
auto-startup="false"
|
||||
remote-directory="/foo"
|
||||
local-directory="file:local-test-dir"
|
||||
auto-create-local-directory="false"
|
||||
auto-delete-remote-files-on-sync="false">
|
||||
<poller fixed-rate="1000"/>
|
||||
</sftp:inbound-channel-adapter>
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</beans:bean>
|
||||
|
||||
<beans:bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
|
||||
<beans:property name="host" value="loclahost"/>
|
||||
<beans:property name="host" value="localhost"/>
|
||||
<beans:property name="knownHostsResource"
|
||||
value="#{ new org.springframework.core.io.ByteArrayResource('local, foo.com, bar.foo'.bytes)}"/>
|
||||
<beans:property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftp_rsa"/>
|
||||
@@ -76,6 +76,7 @@
|
||||
session-factory="sftpSessionFactory"
|
||||
filter="filter"
|
||||
remote-directory="/foo"
|
||||
auto-startup="false"
|
||||
local-directory="file:local-test-dir"
|
||||
auto-create-local-directory="true"
|
||||
delete-remote-files="false">
|
||||
@@ -87,6 +88,7 @@
|
||||
channel="requestChannel"
|
||||
filename-pattern="pattern"
|
||||
remote-directory="/foo"
|
||||
auto-startup="false"
|
||||
local-directory="file:local-test-dir"
|
||||
auto-create-local-directory="false"
|
||||
delete-remote-files="false">
|
||||
@@ -99,6 +101,7 @@
|
||||
filename-pattern="pattern"
|
||||
remote-directory="/foo"
|
||||
local-directory="file:foo"
|
||||
auto-startup="false"
|
||||
auto-create-local-directory="true"
|
||||
delete-remote-files="false">
|
||||
<poller fixed-rate="1000"/>
|
||||
@@ -113,6 +116,7 @@
|
||||
filter="filter"
|
||||
remote-directory="/foo"
|
||||
local-directory="file:foo"
|
||||
auto-startup="false"
|
||||
auto-create-local-directory="false"
|
||||
delete-remote-files="false">
|
||||
<poller fixed-rate="1000"/>
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.BeanDefinitionStoreException;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
@@ -97,6 +98,7 @@ public class InboundChannelAdapterParserTests {
|
||||
assertThat(remoteFileSeparator).isNotNull();
|
||||
assertThat(remoteFileSeparator).isEqualTo(".");
|
||||
PollableChannel requestChannel = context.getBean("requestChannel", PollableChannel.class);
|
||||
((Lifecycle) adapter).start();
|
||||
assertThat(requestChannel.receive(10000)).isNotNull();
|
||||
FileListFilter<?> acceptAllFilter = context.getBean("acceptAllFilter", FileListFilter.class);
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<channel id="inboundFilesChannel"/>
|
||||
|
||||
<beans:bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
|
||||
<beans:property name="host" value="loclahost"/>
|
||||
<beans:property name="host" value="localhost"/>
|
||||
<beans:property name="knownHostsResource"
|
||||
value="#{ new org.springframework.core.io.ByteArrayResource('local, foo.com, bar.foo'.bytes)}"/>
|
||||
<beans:property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftpTest"/>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
http://www.springframework.org/schema/integration/sftp https://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd">
|
||||
|
||||
<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
|
||||
<property name="host" value="loclahost"/>
|
||||
<property name="host" value="localhost"/>
|
||||
<property name="knownHostsResource"
|
||||
value="#{ new org.springframework.core.io.ByteArrayResource('local, foo.com, bar.foo'.bytes)}"/>
|
||||
<property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftp_rsa"/>
|
||||
|
||||
Reference in New Issue
Block a user