Skip to content

Conversation

@radiohead
Copy link
Contributor

Summary

This PR adds a complete docker-compose-based integration test environment for testing grafanactl against a real Grafana API.

  • docker-compose.yml: Sets up Grafana 12.2 and MySQL 8.0 with health checks and proper networking
  • testdata/grafana.ini: Custom Grafana configuration with kubernetesDashboards feature enabled
  • testdata/integration-test-config.yaml: Pre-configured grafanactl config for local testing with admin:admin credentials
  • Make targets: Five new targets for easy environment management (test-env-up, test-env-down, test-env-clean, test-env-status, test-env-logs)
  • Documentation: Comprehensive guide in CONTRIBUTING.md with quick start, testing examples, customization options, and troubleshooting

Test plan

  • Run make test-env-up to start the environment
  • Verify services are healthy with make test-env-status
  • Test grafanactl commands:
    • devbox run go run ./cmd/grafanactl --config testdata/integration-test-config.yaml config view
    • devbox run go run ./cmd/grafanactl --config testdata/integration-test-config.yaml resources list
  • Verify logs are accessible with make test-env-logs
  • Clean up with make test-env-clean
  • Review CONTRIBUTING.md documentation for completeness and accuracy

🤖 Generated with Claude Code

What:
- Added docker-compose.yml with Grafana 12.2 and MySQL 8.0 setup
- Created testdata/grafana.ini with custom configuration and kubernetesDashboards feature enabled
- Created testdata/integration-test-config.yaml for testing grafanactl against local Grafana
- Added Make targets for managing test environment: test-env-up, test-env-down, test-env-clean, test-env-status, test-env-logs
- Updated CONTRIBUTING.md with comprehensive integration testing guide including quick start, testing examples, customization options, and troubleshooting
- Updated .gitignore to exclude temporary test files

Why:
grafanactl needs to be tested against a real Grafana API to ensure proper integration. This provides developers with an easy way to spin up a local Grafana instance pre-configured with the correct settings (admin:admin credentials, kubernetesDashboards feature toggle) for testing grafanactl commands without needing a remote Grafana instance.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@radiohead radiohead requested a review from a team as a code owner October 16, 2025 14:26
[feature_toggles]
# Enable the kubernetesDashboards feature for grafanactl
# This is required for grafanactl's resources commands to work properly
enable = kubernetesDashboards
Copy link
Member

Choose a reason for hiding this comment

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

This is also set in docker-compose file.

Copy link
Member

@spinillos spinillos left a comment

Choose a reason for hiding this comment

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

Only one comment, but its fine.

@radiohead radiohead merged commit 0995fe3 into main Oct 17, 2025
8 checks passed
@radiohead radiohead deleted the add-docker-compose-integration-test-env branch October 17, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants