Skip to content

Commit 2f40855

Browse files
committed
Use consistent wording for execVaultCommands thrown err message
1 parent 7a1579a commit 2f40855

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/modules/vault/src/vault-container.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,26 @@ export class StartedVaultContainer extends AbstractStartedContainer {
110110
}
111111

112112
/**
113-
* Executes a list of Vault CLI commands inside the container after it has started.
113+
* Executes Vault CLI commands inside the container after it has started.
114114
*
115115
* This is typically used to pre-configure secret engines or seed test data.
116116
*
117-
* @param commands Array of CLI commands (without `vault` prefix)
117+
* @example
118+
* await container.execVaultCommands([
119+
* "secrets enable transit",
120+
* "write -f transit/keys/my-key",
121+
* "kv put secret/my-secret value=123",
122+
* ]);
123+
*
124+
* @param commands Array of Vault CLI commands (without the `vault` prefix)
125+
* @throws If the command fails (non-zero exit code)
118126
*/
119127
public async execVaultCommands(commands: string[]): Promise<void> {
120128
const cmd = commands.map((c) => `vault ${c}`).join(" && ");
121129
const result = await this.exec(["/bin/sh", "-c", cmd]);
122130

123131
if (result.exitCode !== 0) {
124-
throw new Error(`Vault init commands failed: ${result.output}`);
132+
throw new Error(`execVaultCommands failed with exit code ${result.exitCode}: ${result.output}`);
125133
}
126134
}
127135
}

0 commit comments

Comments
 (0)