You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by kr...@apache.org on 2019/03/19 18:23:28 UTC
[knox] branch master updated: KNOX-1830 - Fix sporadic Illegal
character error in TestHashicorpVaultAliasService
This is an automated email from the ASF dual-hosted git repository.
krisden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git
The following commit(s) were added to refs/heads/master by this push:
new 8f5c00d KNOX-1830 - Fix sporadic Illegal character error in TestHashicorpVaultAliasService
8f5c00d is described below
commit 8f5c00ddc979e9ae4edef527140874a980d46ffe
Author: Kevin Risden <kr...@apache.org>
AuthorDate: Tue Mar 19 13:55:55 2019 -0400
KNOX-1830 - Fix sporadic Illegal character error in TestHashicorpVaultAliasService
When using test containers, the vault container stdout would
sometimes have newlines and spaces in the output. This is an
invalid token so replace whitespace in token output.
Signed-off-by: Kevin Risden <kr...@apache.org>
---
.../backend/hashicorp/vault/TestHashicorpVaultAliasService.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/gateway-service-hashicorp-vault/src/test/java/org/apache/knox/gateway/backend/hashicorp/vault/TestHashicorpVaultAliasService.java b/gateway-service-hashicorp-vault/src/test/java/org/apache/knox/gateway/backend/hashicorp/vault/TestHashicorpVaultAliasService.java
index 85a0186..ea61f2c 100644
--- a/gateway-service-hashicorp-vault/src/test/java/org/apache/knox/gateway/backend/hashicorp/vault/TestHashicorpVaultAliasService.java
+++ b/gateway-service-hashicorp-vault/src/test/java/org/apache/knox/gateway/backend/hashicorp/vault/TestHashicorpVaultAliasService.java
@@ -120,14 +120,17 @@ public class TestHashicorpVaultAliasService {
}
private String getKnoxToken(boolean forceKnoxSpecifcToken) throws Exception {
+ String token;
if(forceKnoxSpecifcToken) {
LOG.info("Using Knox specific token");
Container.ExecResult tokenCreationExecResult = vaultContainer.execInContainer("vault", "token",
"create", "-policy=" + getVaultPolicy(), "-field=token");
- return tokenCreationExecResult.getStdout().trim();
+ token = tokenCreationExecResult.getStdout().replaceAll("\\s", "").trim();
+ } else {
+ LOG.info("Using root token");
+ token = vaultToken;
}
- LOG.info("Using root token");
- return vaultToken;
+ return token;
}
private String getVaultPolicy() {