first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
+45
@@ -0,0 +1,45 @@
|
||||
import { expect, test } from '../../../../fixtures/base';
|
||||
|
||||
test.use({ capability: 'external-secrets' });
|
||||
test.setTimeout(180_000);
|
||||
|
||||
test.describe(
|
||||
'AWS Secrets Manager with LocalStack @capability:external-secrets @licensed',
|
||||
{
|
||||
annotation: [{ type: 'owner', description: 'Lifecycle & Governance' }],
|
||||
},
|
||||
() => {
|
||||
const PROVIDER_NAME = 'awsSecretsManager';
|
||||
const PROVIDER_SETTINGS = {
|
||||
region: 'us-east-1',
|
||||
authMethod: 'iamUser',
|
||||
accessKeyId: 'test',
|
||||
secretAccessKey: 'test',
|
||||
};
|
||||
|
||||
test.beforeEach(async ({ n8n, services }) => {
|
||||
await services.localstack.secretsManager.clear();
|
||||
await n8n.api.enableFeature('externalSecrets');
|
||||
});
|
||||
|
||||
test('can configure, connect, and sync secrets from LocalStack', async ({ n8n, services }) => {
|
||||
const { secretsManager } = services.localstack;
|
||||
|
||||
await secretsManager.createSecret('api-key', 'secret-123');
|
||||
|
||||
await n8n.api.externalSecrets.saveProviderSettings(PROVIDER_NAME, PROVIDER_SETTINGS);
|
||||
await n8n.api.externalSecrets.testProvider(PROVIDER_NAME, PROVIDER_SETTINGS);
|
||||
await n8n.api.externalSecrets.connectProvider(PROVIDER_NAME);
|
||||
await n8n.api.externalSecrets.updateProvider(PROVIDER_NAME);
|
||||
|
||||
expect(await n8n.api.externalSecrets.getSecrets(PROVIDER_NAME)).toContain('api-key');
|
||||
|
||||
await secretsManager.createSecret('new-secret', 'value-2');
|
||||
await n8n.api.externalSecrets.updateProvider(PROVIDER_NAME);
|
||||
|
||||
const secrets = await n8n.api.externalSecrets.getSecrets(PROVIDER_NAME);
|
||||
expect(secrets).toContain('api-key');
|
||||
expect(secrets).toContain('new-secret');
|
||||
});
|
||||
},
|
||||
);
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
import { expect, test } from '../../../../fixtures/base';
|
||||
|
||||
test.use({ capability: 'external-secrets' });
|
||||
|
||||
// LocalStack can take time to start up
|
||||
test.setTimeout(180_000);
|
||||
|
||||
test.describe(
|
||||
'Secret Providers Connections with LocalStack @capability:external-secrets @licensed',
|
||||
{
|
||||
annotation: [{ type: 'owner', description: 'Lifecycle & Governance' }],
|
||||
},
|
||||
() => {
|
||||
const PROVIDER_KEY = 'aws-localstack-e2e';
|
||||
const PROVIDER_TYPE = 'awsSecretsManager';
|
||||
|
||||
test.beforeEach(async ({ n8n, services }) => {
|
||||
// N8N_ENV_FEAT_EXTERNAL_SECRETS_FOR_PROJECTS is set at container startup
|
||||
// via the external-secrets capability config
|
||||
|
||||
// Enable the external secrets license feature
|
||||
await n8n.api.enableFeature('externalSecrets');
|
||||
|
||||
// Clear any existing secrets from previous tests
|
||||
await services.localstack.secretsManager.clear();
|
||||
});
|
||||
|
||||
test.afterEach(async ({ n8n }) => {
|
||||
// Clean up: delete the test connection if it exists
|
||||
try {
|
||||
await n8n.api.externalSecrets.deleteConnection(PROVIDER_KEY);
|
||||
} catch {
|
||||
// Ignore errors if connection doesn't exist
|
||||
}
|
||||
});
|
||||
|
||||
test('can create a connection pointing to LocalStack', async ({ n8n, services }) => {
|
||||
// Arrange: Seed secrets in LocalStack
|
||||
await services.localstack.secretsManager.createSecret('e2e-api-key', 'secret-123');
|
||||
await services.localstack.secretsManager.createSecret(
|
||||
'e2e-db-credentials',
|
||||
JSON.stringify({ username: 'admin', password: 'hunter2' }),
|
||||
);
|
||||
|
||||
// Verify secrets exist in LocalStack
|
||||
const secrets = await services.localstack.secretsManager.listSecrets();
|
||||
expect(secrets).toContain('e2e-api-key');
|
||||
expect(secrets).toContain('e2e-db-credentials');
|
||||
|
||||
// Act: Create a connection with settings that would work with LocalStack
|
||||
// (n8n container has AWS_ENDPOINT_URL set to point to LocalStack)
|
||||
const created = await n8n.api.externalSecrets.createConnection({
|
||||
providerKey: PROVIDER_KEY,
|
||||
type: PROVIDER_TYPE,
|
||||
projectIds: [],
|
||||
settings: {
|
||||
region: 'us-east-1',
|
||||
authMethod: 'iamUser',
|
||||
accessKeyId: 'test',
|
||||
secretAccessKey: 'test',
|
||||
},
|
||||
});
|
||||
|
||||
// Assert: Connection created successfully
|
||||
expect(created.name).toBe(PROVIDER_KEY);
|
||||
expect(created.type).toBe(PROVIDER_TYPE);
|
||||
|
||||
// TODO - this test should verify that the secrets are loaded - but that functionality is not there yet
|
||||
});
|
||||
},
|
||||
);
|
||||
Reference in New Issue
Block a user