Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
vault: [1password, aws-sm, azure-kv]
task: [check, lint, fmt]
task: [check, lint, fmt, test]
defaults:
run:
working-directory: vault/${{ matrix.vault }}
Expand All @@ -29,6 +29,8 @@ jobs:
deno fmt --check extensions/vaults/
elif [ "${{ matrix.task }}" = "lint" ]; then
deno lint extensions/vaults/
elif [ "${{ matrix.task }}" = "test" ]; then
deno test --allow-env extensions/vaults/
else
deno check extensions/vaults/*.ts
fi
Expand Down
2 changes: 1 addition & 1 deletion vault/1password/.swamp.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
swampVersion: 20260206.200442.0
initializedAt: '2026-03-17T18:26:56.550Z'
initializedAt: "2026-03-17T18:26:56.550Z"
repoId: 2db600a8-1df3-4e50-a855-ae339aa9c337
tool: claude
gitignoreManaged: true
13 changes: 13 additions & 0 deletions vault/1password/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 78 additions & 0 deletions vault/1password/extensions/vaults/onepassword_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// Swamp, an Automation Framework
// Copyright (C) 2026 System Initiative, Inc.
//
// This file is part of Swamp.
//
// Swamp is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License version 3
// as published by the Free Software Foundation, with the Swamp
// Extension and Definition Exception (found in the "COPYING-EXCEPTION"
// file).
//
// Swamp is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Swamp. If not, see <https://www.gnu.org/licenses/>.

import {
assertEquals,
assertExists,
assertThrows,
} from "jsr:@std/assert@1.0.19";
import { vault } from "./onepassword.ts";

Deno.test("vault export has correct metadata", () => {
assertEquals(vault.type, "@swamp/1password");
assertEquals(vault.name, "1Password");
assertExists(vault.description);
assertExists(vault.configSchema);
assertEquals(typeof vault.createProvider, "function");
});

Deno.test("configSchema validates valid config", () => {
const result = vault.configSchema.safeParse({ op_vault: "Engineering" });
assertEquals(result.success, true);
});

Deno.test("configSchema validates config with op_account", () => {
const result = vault.configSchema.safeParse({
op_vault: "Engineering",
op_account: "my-team.1password.com",
});
assertEquals(result.success, true);
});

Deno.test("configSchema rejects empty op_vault", () => {
const result = vault.configSchema.safeParse({ op_vault: "" });
assertEquals(result.success, false);
});

Deno.test("configSchema rejects missing op_vault", () => {
const result = vault.configSchema.safeParse({});
assertEquals(result.success, false);
});

Deno.test("createProvider returns a provider with getName", () => {
const provider = vault.createProvider("my-vault", {
op_vault: "Engineering",
});
assertEquals(provider.getName(), "my-vault");
});

Deno.test("createProvider accepts op_account", () => {
const provider = vault.createProvider("my-vault", {
op_vault: "Engineering",
op_account: "my-team.1password.com",
});
assertEquals(provider.getName(), "my-vault");
});

Deno.test("createProvider throws on invalid config", () => {
assertThrows(
() => vault.createProvider("bad-vault", {}),
Error,
);
});
2 changes: 1 addition & 1 deletion vault/aws-sm/.swamp.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
swampVersion: 20260206.200442.0
initializedAt: '2026-03-17T18:27:48.104Z'
initializedAt: "2026-03-17T18:27:48.104Z"
repoId: 299d5c14-f171-4c04-9f42-ad837a77c05b
tool: claude
gitignoreManaged: true
55 changes: 55 additions & 0 deletions vault/aws-sm/extensions/vaults/aws_sm_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Swamp, an Automation Framework
// Copyright (C) 2026 System Initiative, Inc.
//
// This file is part of Swamp.
//
// Swamp is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License version 3
// as published by the Free Software Foundation, with the Swamp
// Extension and Definition Exception (found in the "COPYING-EXCEPTION"
// file).
//
// Swamp is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Swamp. If not, see <https://www.gnu.org/licenses/>.

import {
assertEquals,
assertExists,
assertThrows,
} from "jsr:@std/assert@1.0.19";
import { vault } from "./aws_sm.ts";

Deno.test("vault export has correct metadata", () => {
assertEquals(vault.type, "@swamp/aws-sm");
assertEquals(vault.name, "AWS Secrets Manager");
assertExists(vault.description);
assertExists(vault.configSchema);
assertEquals(typeof vault.createProvider, "function");
});

Deno.test("configSchema validates valid config", () => {
const result = vault.configSchema.safeParse({ region: "us-east-1" });
assertEquals(result.success, true);
});

Deno.test("configSchema rejects empty region", () => {
const result = vault.configSchema.safeParse({ region: "" });
assertEquals(result.success, false);
});

Deno.test("configSchema rejects missing region", () => {
const result = vault.configSchema.safeParse({});
assertEquals(result.success, false);
});

Deno.test("createProvider throws on invalid config", () => {
assertThrows(
() => vault.createProvider("bad-vault", {}),
Error,
);
});
2 changes: 1 addition & 1 deletion vault/azure-kv/.swamp.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
swampVersion: 20260206.200442.0
initializedAt: '2026-03-17T18:28:02.387Z'
initializedAt: "2026-03-17T18:28:02.387Z"
repoId: 19364e34-a63d-46c2-8836-ed8eefd9c53f
tool: claude
gitignoreManaged: true
65 changes: 65 additions & 0 deletions vault/azure-kv/extensions/vaults/azure_kv_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Swamp, an Automation Framework
// Copyright (C) 2026 System Initiative, Inc.
//
// This file is part of Swamp.
//
// Swamp is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License version 3
// as published by the Free Software Foundation, with the Swamp
// Extension and Definition Exception (found in the "COPYING-EXCEPTION"
// file).
//
// Swamp is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Swamp. If not, see <https://www.gnu.org/licenses/>.

import {
assertEquals,
assertExists,
assertThrows,
} from "jsr:@std/assert@1.0.19";
import { vault } from "./azure_kv.ts";

Deno.test("vault export has correct metadata", () => {
assertEquals(vault.type, "@swamp/azure-kv");
assertEquals(vault.name, "Azure Key Vault");
assertExists(vault.description);
assertExists(vault.configSchema);
assertEquals(typeof vault.createProvider, "function");
});

Deno.test("configSchema validates valid config", () => {
const result = vault.configSchema.safeParse({
vault_url: "https://myvault.vault.azure.net/",
});
assertEquals(result.success, true);
});

Deno.test("configSchema validates config with secret_prefix", () => {
const result = vault.configSchema.safeParse({
vault_url: "https://myvault.vault.azure.net/",
secret_prefix: "swamp/",
});
assertEquals(result.success, true);
});

Deno.test("configSchema rejects invalid vault_url", () => {
const result = vault.configSchema.safeParse({ vault_url: "not-a-url" });
assertEquals(result.success, false);
});

Deno.test("configSchema rejects missing vault_url", () => {
const result = vault.configSchema.safeParse({});
assertEquals(result.success, false);
});

Deno.test("createProvider throws on invalid config", () => {
assertThrows(
() => vault.createProvider("bad-vault", {}),
Error,
);
});
Loading