Skip to content

Conversation

@varonix0
Copy link
Member

@varonix0 varonix0 commented Jan 21, 2026

Description 📣

End to end tests for Infisical Proxy.

We are covering:

  1. Cache Hit/Miss: First request = cache miss, second identical request = cache hit
  2. Mutation Purging: Updating a secret via proxy (PATCH/DELETE) purges related cache entries
  3. Token Invalidation: Access token validation loop runs periodically and remove any cached entries associated with expired access tokens
  4. High availability: Cache serves secrets when the backend is down
  5. Background refresh: Secrets updated directly in Infisical are eventually refreshed in cache
  6. Multiple secret creation: Multiple secrets can be created and retrieved through proxy
  7. Retrieve single secret: The v4/secrets/ endpoint caches correctly

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

export INFISICAL_BACKEND_DIR=<backend-dir-path>
export TESTCONTAINERS_RYUK_DISABLED=true

go test github.com/infisical/cli/e2e-tests/proxy -v

@varonix0 varonix0 self-assigned this Jan 21, 2026
@varonix0 varonix0 changed the title Daniel/proxy e2e tests feat(e2e-tests): infisical proxy coverage Jan 21, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 21, 2026

Greptile Summary

Added comprehensive end-to-end tests for Infisical Proxy functionality. The tests validate cache hit/miss behavior, mutation-based cache purging (for updates and deletes), token invalidation, high availability when backend is down, background refresh of cached secrets, multiple secret handling, and single secret endpoint caching.

Key changes:

  • Created e2e/proxy/proxy_test.go with 7 test cases covering all major proxy features
  • Extracted common test utilities to e2e/util/helpers.go to eliminate code duplication between relay and proxy tests
  • Added DownWithForce() method to compose stack for proper container/network teardown during high availability tests
  • Updated OpenAPI config to include V4 secret API endpoints needed for proxy testing
  • Refactored relay and gateway tests to use shared helper utilities

The test suite follows existing patterns and provides good coverage of the proxy's caching behavior and resilience features.

Confidence Score: 5/5

  • This PR is safe to merge - it only adds test code without modifying production functionality
  • The PR exclusively adds comprehensive e2e tests for proxy functionality with good test coverage, proper cleanup, and code reuse through extracted helpers. No production code changes, no security concerns, and follows existing test patterns.
  • No files require special attention

Important Files Changed

Filename Overview
e2e/proxy/proxy_test.go New comprehensive test suite for Infisical Proxy covering cache behavior, mutation purging, token validation, high availability, background refresh, and multiple secrets.
e2e/util/helpers.go New shared utilities file extracted from relay tests to support proxy tests, containing InfisicalService, Command helpers, and wait utilities.
e2e/packages/infisical/compose.go Added DownWithForce method to properly tear down containers and networks for high availability testing scenarios.

@varonix0 varonix0 requested a review from akhilmhdh January 21, 2026 13:29
Copy link
Member

@akhilmhdh akhilmhdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overal looking good. I would recommend to remove all time.sleep and then check for stdErr.

Even though it's not affecting us now - others or llm will keep picking that pattern and ends up using it more often. We should try to use the testing library one waitForStdErr as it contains timeout, retry mechanism in place - so every it's used as it is.

@akhilmhdh
Copy link
Member

Application testing pending

@varonix0 varonix0 merged commit 5a6d05a into main Jan 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants