Skip to content

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

feat: added test to ci

=5f9448598320
diff --git a/.github/workflows/run-blackbox-tests.yml b/.github/workflows/run-blackbox-tests.yml
new file mode 100644
index 0000000000..81e9d1fac0
--- /dev/null
+++ b/.github/workflows/run-blackbox-tests.yml
@@ -0,0 +1,99 @@
+name: "Run blackbox tests"
+
+on:
+ pull_request:
+ types: [opened, synchronize]
+ paths:
+ - "backend/**"
+ - "!backend/README.md"
+ - "tests/**"
+ - "build-versions.env"
+ - ".github/workflows/run-blackbox-tests.yml"
+
+concurrency:
+ group: run-blackbox-tests-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ lint-and-unit:
+ name: Lint and unit tests
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ defaults:
+ run:
+ working-directory: tests
+ steps:
+ - name: ☁️ Checkout source
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+
+ - name: 🔧 Setup Go
+ uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
+ with:
+ go-version-file: tests/go.mod
+ cache-dependency-path: tests/go.sum
+
+ - name: Lint
+ run: make lint
+
+ - name: Unit tests
+ run: make test-unit
+
+ suites:
+ name: Suites
+ runs-on: ubuntu-latest
+ needs: lint-and-unit
+ timeout-minutes: 60
+ steps:
+ - name: Free up disk space
+ uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
+ with:
+ tool-cache: true
+ android: true
+ dotnet: true
+ haskell: true
+ large-packages: false
+ swap-storage: true
+ docker-images: true
+
+ - name: ☁️ Checkout source
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+
+ - name: 🔧 Setup Go
+ uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
+ with:
+ go-version-file: tests/go.mod
+ cache-dependency-path: tests/go.sum
+
+ - name: Read pinned versions
+ run: grep -E '^[A-Z_]+=' build-versions.env >> "$GITHUB_ENV"
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
+
+ - name: Build backend image
+ uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
+ with:
+ context: backend
+ file: backend/Dockerfile
+ load: true
+ tags: infisical-test:ci
+ build-args: |
+ INFISICAL_CLI_VERSION=${{ env.INFISICAL_CLI_VERSION }}
+ cache-from: type=gha,scope=infisical-blackbox-backend
+ cache-to: type=gha,mode=max,scope=infisical-blackbox-backend
+
+ - name: Run suites
+ run: make test-all
+ working-directory: tests
+ env:
+ INFISICAL_TEST_IMAGE: infisical-test:ci
+
+ - name: Upload container logs
+ if: failure()
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: blackbox-logs-${{ github.run_id }}
+ path: tests/**/.logs/
+ include-hidden-files: true
+ retention-days: 3
+ if-no-files-found: warn
diff --git a/tests/CLAUDE.md b/tests/CLAUDE.md
index eba91fac6b..e666291907 100644
--- a/tests/CLAUDE.md
+++ b/tests/CLAUDE.md
@@ -58,6 +58,10 @@ make down
server. Run `make down` after changing anything about a container's configuration, or a
stale one is adopted and your change does not take effect.
+CI (`run-blackbox-tests.yml`, on PRs only) builds the same `backend/Dockerfile` with a
+layer cache and hands it over through `INFISICAL_TEST_IMAGE`, so the harness skips its
+own build.
+
## 3. Where things go
```
diff --git a/tests/harness/infisical/infisical.go b/tests/harness/infisical/infisical.go
index d396138f1f..6b3922dbb1 100644
--- a/tests/harness/infisical/infisical.go
+++ b/tests/harness/infisical/infisical.go
@@ -91,6 +91,7 @@ func (m *module) Start(ctx context.Context, d infra.Deps) (infra.Handle, error)
"REDIS_URL": redis.MustFrom(d).URL(infra.Internal),
"AUTH_SECRET": authSecret,
"ENCRYPTION_KEY": encryptionKey,
+ "PORT": fmt.Sprint(port),
"NODE_ENV": "production",
"TELEMETRY_ENABLED": "false",
// Serve every route and every field at /api/docs/json. The suite generates