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
tests: create a Kubernetes-authenticated gateway
Claude9d61990b3dc7
diff --git a/tests/suites/gateway/gateway_test.go b/tests/suites/gateway/gateway_test.goindex c8d0bfa7be..d6bcdf2919 100644--- a/tests/suites/gateway/gateway_test.go+++ b/tests/suites/gateway/gateway_test.go@@ -5,6 +5,8 @@ import ("testing""github.com/Infisical/infisical/tests/clients/api"+ "github.com/Infisical/infisical/tests/fakes/kubernetes"+ "github.com/Infisical/infisical/tests/fixture""github.com/Infisical/infisical/tests/harness""github.com/google/uuid""github.com/stretchr/testify/require"@@ -60,6 +62,31 @@ func TestGateway_Create(t *testing.T) {})}+ t.Run("should create a gateway that authenticates with kubernetes against the cluster it names", func(t *testing.T) {+ t.Parallel()++ // Setup+ tn := h.NewTenant(t)+ cluster := kubernetes.Open(t, fixture.FakenetAdmin(t, tn))+ name := gatewayName()++ // Action+ res := createGateway(t, tn.Admin.API, name, map[string]any{+ "method": "kubernetes",+ "kubernetesHost": kubernetes.Service.URL(),+ "tokenReviewerJwt": cluster.ReviewerJWT,+ "allowedNamespaces": "infisical",+ "allowedNames": "gateway",+ })++ // Assert+ requireStatus(t, http.StatusOK, res.StatusCode(), res.Body)+ stored := getGateway(t, tn, decodeGateway(t, res.Body).ID)+ require.Equal(t, "kubernetes", stored.AuthMethod.Method)+ require.Equal(t, "infisical", stored.AuthMethod.Config["allowedNamespaces"])+ require.Equal(t, "gateway", stored.AuthMethod.Config["allowedNames"])+ })+invalid := []struct {name stringauthMethod map[string]any