Skip to content

Commit 29587cd

Browse files
committed
ci: run integration tests also against PostgreSQL database.
See https://docs.travis-ci.com/user/database-setup/#postgresql Fix #1054
1 parent ecad9fa commit 29587cd

File tree

4 files changed

+140
-5
lines changed

4 files changed

+140
-5
lines changed

.travis.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
dist: xenial
22
language: java
33

4-
# @todo #1034 Travis CI: run tests on PostgreSQL
54
env:
65
matrix:
76
- SPRING_PROFILES_ACTIVE=test
87
- SPRING_PROFILES_ACTIVE=travis
8+
- SPRING_PROFILES_ACTIVE=postgres
99
global:
1010
- MAVEN_OPTS='-Xss256k'
1111
#- secure: "fBav56BzY+A+Vs1g9YSfo1oLDCO1rFrXl49lJkOA5/XpnsKEEs4lI2RcOzz0wiJKXFNgcliiAJWoYMI8Esqz+lkyFWan4ij5Co0UzJcytDuY+2o+jaqwx45DuDYPogABzT+hWjLCxQLLG46gUkChzT8kcvOOn6JxC7Ff8q5MnoM="
1212

13+
# @todo #1054 Ensure all integration tests to pass on PostgreSQL
14+
jobs:
15+
allow_failures:
16+
- env: SPRING_PROFILES_ACTIVE=postgres
17+
18+
# @todo #1054 Unify PostgreSQL version/configuration between Travis and docker-compose
1319
before_script:
1420
- if [ "$SPRING_PROFILES_ACTIVE" = 'travis' ]; then
1521
mysql -u root -e 'CREATE DATABASE mystamps CHARACTER SET utf8;';
@@ -26,6 +32,8 @@ before_script:
2632
fi;
2733
sudo apt-get -qq update;
2834
sudo apt-get install -y shellcheck;
35+
elif [ "$SPRING_PROFILES_ACTIVE" = 'postgres' ]; then
36+
psql -U postgres -c 'create database mystamps;';
2937
fi
3038

3139
script:
@@ -76,6 +84,7 @@ cache:
7684

7785
services:
7886
- mysql
87+
- postgresql
7988

8089
branches:
8190
except:

pom.xml

+4-3
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,12 @@
224224
</dependency>
225225

