Skip to content

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

test(e2e): give replication waits a minute on busy runners

varonix885c8d2816f8
diff --git a/tests/suites/secretmanager/folders/list_test.go b/tests/suites/secretmanager/folders/list_test.go
index f8d67aae83..d02dc05619 100644
--- a/tests/suites/secretmanager/folders/list_test.go
+++ b/tests/suites/secretmanager/folders/list_test.go
@@ -3,6 +3,7 @@ package folders_test
import (
"net/http"
"testing"
+ "time"
"github.com/Infisical/infisical/tests/clients/api"
"github.com/Infisical/infisical/tests/fixture"
@@ -66,13 +67,14 @@ func TestFolder_List(t *testing.T) {
secretmanager.CreateSecret(t, proj, "prod", "SHARED_KEY", "from-prod")
secretmanager.CreateFolder(t, proj, "dev", "/app")
secretmanager.CreateImport(t, proj, "dev", secretmanager.Location{Env: "prod", Path: "/"}, secretmanager.Replicated())
+ // One worker serves every tenant's replication jobs, so a run can queue behind others.
wait.Until(t, "the replicated import to carry the source secret", func() bool {
res, err := tn.Admin.API.ListSecretsV4WithResponse(t.Context(), &api.ListSecretsV4Params{
ProjectId: &proj.ID, Environment: new("dev"),
})
return err == nil && res.JSON200 != nil && res.JSON200.Imports != nil &&
len(*res.JSON200.Imports) == 1 && len((*res.JSON200.Imports)[0].Secrets) == 1
- })
+ }, wait.Timeout(60*time.Second))
// Action
flat := folderNames(t, proj, "dev", "/")
diff --git a/tests/suites/secretmanager/history/redaction_test.go b/tests/suites/secretmanager/history/redaction_test.go
index c62cdb895f..dd6309cc07 100644
--- a/tests/suites/secretmanager/history/redaction_test.go
+++ b/tests/suites/secretmanager/history/redaction_test.go
@@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
"testing"
+ "time"
"github.com/Infisical/infisical/tests/clients/api"
"github.com/Infisical/infisical/tests/fixture"
@@ -162,6 +163,7 @@ func TestSecretVersion_Redact(t *testing.T) {
func replicatedSecretID(t *testing.T, proj *fixture.Project, env, key string) string {
t.Helper()
var id string
+ // One worker serves every tenant's replication jobs, so a run can queue behind others.
wait.Until(t, fmt.Sprintf("%s to be replicated into %s", key, env), func() bool {
res, err := proj.Tenant().Admin.API.ListSecretsV4WithResponse(t.Context(), &api.ListSecretsV4Params{
ProjectId: &proj.ID,
@@ -180,6 +182,6 @@ func replicatedSecretID(t *testing.T, proj *fixture.Project, env, key string) st
}
}
return false
- })
+ }, wait.Timeout(60*time.Second))
return id
}
diff --git a/tests/suites/secretmanager/imports/helpers_test.go b/tests/suites/secretmanager/imports/helpers_test.go
index a628b48381..a0f994ae9c 100644
--- a/tests/suites/secretmanager/imports/helpers_test.go
+++ b/tests/suites/secretmanager/imports/helpers_test.go
@@ -149,6 +149,11 @@ func repoint(t *testing.T, actor *harness.Principal, proj *fixture.Project, env,
return res
}
+// replicationBudget is longer than the default wait because one worker serves every
+// tenant's replication jobs, and a job that meets a lock retries with backoff, so a run
+// queues behind others on a busy runner.
+var replicationBudget = wait.Timeout(60 * time.Second)
+
// waitReplicated waits until a replication import records a run newer than after, then
// requires that run to have succeeded. It returns the run's time, for the next wait.
//
@@ -165,7 +170,7 @@ func waitReplicated(t *testing.T, proj *fixture.Project, env, folderPath, import
}
}
return false
- })
+ }, replicationBudget)
require.Truef(t, last.ReplicationOK, "replication failed: %s", last.ReplicationStatus)
return *last.LastReplicated
}