Skip to content

Conversation

@fangpenlin
Copy link
Contributor

Description 📣

ref: https://linear.app/infisical/issue/PLATFRM-128/pick-one-vertical-slice-to-add-tests-with-the-new-e2e-infra

Type ✨

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

Tests 🛠️

# Here's some code block to paste some code snippets

@fangpenlin fangpenlin marked this pull request as ready for review January 16, 2026 05:13
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 16, 2026

Greptile Summary

This PR adds comprehensive end-to-end test infrastructure for relay and gateway functionality. The changes include three new test cases covering relay registration, gateway registration, and relay-gateway-PAM connectivity with both Kubernetes and Redis resources.

Key improvements:

  • Refactored CLI command structure to export RootCmd and support dynamic stdout/stderr writers, enabling better testability
  • Implemented flexible test execution modes (subprocess and functionCall) with proper state management
  • Added robust wait helpers (WaitFor, WaitForStderr) with proper command lifecycle checks
  • Updated logger utilities to support configurable output writers for test output capture
  • Comprehensive documentation in README covering setup, configuration, and troubleshooting

The tests properly use testcontainers to spin up Redis and mock HTTP servers, validate heartbeats, and verify connectivity through the relay-gateway architecture.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are well-structured test infrastructure additions with proper error handling, cleanup mechanisms, and no security concerns. All refactorings are safe and improve testability without affecting production behavior.
  • No files require special attention

Important Files Changed

Filename Overview
e2e/relay/relay_test.go Added comprehensive e2e tests for relay registration, gateway registration, and relay-gateway-PAM connectivity (Kubernetes and Redis). All tests follow good patterns.
e2e/relay/helpers_test.go Refactored test helpers to support both subprocess and functionCall run methods with improved state management and proper cleanup. Good error handling.
e2e/README.md Comprehensive documentation covering test setup, configuration, and troubleshooting. Well-structured and helpful for developers.
packages/cmd/root.go Renamed rootCmd to RootCmd for export, added dynamic stdout/stderr writers for testability, and extracted GetLoggerConfig function. Enables better testing.
packages/util/log.go Added configurable writer functions and new helper functions for stdout/stderr to support test output redirection. Good abstraction.

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.

Application testing it. Readme looks amazing


# Generate OpenAPI client using oapi-codegen
generate-client: filter-api
generate-code:
Copy link
Member

Choose a reason for hiding this comment

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

generate-code seems a misleading - may be like openapi-spec

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