Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

test(secret-sync): drop three redundant recursive e2e tests

Calvin718ee002b161
diff --git a/backend/e2e-test/routes/v1/secret-sync-recursive.spec.ts b/backend/e2e-test/routes/v1/secret-sync-recursive.spec.ts
index 8a717c7cf1..e94aa1c4c4 100644
--- a/backend/e2e-test/routes/v1/secret-sync-recursive.spec.ts
+++ b/backend/e2e-test/routes/v1/secret-sync-recursive.spec.ts
@@ -133,12 +133,6 @@ describe("A secret sync is refused when it would read a folder the actor cannot"
expect(error.message).toContain("/backend/api");
});
- test("creating the same sync without subfolders succeeds", async () => {
- const { secretSync } = await newSync({ name: "non-recursive-allowed", recursive: false });
-
- expect(secretSync).toEqual(expect.objectContaining({ name: "non-recursive-allowed" }));
- });
-
test("repointing an existing recursive sync at another destination is refused", async () => {
// The admin can read the whole subtree, so this sync is legitimate at the moment it is made.
// The Manage grant then gives the actor Edit on it, scoped to "/backend", while leaving
@@ -321,12 +315,6 @@ describe("A recursive secret sync is refused when two folders use the same secre
expect(secretSyncs.map((sync) => sync.name)).not.toContain("recursive-duplicate");
});
- test("creating the same sync without subfolders succeeds", async () => {
- const { secretSync } = await newSync({ name: "non-recursive-duplicate", recursive: false });
-
- expect(secretSync).toEqual(expect.objectContaining({ name: "non-recursive-duplicate" }));
- });
-
// The two tests below pin the same rule from opposite sides: the checks an update runs read the
// sync options that update is about to store. Reading the request alone misses that an absent
// syncOptions leaves the stored ones in place; reading the stored row alone misses that a
@@ -387,7 +375,7 @@ describe("A recursive secret sync is refused when two folders use the same secre
});
});
-describe("A write in a subfolder triggers only the recursive sync above it", async () => {
+describe("A write in a subfolder reaches the recursive sync above it", async () => {
vi.setConfig({ testTimeout: 30_000, hookTimeout: 30_000 });
// Each test waits for the auto-sync-enable run to finish (via waitForSyncRun) before writing the
@@ -417,8 +405,7 @@ describe("A write in a subfolder triggers only the recursive sync above it", asy
for (const folder of [
{ secretPath: "/", name: "backend" },
- { secretPath: "/backend", name: "api" },
- { secretPath: "/backend", name: "web" }
+ { secretPath: "/backend", name: "api" }
]) {
// eslint-disable-next-line no-await-in-loop
await createFolder({
@@ -478,84 +465,4 @@ describe("A write in a subfolder triggers only the recursive sync above it", asy
expected: { SUBFOLDER_KEY: "subfolder-value" }
});
});
-
- test("a write at a subfolder does not reach a non-recursive sync rooted above it", async () => {
- const destinationPath = "/non-recursive-trigger-target/";
- const controlDestinationPath = "/non-recursive-trigger-control/";
-
- const { secretSync } = await createSecretSync({
- name: "non-recursive-trigger",
- projectId,
- connectionId,
- environmentSlug: ENV,
- secretPath: "/backend",
- region: REGION,
- destinationPath,
- initialSyncBehavior: SecretSyncInitialSyncBehavior.OverwriteDestination,
- recursive: false,
- isAutoSyncEnabled: false,
- authToken: adminToken
- });
-
- // A control sync rooted exactly on the folder that is about to change. Its own trigger is
- // the ordinary exact-match path, unaffected by the change under test, so waiting for it to
- // pick up the write below gives a real signal that the queue has processed that write and
- // made its trigger decisions for every sync watching the project, including the
- // non-recursive one. Asserting against that signal, rather than a fixed delay, means a
- // reintroduced over-trigger bug cannot hide behind a slow CI runner.
- const { secretSync: controlSync } = await createSecretSync({
- name: "non-recursive-trigger-control",
- projectId,
- connectionId,
- environmentSlug: ENV,
- secretPath: "/backend/web",
- region: REGION,
- destinationPath: controlDestinationPath,
- initialSyncBehavior: SecretSyncInitialSyncBehavior.OverwriteDestination,
- recursive: false,
- isAutoSyncEnabled: false,
- authToken: adminToken
- });
-
- const runCountBeforeEnable = fakeParameterStore.at(REGION, destinationPath).runCount();
- await setAutoSync({ syncId: secretSync!.id, isAutoSyncEnabled: true, authToken: adminToken });
- await waitForSyncRun({
- syncId: secretSync!.id,
- region: REGION,
- destinationPath,
- runCountBefore: runCountBeforeEnable,
- authToken: adminToken
- });
-
- expect(fakeParameterStore.at(REGION, destinationPath).read()).toEqual({});
-
- const controlRunCountBeforeEnable = fakeParameterStore.at(REGION, controlDestinationPath).runCount();
- await setAutoSync({ syncId: controlSync!.id, isAutoSyncEnabled: true, authToken: adminToken });
- await waitForSyncRun({
- syncId: controlSync!.id,
- region: REGION,
- destinationPath: controlDestinationPath,
- runCountBefore: controlRunCountBeforeEnable,
- authToken: adminToken
- });
-
- expect(fakeParameterStore.at(REGION, controlDestinationPath).read()).toEqual({});
-
- await createSecretV2({
- authToken: adminToken,
- workspaceId: projectId,
- environmentSlug: ENV,
- secretPath: "/backend/web",
- key: "WEB_KEY",
- value: "web-value"
- });
-
- await waitForDestinationSecrets({
- region: REGION,
- destinationPath: controlDestinationPath,
- expected: { WEB_KEY: "web-value" }
- });
-
- expect(fakeParameterStore.at(REGION, destinationPath).read()).toEqual({});
- });
});