Embedded Vault provides a platform neutral way for running Vault in tests. This library is based on Flapdoodle OSS's embed process.
The artifacts are available on JCenter. Therefore you must add JCenter to your build script repositories:
repositories {
jcenter()
}
Add a Gradle compile dependency to the build.gradle
file of your project:
testCompile 'com.github.golovnin:embedded-vault:0.11.1.0'
Here is the example of how to launch the Vault instance:
VaultServerConfig config = new VaultServerConfig.Builder()
.build();
VaultServerStarter starter = VaultServerStarter.getDefaultInstance();
VaultServerExecutable executable = starter.prepare(config);
VaultServerProcess process = executable.start();
String unsealKey = process.getUnsealKey();
// Execute your tests here
process.stop();
Here is the example of how to launch the Vault instance using a custom version:
VaultServerConfig config = new VaultServerConfig.Builder()
.version("0.7.2")
.build();
VaultServerStarter starter = VaultServerStarter.getDefaultInstance();
VaultServerExecutable executable = starter.prepare(config);
VaultServerProcess process = executable.start();
String unsealKey = process.getUnsealKey();
// Execute your tests here
process.stop();
Versions: 0.11.1 and any custom
Platforms: Mac OS X, FreeBSD, Linux, Solaris and Windows
Copyright (c) 2018, Andrej Golovnin