Polishing.
Adopt changed relative paths. Move setup scripts back to src/test/bash. Original pull request: #8.
This commit is contained in:
@@ -11,7 +11,7 @@ install:
|
||||
- mkdir -p download
|
||||
- test -f download/apache-cassandra-2.2.6-bin.tar.gz || wget http://www-eu.apache.org/dist/cassandra/2.2.6/apache-cassandra-2.2.6-bin.tar.gz -O download/apache-cassandra-2.2.6-bin.tar.gz
|
||||
- tar xzf download/apache-cassandra-2.2.6-bin.tar.gz
|
||||
- cp -f src/test/resources/cassandra.yaml apache-cassandra-2.2.6/conf
|
||||
- cp -f spring-cloud-vault-config/src/test/resources/cassandra.yaml apache-cassandra-2.2.6/conf
|
||||
- apache-cassandra-2.2.6/bin/cassandra
|
||||
- src/test/bash/create_certificates.sh
|
||||
- src/test/bash/install_vault.sh
|
||||
@@ -33,4 +33,4 @@ after_script:
|
||||
cache:
|
||||
directories:
|
||||
- '$HOME/.m2/repository'
|
||||
- 'download'
|
||||
- 'download'
|
||||
|
||||
18
pom.xml
18
pom.xml
@@ -2,6 +2,14 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-build</artifactId>
|
||||
<version>1.1.0.BUILD-SNAPSHOT</version>
|
||||
<relativePath/>
|
||||
<!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-vault-config-parent</artifactId>
|
||||
@@ -11,18 +19,10 @@
|
||||
<name>spring-cloud-vault-config</name>
|
||||
<description>Configuration Integration with Hashicorp Vault</description>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-build</artifactId>
|
||||
<version>1.1.0.BUILD-SNAPSHOT</version>
|
||||
<relativePath/>
|
||||
<!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
<module>spring-cloud-vault-config</module>
|
||||
<module>docs</module>
|
||||
</modules>
|
||||
</modules>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-vault-config-parent</artifactId>
|
||||
<version>1.0.0.BUILD-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-vault-config</artifactId>
|
||||
@@ -11,13 +18,6 @@
|
||||
<name>spring-cloud-vault-config</name>
|
||||
<description>Configuration Integration with Hashicorp Vault</description>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-vault-config-parent</artifactId>
|
||||
<version>1.0.1.BUILD-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.7</java.version>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.vault.configclient;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
@@ -35,6 +34,10 @@ import org.springframework.cloud.vault.util.VaultRule;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* Integration test using config infrastructure with AppId authentication. In case this test should fail because of SSL
|
||||
* make sure you run the test within the spring-cloud-vault-config/spring-cloud-vault-config directory as the keystore
|
||||
* is referenced with {@code ../work/keystore.jks}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
|
||||
@@ -13,10 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.vault.configclient;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.junit.Assume.*;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
@@ -43,7 +42,11 @@ import com.datastax.driver.core.PlainTextAuthProvider;
|
||||
import com.datastax.driver.core.Session;
|
||||
|
||||
/**
|
||||
* Integration tests using the cassandra secret backend.
|
||||
* Integration tests using the cassandra secret backend. In case this test should fail because of SSL make sure you run
|
||||
* the test within the spring-cloud-vault-config/spring-cloud-vault-config directory as the keystore is referenced with
|
||||
* {@code ../work/keystore.jks}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringApplicationConfiguration(classes = VaultCassandraTests.TestApplication.class)
|
||||
|
||||
@@ -13,23 +13,17 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.vault.configclient;
|
||||
|
||||
import static org.junit.Assume.*;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.junit.Assume.*;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import com.mysql.jdbc.MySQLConnection;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -44,7 +38,11 @@ import org.springframework.cloud.vault.util.VaultRule;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* Integration tests using the mysql secret backend.
|
||||
* Integration tests using the mysql secret backend. In case this test should fail because of SSL make sure you run the
|
||||
* test within the spring-cloud-vault-config/spring-cloud-vault-config directory as the keystore is referenced with
|
||||
* {@code ../work/keystore.jks}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringApplicationConfiguration(classes = VaultMySqlTests.TestApplication.class)
|
||||
|
||||
@@ -42,7 +42,11 @@ import org.springframework.cloud.vault.util.VaultRule;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* Integration tests using the postgresql secret backend.
|
||||
* Integration tests using the postgresql secret backend. In case this test should fail because of SSL make sure you run
|
||||
* the test within the spring-cloud-vault-config/spring-cloud-vault-config directory as the keystore is referenced with
|
||||
* {@code ../work/keystore.jks}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringApplicationConfiguration(classes = VaultPostgreSqlTests.TestApplication.class)
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.vault.configclient;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
@@ -30,6 +29,13 @@ import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
import org.springframework.cloud.vault.util.VaultRule;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* Integration test using config infrastructure with token authentication. In case this test should fail because of SSL
|
||||
* make sure you run the test within the spring-cloud-vault-config/spring-cloud-vault-config directory as the keystore
|
||||
* is referenced with {@code ../work/keystore.jks}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringApplicationConfiguration(classes = VaultTests.TestApplication.class)
|
||||
public class VaultTests {
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.cloud.vault.util;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.springframework.cloud.vault.VaultProperties;
|
||||
import org.springframework.cloud.vault.VaultToken;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
@@ -27,24 +29,41 @@ import org.springframework.core.io.FileSystemResource;
|
||||
public class Settings {
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the vault properties.
|
||||
*/
|
||||
public static VaultProperties createVaultProperties() {
|
||||
|
||||
File workDir = findWorkDir(new File(System.getProperty("user.dir")));
|
||||
|
||||
VaultProperties vaultProperties = new VaultProperties();
|
||||
vaultProperties.getSsl().setTrustStorePassword("changeit");
|
||||
vaultProperties.getSsl().setTrustStore(new FileSystemResource("work/keystore.jks"));
|
||||
vaultProperties.getSsl().setTrustStore(new FileSystemResource(new File(workDir, "keystore.jks")));
|
||||
vaultProperties.setToken(token().getToken());
|
||||
|
||||
return vaultProperties;
|
||||
}
|
||||
|
||||
private static File findWorkDir(File file) {
|
||||
|
||||
File searchLevel = file;
|
||||
while (searchLevel.getParentFile() != null && searchLevel.getParentFile() != searchLevel) {
|
||||
|
||||
File work = new File(searchLevel, "work");
|
||||
if (work.isDirectory() && work.exists()) {
|
||||
return work;
|
||||
}
|
||||
|
||||
searchLevel = searchLevel.getParentFile();
|
||||
}
|
||||
|
||||
throw new IllegalStateException(
|
||||
String.format("Cannot find work directory in %s or any parent directories", file.getAbsoluteFile()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the token to use during tests.
|
||||
*/
|
||||
public static VaultToken token() {
|
||||
return VaultToken.of(System.getProperty("vault.token",
|
||||
"00000000-0000-0000-0000-000000000000"));
|
||||
return VaultToken.of(System.getProperty("vault.token", "00000000-0000-0000-0000-000000000000"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
spring:
|
||||
application.name: testVaultApp
|
||||
cloud.vault.token: 00000000-0000-0000-0000-000000000000
|
||||
cloud.vault.ssl.trust-store: file:work/keystore.jks
|
||||
cloud.vault.ssl.trust-store: file:../work/keystore.jks
|
||||
cloud.vault.ssl.trust-store-password: changeit
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
###########################################################################
|
||||
|
||||
BASEDIR=`dirname $0`/../../..
|
||||
./vault/vault server -config=${BASEDIR}/src/test/resources/vault.conf
|
||||
./vault/vault server -config=${BASEDIR}/spring-cloud-vault-config/src/test/resources/vault.conf
|
||||
exit $?
|
||||
Reference in New Issue
Block a user