Adopt to changed behavior in Spring Cloud Commons.
BootstrapApplicationListener sets spring.application.name so it's no longer possible to override the application name.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration test using config infrastructure with AppId authentication.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* 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
|
||||
@@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@SpringBootTest(classes = VaultConfigAppIdTests.TestApplication.class, properties = {
|
||||
"spring.cloud.vault.authentication=appid",
|
||||
"spring.cloud.vault.app-id.user-id=IP_ADDRESS",
|
||||
"spring.application.name=VaultConfigAppIdTests" })
|
||||
"spring.cloud.vault.application-name=VaultConfigAppIdTests" }) // see https://github.com/spring-cloud/spring-cloud-commons/issues/214
|
||||
public class VaultConfigAppIdTests {
|
||||
|
||||
@BeforeClass
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,7 +49,8 @@ import static org.junit.Assume.assumeTrue;
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = VaultConfigAppRoleTests.TestApplication.class, properties = {
|
||||
"spring.cloud.vault.authentication=approle",
|
||||
"spring.application.name=VaultConfigAppRoleTests" })
|
||||
"spring.cloud.vault.application-name=VaultConfigAppRoleTests" }) // see
|
||||
// https://github.com/spring-cloud/spring-cloud-commons/issues/214
|
||||
public class VaultConfigAppRoleTests {
|
||||
|
||||
@BeforeClass
|
||||
@@ -95,7 +96,8 @@ public class VaultConfigAppRoleTests {
|
||||
.get("role_id");
|
||||
String secretId = (String) vaultOperations
|
||||
.write(String.format("auth/approle/role/with-secret-id/secret-id",
|
||||
"with-secret-id"), null).getData().get("secret_id");
|
||||
"with-secret-id"), null)
|
||||
.getData().get("secret_id");
|
||||
|
||||
System.setProperty("spring.cloud.vault.app-role.role-id", roleId);
|
||||
System.setProperty("spring.cloud.vault.app-role.secret-id", secretId);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -60,7 +60,6 @@ public class VaultConfigGenericBackendDisabledTests {
|
||||
|
||||
@Test
|
||||
public void shouldNotContainVaultProperties() {
|
||||
|
||||
assertThat(environment.containsProperty("vault.value")).isFalse();
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = VaultConfigTests.TestApplication.class, properties = {
|
||||
"spring.cloud.vault.host=foo", "spring.cloud.vault.port=80",
|
||||
"spring.cloud.vault.uri=https://localhost:8200" })
|
||||
"spring.cloud.vault.uri=https://localhost:8200",
|
||||
"spring.cloud.vault.application-name=testVaultApp" }) // see
|
||||
// https://github.com/spring-cloud/spring-cloud-commons/issues/214
|
||||
public class VaultConfigTests {
|
||||
|
||||
@BeforeClass
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,9 +15,6 @@
|
||||
*/
|
||||
package org.springframework.cloud.vault.config;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.springframework.cloud.vault.util.Settings.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
@@ -28,6 +25,7 @@ import org.assertj.core.util.Files;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -37,12 +35,15 @@ import org.springframework.cloud.vault.util.VaultRule;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.vault.core.VaultOperations;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.cloud.vault.util.Settings.findWorkDir;
|
||||
|
||||
/**
|
||||
* Integration test using config infrastructure with TLS certificate 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)
|
||||
@@ -50,7 +51,8 @@ import org.springframework.vault.core.VaultOperations;
|
||||
"spring.cloud.vault.authentication=cert",
|
||||
"spring.cloud.vault.ssl.key-store=file:../work/client-cert.jks",
|
||||
"spring.cloud.vault.ssl.key-store-password=changeit",
|
||||
"spring.application.name=VaultConfigTlsCertAuthenticationTests" })
|
||||
"spring.cloud.vault.application-name=VaultConfigTlsCertAuthenticationTests" }) // see
|
||||
// https://github.com/spring-cloud/spring-cloud-commons/issues/214
|
||||
public class VaultConfigTlsCertAuthenticationTests {
|
||||
|
||||
@BeforeClass
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,7 +43,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = VaultConfigWithContextTests.TestApplication.class)
|
||||
@SpringBootTest(classes = VaultConfigWithContextTests.TestApplication.class, properties = "spring.cloud.vault.application-name=testVaultApp") // see
|
||||
// https://github.com/spring-cloud/spring-cloud-commons/issues/214
|
||||
@ActiveProfiles("my-profile")
|
||||
public class VaultConfigWithContextTests {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user