Skip to content

Conversation

reyhankoyun
Copy link
Contributor

Issue #, if available:

Description of changes: Added the foundation for AWS Secrets Manager integration tests with basic secret retrieval validation. This enables testing real AWS interactions that unit tests cannot cover, ensuring the agent works correctly with live AWS services.

Changes

  • Integration test foundation (tests/common/) - Shared utilities for agent lifecycle management and AWS interactions
  • Secret retrieval tests (tests/secret_retrieval.rs) - 2 tests covering basic AWS Secrets Manager features
  • Local test runner (test-local.sh) - Automated setup, execution, and cleanup of integration tests
  • Dependencies - Added reqwest and serde_json for HTTP client and JSON parsing

Testing
Run locally with AWS credentials:

# Ensure AWS credentials are configured
ada credentials update --account=YOUR_ACCOUNT_ID --role=YOUR_ROLE

# Run all integration tests with automatic setup/cleanup
./test-local.sh

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@reyhankoyun reyhankoyun requested a review from a team as a code owner October 1, 2025 19:01
Copy link

codecov bot commented Oct 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.72%. Comparing base (3e77720) to head (d8d3048).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #125   +/-   ##
=======================================
  Coverage   91.72%   91.72%           
=======================================
  Files          14       14           
  Lines        2418     2418           
  Branches     2418     2418           
=======================================
  Hits         2218     2218           
  Misses        150      150           
  Partials       50       50           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Replace std::thread::sleep with tokio::time::sleep and proper HTTP timeouts
- Create structured AgentQuery with Display trait for extensible query building
- Replace AWS CLI usage with AWS SDK for secret ARN retrieval
- Move secret creation to test setup phase with proper lifecycle management
- Create separate integration-tests crate to isolate dependencies
- Add proper test structure with ignored integration tests for CI compatibility
- Update test script to work with new crate structure
- Maintain all existing functionality while improving code quality
- Use url crate for proper URL construction instead of string formatting
- Replace string paths with PathBuf for cross-platform path handling
- Eliminate sleep in async code by reading agent stdout for ready signal
- Use tokio::process::Command for proper async process management
- Add process and io-util features to tokio dependency
- Remove unused imports and constants
- Maintain fail-fast behavior without polling loops

All URL construction now uses proper parsing and query building.
Agent startup detection waits for actual 'listening on' message.
No more sleep() calls in async functions.
simonmarty
simonmarty previously approved these changes Oct 2, 2025
- Add test_binary_secret_retrieval for SecretBinary field handling
- Add test_version_stage_retrieval for AWSPENDING/AWSCURRENT stages
- Add test_version_id_retrieval for specific version ID access
- Add test_large_secret_retrieval for near 64KB limit handling
- Enhance common.rs with improved setup and cleanup functions
…polling

- Replace manual cleanup with TestSecrets struct using Drop trait for guaranteed cleanup
- Add comprehensive integration tests for binary secrets, version stages, version IDs, and large secrets
- Replace sleep antipattern with timeout-based polling using tokio::time::timeout
- Implement proper error handling with Result types
- Ensure automatic secret cleanup even if tests panic or fail
- Remove redundant legacy functions to eliminate code duplication
- Convert standalone functions to AgentProcess methods (start_on_port, make_request)
- Move AWSPENDING version waiting to specific tests that need it
- Use kill_on_drop(true) for automatic process cleanup instead of Drop trait
- Encapsulate polling logic in wait_for_pending_version method with timeout protection
- Enable validate_credentials in test config for better test coverage
Since kill_on_drop(true) is configured, manual kill() calls are unnecessary.
The process will be automatically terminated when Child is dropped on panic.
simonmarty
simonmarty previously approved these changes Oct 7, 2025
@reyhankoyun reyhankoyun merged commit 0d67a90 into aws:main Oct 7, 2025
5 checks passed
@reyhankoyun reyhankoyun deleted the feature/integration-tests branch October 7, 2025 21:18
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