226226
<!--
227-
Isn't being used by default but can be activated by overriding the following properties:
228-
- spring.datasource.url (jdbc:postgresql://localhost:5432/mystamps)
227+
Required for "postgres" profile (see src/main/resources/application-postgres.properties).
228+
Perhaps, you would need to override the following properties as by default it's
229+
configured for TravisCI environment:
230+
- spring.datasource.url
229231
- spring.datasource.username
230232
- spring.datasource.password
231-
- spring.datasource.driver-class-name (org.postgresql.Driver)
232233
-->
233234
<dependency>
234235
<groupId>org.postgresql</groupId>

src/main/java/ru/mystamps/web/feature/image/ImageConfig.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public ImageDao imageDao() {
7474

7575
}
7676

77-
@Profile("test")
77+
// @todo #1054 Introduce profiles for image persistence strategies
78+
@Profile({ "test", "postgres" })
7879
@RequiredArgsConstructor
7980
public static class DbStrategyConfig {
8081

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
spring.profiles: postgres
2+
3+
# Details about MySQL configuration on Travis CI: https://docs.travis-ci.com/user/database-setup/#postgresql
4+
spring.datasource.url: jdbc:postgresql://localhost:5432/mystamps
5+
spring.datasource.username: postgres
6+
spring.datasource.password:
7+
spring.datasource.driver-class-name: org.postgresql.Driver
8+
spring.datasource.initialize: false
9+
10+
# @todo #1054 Extract part of spring.messages configuration to a common profile
11+
spring.messages.cache-seconds: -1
12+
spring.messages.fallback-to-system-locale: false
13+
spring.messages.basename: \
14+
ru/mystamps/i18n/Messages, \
15+
ru/mystamps/i18n/ValidationMessages, \
16+
ru/mystamps/i18n/SpringSecurityMessages, \
17+
ru/mystamps/i18n/MailTemplates
18+
19+
# @todo #1054 Extract part of Thymeleaf configuration to a common profile
20+
spring.thymeleaf.mode: HTML
21+
spring.thymeleaf.prefix: /WEB-INF/views/
22+
spring.thymeleaf.suffix: .html
23+
spring.thymeleaf.cache: true
24+
25+
# @todo #1054 Introduce "mailgun-mock" profile
26+
mailgun.endpoint: http://127.0.0.1:8888/mailgun/send-message
27+
mailgun.password: secret
28+
29+
# @todo #1054 Introduce profiles for liquibase contexts
30+
liquibase.contexts: scheme, init-data, test-data
31+
liquibase.change-log: classpath:/liquibase/changelog.xml
32+
33+
logging.level.: INFO
34+
logging.level.ru.mystamps: INFO
35+
logging.level.ru.mystamps.web.support.spring.security.SessionLocaleResolverAwareFilter: INFO
36+
logging.level.liquibase: WARN
37+
logging.level.org.springframework.web.servlet.handler.SimpleUrlHandlerMapping: WARN
38+
logging.level.org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping: WARN
39+
40+
app.use-cdn: false
41+
42+
# @todo #1054 Extract list of exclusions to a common profile
43+
# Full list of autoconfiguration classes:
44+
# http://docs.spring.io/spring-boot/docs/1.5.x/reference/html/auto-configuration-classes.html
45+
# The difference between test profile is that we don't need H2ConsoleAutoConfiguration
46+
spring.autoconfigure.exclude: \
47+
org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration \
48+
, org.springframework.boot.autoconfigure.aop.AopAutoConfiguration \
49+
, org.springframework.boot.autoconfigure.jms.artemis.ArtemisAutoConfiguration \
50+
, org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration \
51+
, org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration \
52+
, org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration \
53+
, org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration \
54+
, org.springframework.boot.autoconfigure.data.cassandra.CassandraRepositoriesAutoConfiguration \
55+
, org.springframework.boot.autoconfigure.cloud.CloudAutoConfiguration \
56+
, org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration \
57+
, org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration \
58+
, org.springframework.boot.autoconfigure.couchbase.CouchbaseAutoConfiguration \
59+
, org.springframework.boot.autoconfigure.data.couchbase.CouchbaseDataAutoConfiguration \
60+
, org.springframework.boot.autoconfigure.data.couchbase.CouchbaseRepositoriesAutoConfiguration \
61+
, org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration \
62+
, org.springframework.boot.autoconfigure.mail.MailSenderValidatorAutoConfiguration \
63+
, org.springframework.boot.autoconfigure.mobile.DeviceDelegatingViewResolverAutoConfiguration \
64+
, org.springframework.boot.autoconfigure.mobile.DeviceResolverAutoConfiguration \
65+
, org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration \
66+
, org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration \
67+
, org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration \
68+
, org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLdapAutoConfiguration \
69+
, org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration \
70+
, org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration \
71+
, org.springframework.boot.autoconfigure.social.FacebookAutoConfiguration \
72+
, org.springframework.boot.autoconfigure.security.FallbackWebSecurityAutoConfiguration \
73+
, org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration \
74+
, org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration \
75+
, org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration \
76+
, org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration \
77+
, org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration \
78+
, org.springframework.boot.autoconfigure.hazelcast.HazelcastJpaDependencyAutoConfiguration \
79+
, org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration \
80+
, org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration \
81+
, org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration \
82+
, org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration \
83+
, org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration \
84+
, org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration \
85+
, org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration \
86+
, org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration \
87+
, org.springframework.boot.autoconfigure.jms.JndiConnectionFactoryAutoConfiguration \
88+
, org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration \
89+
, org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration \
90+
, org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration \
91+
, org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfiguration \
92+
, org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration \
93+
, org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration \
94+
, org.springframework.boot.autoconfigure.data.ldap.LdapDataAutoConfiguration \
95+
, org.springframework.boot.autoconfigure.data.ldap.LdapRepositoriesAutoConfiguration \
96+
, org.springframework.boot.autoconfigure.social.LinkedInAutoConfiguration \
97+
, org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration \
98+
, org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration \
99+
, org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration \
100+
, org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration \
101+
, org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration \
102+
, org.springframework.boot.autoconfigure.data.neo4j.Neo4jRepositoriesAutoConfiguration \
103+
, org.springframework.boot.autoconfigure.security.oauth2.OAuth2AutoConfiguration \
104+
, org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration \
105+
, org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration \
106+
, org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration \
107+
, org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration \
108+
, org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration \
109+
, org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration \
110+
, org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration \
111+
, org.springframework.boot.autoconfigure.sendgrid.SendGridAutoConfiguration \
112+
, org.springframework.boot.autoconfigure.session.SessionAutoConfiguration \
113+
, org.springframework.boot.autoconfigure.mobile.SitePreferenceAutoConfiguration \
114+
, org.springframework.boot.autoconfigure.social.SocialWebAutoConfiguration \
115+
, org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration \
116+
, org.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration \
117+
, org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration \
118+
, org.springframework.boot.autoconfigure.social.TwitterAutoConfiguration \
119+
, org.springframework.boot.autoconfigure.webservices.WebServicesAutoConfiguration \
120+
, org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration \
121+
, org.springframework.boot.autoconfigure.websocket.WebSocketMessagingAutoConfiguration \
122+
, org.springframework.boot.autoconfigure.jdbc.XADataSourceAutoConfiguration \
123+
\
124+
, org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration

0 commit comments

Comments
 (0)