feat: Adds output values to some of the commands to allow them to be piped into other commands
This commit is contained in:
@@ -151,11 +151,13 @@ struct PlaybookClientTests: TestCase {
|
||||
} run: {
|
||||
@Dependency(\.playbookClient) var playbookClient
|
||||
|
||||
try await playbookClient.run.generateTemplate(.init(
|
||||
let output = try await playbookClient.run.generateTemplate(.init(
|
||||
shared: Self.sharedRunOptions,
|
||||
templateDirectory: "/template"
|
||||
))
|
||||
|
||||
#expect(output == "/template")
|
||||
|
||||
} assert: { output in
|
||||
|
||||
let expected = [
|
||||
|
||||
@@ -19,13 +19,20 @@ struct VaultClientTests: TestCase {
|
||||
} run: {
|
||||
@Dependency(\.vaultClient) var vaultClient
|
||||
|
||||
try await vaultClient.run(.init(
|
||||
.decrypt,
|
||||
let output = try await vaultClient.run.decrypt(.init(
|
||||
extraOptions: input.extraOptions,
|
||||
loggingOptions: Self.loggingOptions,
|
||||
outputFilePath: input.outputFilePath,
|
||||
vaultFilePath: input.vaultFilePath
|
||||
))
|
||||
|
||||
if let outputFilePath = input.outputFilePath {
|
||||
#expect(output == outputFilePath)
|
||||
} else if let vaultFilePath = input.vaultFilePath {
|
||||
#expect(output == vaultFilePath)
|
||||
} else {
|
||||
#expect(output == "/vault.yml")
|
||||
}
|
||||
} assert: { options in
|
||||
|
||||
#expect(options.arguments == input.expected(.decrypt))
|
||||
@@ -43,13 +50,21 @@ struct VaultClientTests: TestCase {
|
||||
} run: {
|
||||
@Dependency(\.vaultClient) var vaultClient
|
||||
|
||||
try await vaultClient.run(.init(
|
||||
.encrypt,
|
||||
let output = try await vaultClient.run.encrypt(.init(
|
||||
extraOptions: input.extraOptions,
|
||||
loggingOptions: Self.loggingOptions,
|
||||
outputFilePath: input.outputFilePath,
|
||||
vaultFilePath: input.vaultFilePath
|
||||
))
|
||||
|
||||
if let outputFilePath = input.outputFilePath {
|
||||
#expect(output == outputFilePath)
|
||||
} else if let vaultFilePath = input.vaultFilePath {
|
||||
#expect(output == vaultFilePath)
|
||||
} else {
|
||||
#expect(output == "/vault.yml")
|
||||
}
|
||||
|
||||
} assert: { options in
|
||||
#expect(options.arguments == input.expected(.encrypt))
|
||||
}
|
||||
@@ -75,7 +90,7 @@ struct TestOptions: Sendable {
|
||||
self.vaultFilePath = vaultFilePath
|
||||
}
|
||||
|
||||
func expected(_ route: VaultClient.RunOptions.Route) -> [String] {
|
||||
func expected(_ route: VaultClient.Route) -> [String] {
|
||||
var expected = [
|
||||
"ansible-vault", "\(route.verb)"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user