Skip to content

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

tests: build fakenet without VCS stamping; document new fakes and harness options

Claude78f9da25f640
diff --git a/tests/AGENTS.md b/tests/AGENTS.md
index 24f616cb2d..02722dbaa6 100644
--- a/tests/AGENTS.md
+++ b/tests/AGENTS.md
@@ -50,7 +50,8 @@ configuration, or the old container is reused.
## Layout
```
-suites/ product behaviour, grouped by product (suites/secretmanager/secrets)
+suites/ behaviour, grouped by product (suites/secretmanager/secrets) or
+ platform area (suites/machineidentity, suites/user, suites/group)
harnesstest/ harness behaviour; only for failures the harness alone can cause
harness/ Stack, Profile, Tenant, Principal
fixture/ platform resources: projects, App Connections
diff --git a/tests/docs/fakes.md b/tests/docs/fakes.md
index 0e37832458..7d2a13797d 100644
--- a/tests/docs/fakes.md
+++ b/tests/docs/fakes.md
@@ -104,6 +104,25 @@ type SecretDeleted struct{ SecretDetail }
func (SecretDeleted) EventName() string { return "github.secret-deleted" }
```
+## Identity providers
+
+The test plays the workload or the person and holds the credential; the fake plays the
+provider that checks it.
+
+| Fake | Host | Scope | Used by |
+|---|---|---|---|
+| `oidcidp` | `idp.oidc.test/<scope>` | path | OIDC SSO; machine identity OIDC, JWT (jwks) and SPIFFE (`TrustKey` publishes a key the test signs with) |
+| `oauth` | `www.googleapis.com`, `github.com`, `gitlab.com` | authorization code, which is also the access token | Google, GitHub, GitLab login; GCP service account certificates |
+| `kubernetes` | `api.kubernetes.test` | reviewer JWT | machine identity Kubernetes auth (TokenReview) |
+| `aws` | `sts.amazonaws.com`, `sts.us-east-1.amazonaws.com` | access key id | AWS IAM auth (JSON when asked) |
+| `azure` | `login.microsoftonline.com/<tenant>` | tenant id | Azure auth signing keys |
+| `alicloud` | `sts.aliyuncs.com` | access key id | Alibaba Cloud auth (checks the signature) |
+| `oci` | `identity.us-ashburn-1.oraclecloud.com` | signature key id | OCI auth (checks the signature) |
+| `ldap` | LDAP on port 389, any name | `dc=<scope>,dc=ldap,dc=test` | LDAP SSO and machine identity LDAP auth |
+
+LDAP is not HTTP: fakenet serves it on its own listener and finds the directory by the
+DN of each bind or search. Seed it through the admin API like any other fake.
+
## DNS records
Every A query resolves to fakenet. A product that proves domain ownership reads a TXT
diff --git a/tests/docs/writing-tests.md b/tests/docs/writing-tests.md
index 0a9b9b508b..8e034c67b6 100644
--- a/tests/docs/writing-tests.md
+++ b/tests/docs/writing-tests.md
@@ -47,7 +47,12 @@ func TestSecret_Create(t *testing.T) {
| `harness.Isolated` | the package's own Postgres, Redis, and Infisical | the test writes instance-wide state: super-admin config, login methods, encryption strategy, run modes |
`Isolated` costs a full boot per package. Containers the test talks to through Infisical,
-such as a rotation target database, are added with `harness.WithInfra(...)`.
+such as a rotation target database, are added with `harness.WithInfra(...)`. Instance-wide
+environment, such as `RELAY_AUTH_SECRET`, is set with `harness.WithInfisicalEnv(k, v)`,
+which only an `Isolated` package may use.
+
+A container one test owns, such as a relay or gateway agent, is started with
+`h.RunContainer(...)` and stopped when the test ends (`suites/gateway/forwarding_test.go`).
## Structure
diff --git a/tests/infra/fakenet/module.go b/tests/infra/fakenet/module.go
index 8b0f25b05c..6b51ecebac 100644
--- a/tests/infra/fakenet/module.go
+++ b/tests/infra/fakenet/module.go
@@ -80,7 +80,10 @@ func ResolveImage(ctx context.Context, repoRoot string, log infra.Logger) (Image
}
tests := filepath.Join(repoRoot, "tests")
- build := exec.CommandContext(ctx, "go", "build", "-trimpath", "-o", filepath.Join(dir, "fakenet"), "./cmd/fakenet")
+ // -buildvcs=false: the stamped VCS state flips whenever a tracked file is edited,
+ // which would change the binary, rebuild fakenet and replace it under the packages
+ // still running.
+ build := exec.CommandContext(ctx, "go", "build", "-trimpath", "-buildvcs=false", "-o", filepath.Join(dir, "fakenet"), "./cmd/fakenet")
build.Dir = tests
build.Env = append(os.Environ(), "GOOS=linux", "GOARCH="+goarch, "CGO_ENABLED=0")
if out, bErr := build.CombinedOutput(); bErr != nil {