Skip to content

Commit 5d0631f

Browse files
authored
Deprecate withSecretInVault (#7576)
Use `withInitCommand`
1 parent e84ef48 commit 5d0631f

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

modules/vault/src/main/java/org/testcontainers/vault/VaultContainer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ public SELF withLogLevel(VaultLogLevel level) {
174174
* @param firstSecret first secret to add to specifed path
175175
* @param remainingSecrets var args list of secrets to add to specified path
176176
* @return this
177+
* @deprecated use {@link #withInitCommand(String...)} instead
177178
*/
179+
@Deprecated
178180
public SELF withSecretInVault(String path, String firstSecret, String... remainingSecrets) {
179181
List<String> list = new ArrayList<>();
180182
list.add(firstSecret);

modules/vault/src/test/java/org/testcontainers/vault/VaultContainerTest.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,12 @@ public class VaultContainerTest {
2626
// vaultContainer {
2727
public static VaultContainer<?> vaultContainer = new VaultContainer<>("hashicorp/vault:1.13")
2828
.withVaultToken(VAULT_TOKEN)
29-
.withSecretInVault("secret/testing1", "top_secret=password123")
30-
.withSecretInVault(
31-
"secret/testing2",
32-
"secret_one=password1",
33-
"secret_two=password2",
34-
"secret_three=password3",
35-
"secret_three=password3",
36-
"secret_four=password4"
37-
)
38-
.withInitCommand("secrets enable transit", "write -f transit/keys/my-key");
29+
.withInitCommand(
30+
"secrets enable transit",
31+
"write -f transit/keys/my-key",
32+
"kv put secret/testing1 top_secret=password123",
33+
"kv put secret/testing2 secret_one=password1 secret_two=password2 secret_three=password3 secret_three=password3 secret_four=password4"
34+
);
3935

4036
// }
4137

0 commit comments

Comments
 (0)