Skip to content

Add E2E Testing with Docker Compose - #2

Merged
wbh1 merged 17 commits into
mainfrom
feature/e2e-docker-compose
Nov 16, 2025
Merged

wbh1 merged 17 commits into
mainfrom
feature/e2e-docker-compose

Conversation

@wbh1

@wbh1 wbh1 commented Nov 16, 2025

Copy link
Copy Markdown
Member

Summary

  • Implemented comprehensive end-to-end testing infrastructure using Docker Compose
  • Added mock Linode API server for isolated testing
  • Created 4 e2e tests covering all major workflows
  • Updated documentation and added Makefile targets

Changes

Infrastructure

  • Mock Linode API Server (test/e2e/mock-linode/)

    • HTTP server implementing Linode API v4 subset
    • In-memory token state management
    • Proper datetime format matching real Linode API
    • Reset endpoint for test isolation
  • Docker Compose Configuration (test/e2e/docker-compose.yml)

    • HashiCorp Vault in dev mode
    • Mock Linode API service
    • Health checks for service readiness
    • Automatic network configuration
  • Linode Client Enhancement (internal/linode/client.go)

    • Added LINODE_API_URL environment variable support
    • Enables testing against mock server
    • No breaking changes to existing functionality

Tests

All tests validate complete workflows with real Vault and mock Linode API:

  • TestE2E_CreateToken: Validates new token creation, Vault storage, and metadata
  • TestE2E_RotateToken: Validates token rotation with 95% expired token
  • TestE2E_DryRunMode: Validates dry-run mode (no actual changes made)
  • TestE2E_DaemonMode: Validates daemon mode with graceful shutdown

Build & Documentation

  • Makefile: Added test, test-e2e, and test-all targets
  • README.md: Updated with e2e test instructions and marked integration tests as complete

Test Results

Unit tests: ✅ PASS
E2E tests:  ✅ PASS (4/4 tests)

All tests pass successfully with proper cleanup of Docker resources.

Test Plan

  • All unit tests pass
  • All e2e tests pass
  • make test-all runs successfully
  • Docker containers are properly cleaned up after tests
  • Documentation is up to date

🤖 Generated with Claude Code

@wbh1
wbh1 requested a review from Copilot November 16, 2025 21:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a comprehensive end-to-end testing infrastructure for the latr token rotation system using Docker Compose. It adds a mock Linode API server for isolated testing and creates four e2e tests that validate complete workflows with real Vault integration.

Key changes:

  • Mock Linode API HTTP server with in-memory state management
  • Docker Compose setup with Vault and mock services
  • Four e2e tests covering token creation, rotation, dry-run, and daemon modes
  • Enhanced Linode client to support custom API URLs via environment variable

Reviewed Changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/e2e/mock-linode/main.go Implements HTTP server mocking Linode API v4 endpoints with in-memory token storage
test/e2e/mock-linode/Dockerfile Container definition for mock API server
test/e2e/e2e_test.go E2E test suite with TestMain orchestration and four workflow tests
test/e2e/docker-compose.yml Service definitions for Vault and mock Linode with health checks
test/e2e/testdata/*.yaml Configuration files for each test scenario
internal/linode/client.go Added LINODE_API_URL environment variable support
docs/plans/2025-11-16-e2e-testing-design.md Design documentation for e2e testing approach
README.md Updated testing instructions and marked integration tests complete
Makefile Added test, test-e2e, and test-all targets

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/e2e/e2e_test.go Outdated
Comment thread test/e2e/docker-compose.yml Outdated
Comment thread test/e2e/e2e_test.go
wbh1 and others added 2 commits November 16, 2025 16:58
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@wbh1
wbh1 merged commit 3d4f7b8 into main Nov 16, 2025
@wbh1
wbh1 deleted the feature/e2e-docker-compose branch November 16, 2025 22:00
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.

2 participants