Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
test(e2e): address review on the fake-backed tests
varonix00f8db47905f
diff --git a/tests/suites/secretmanager/honeytokens/helpers_test.go b/tests/suites/secretmanager/honeytokens/helpers_test.goindex 50bd9d162c..9891f52c7b 100644--- a/tests/suites/secretmanager/honeytokens/helpers_test.go+++ b/tests/suites/secretmanager/honeytokens/helpers_test.go@@ -111,15 +111,15 @@ func (e env) newHoneyToken(t *testing.T) uuid.UUID {return res.JSON200.HoneyToken.Id}-// planted is the access key id the mapped secrets hold.-func (e env) planted(t *testing.T) string {+// planted is the value one mapped secret holds.+func (e env) planted(t *testing.T, key string) string {t.Helper()for _, s := range secretmanager.ListSecrets(t, e.proj, "dev") {- if s.Key == accessKeyIDKey {+ if s.Key == key {return s.Value}}- t.Fatalf("the mapped secret %s is missing", accessKeyIDKey)+ require.Failf(t, "mapped secret missing", "the mapped secret %s is missing", key)return ""}diff --git a/tests/suites/secretmanager/honeytokens/honeytoken_test.go b/tests/suites/secretmanager/honeytokens/honeytoken_test.goindex 53a60dab1c..039c3b473f 100644--- a/tests/suites/secretmanager/honeytokens/honeytoken_test.go+++ b/tests/suites/secretmanager/honeytokens/honeytoken_test.go@@ -29,7 +29,8 @@ func TestHoneyToken_Create(t *testing.T) {require.Len(t, users, 1)for _, u := range users {require.Len(t, u.AccessKeys, 1)- require.Equal(t, u.AccessKeys[0].AccessKeyID, e.planted(t))+ require.Equal(t, u.AccessKeys[0].AccessKeyID, e.planted(t, accessKeyIDKey))+ require.Equal(t, u.AccessKeys[0].SecretAccessKey, e.planted(t, secretAccessKeyKey))}require.ElementsMatch(t, []string{accessKeyIDKey, secretAccessKeyKey}, e.secretKeys(t))})@@ -62,7 +63,7 @@ func TestHoneyToken_Trigger(t *testing.T) {tokenID := e.newHoneyToken(t)// Action- res := e.trigger(t, e.planted(t), e.signingKey)+ res := e.trigger(t, e.planted(t, accessKeyIDKey), e.signingKey)// Assertrequire.Equalf(t, http.StatusOK, res.StatusCode(), "%s", apierr.Body(res.Body))@@ -79,7 +80,7 @@ func TestHoneyToken_Trigger(t *testing.T) {tokenID := e.newHoneyToken(t)// Action- res := e.trigger(t, e.planted(t), randomHex(t, 32))+ res := e.trigger(t, e.planted(t, accessKeyIDKey), randomHex(t, 32))// Assertrequire.Equal(t, http.StatusUnauthorized, res.StatusCode())@@ -117,7 +118,7 @@ func TestHoneyToken_Revoke(t *testing.T) {// Setupe := setup(t)tokenID := e.newHoneyToken(t)- planted := e.planted(t)+ planted := e.planted(t, accessKeyIDKey)e.tn.SetPlan(t, license.Enterprise().Without(license.HoneyTokens))// Action@@ -126,7 +127,7 @@ func TestHoneyToken_Revoke(t *testing.T) {// Assertrequire.Equal(t, http.StatusBadRequest, res.StatusCode())require.Contains(t, apierr.Body(res.Body), "Failed to revoke honey token due to plan restriction")- require.Equal(t, planted, e.planted(t))+ require.Equal(t, planted, e.planted(t, accessKeyIDKey))require.Len(t, e.honeyUsers(t), 1)})}diff --git a/tests/suites/secretmanager/syncs/aws_helpers_test.go b/tests/suites/secretmanager/syncs/aws_helpers_test.goindex 4a6a4f5619..8650ffa70f 100644--- a/tests/suites/secretmanager/syncs/aws_helpers_test.go+++ b/tests/suites/secretmanager/syncs/aws_helpers_test.go@@ -105,6 +105,9 @@ func newAWSSync(tt *testing.T, p *fixture.Project, conn *fixture.AppConnection,if cfg.disableSecretDeletion {options["disableSecretDeletion"] = true}+ if cfg.includeSubFolders {+ options["includeAllSubFolders"] = true+ }if len(cfg.tags) > 0 {tags := []map[string]string{}for k, v := range cfg.tags {@@ -125,6 +128,9 @@ func newAWSSync(tt *testing.T, p *fixture.Project, conn *fixture.AppConnection,require.NoError(tt, err)client := p.Tenant().Admin.API+ if cfg.as != nil {+ client = cfg.as.API+ }var status intvar body []byteif dest.parameterStore {diff --git a/tests/suites/secretmanager/webhooks/delivery_test.go b/tests/suites/secretmanager/webhooks/delivery_test.goindex 745debdb3e..c6f26897d0 100644--- a/tests/suites/secretmanager/webhooks/delivery_test.go+++ b/tests/suites/secretmanager/webhooks/delivery_test.go@@ -218,16 +218,18 @@ func TestWebhook_Delivery(t *testing.T) {proj := fixture.NewProject(t, tn, fixture.WithProjectType("secret-manager"))secretmanager.CreateFolder(t, proj, "dev", "/shared")secretmanager.CreateFolder(t, proj, "dev", "/app")- secretmanager.CreateImport(t, proj, "dev", secretmanager.Location{Env: "dev", Path: "/shared"},- secretmanager.IntoPath("/app"))sink := fixture.NewWebhookSink(t, tn, webhook.Service)newHook(t, proj, sink.URL, atPath("/app"))+ secretmanager.CreateImport(t, proj, "dev", secretmanager.Location{Env: "dev", Path: "/shared"},+ secretmanager.IntoPath("/app"))+ sink.ExpectEvent[webhook.DeliveryReceived](t, event(secretModified), importBudget)+ mark := sink.Mark(t)// Actionsecretmanager.CreateSecret(t, proj, "dev", "SHARED_KEY", "value", secretmanager.WithPath("/shared"))// Assert- got := sink.ExpectEvent[webhook.DeliveryReceived](t, event(secretModified), importBudget)+ got := sink.ExpectEvent[webhook.DeliveryReceived](t, event(secretModified), importBudget, fakenet.Since(mark))require.Equal(t, "/app", decodeGeneral(t, got.Delivery).Project.SecretPath)})}