forked from grafana/cortex-tools
-
Notifications
You must be signed in to change notification settings - Fork 7
Integration tests #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
77dbad7
Integration tests
friedrichg 2836f87
Test Remote read too
friedrichg 8169e16
Potential fix for pull request finding 'CodeQL / Workflow does not co…
friedrichg 4ac04be
test loadgen
friedrichg 7671961
Delete alertmanager config
friedrichg 767ba1f
More rules group
friedrichg 546036c
Test rules lint
friedrichg 2f102ef
Document integration tests
friedrichg 28d7afa
Removing duplicated tests
friedrichg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| name: Integration Tests | ||
| on: | ||
| pull_request: | ||
| paths-ignore: | ||
| - "docs/**" | ||
| - "*.md" | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| integration: | ||
| name: Integration Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: 1.22 | ||
| - name: Start Cortex | ||
| run: | | ||
| docker run -d --name cortex \ | ||
| -p 9009:9009 \ | ||
| -v ${{ github.workspace }}/integration/cortex-config.yaml:/etc/cortex/config.yaml \ | ||
| cortexproject/cortex:v1.18.1 \ | ||
| -config.file=/etc/cortex/config.yaml \ | ||
| -target=all,alertmanager | ||
| - name: Wait for Cortex | ||
| run: | | ||
| for i in $(seq 1 30); do | ||
| if wget -qO- http://localhost:9009/ready > /dev/null 2>&1; then | ||
| echo "Cortex is ready" | ||
| exit 0 | ||
| fi | ||
| echo "Waiting for Cortex... ($i)" | ||
| sleep 2 | ||
| done | ||
| echo "Cortex failed to start" | ||
| docker logs cortex | ||
| exit 1 | ||
| - name: Run Integration Tests | ||
| env: | ||
| CORTEX_ADDRESS: http://localhost:9009 | ||
| run: go test -mod=vendor -tags=integration -v -count=1 ./integration/... | ||
| - name: Cortex Logs | ||
| if: failure() | ||
| run: docker logs cortex | ||
| - name: Cleanup | ||
| if: always() | ||
| run: docker stop cortex && docker rm cortex | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Integration Tests | ||
|
|
||
| ## Running | ||
|
|
||
| ```bash | ||
| # Start Cortex | ||
| docker run -d --name cortex-test -p 9009:9009 \ | ||
| -v $(pwd)/integration/cortex-config.yaml:/etc/cortex/config.yaml \ | ||
| cortexproject/cortex:v1.18.1 \ | ||
| -config.file=/etc/cortex/config.yaml \ | ||
| -target=all,alertmanager | ||
|
|
||
| # Wait for ready | ||
| until curl -s http://localhost:9009/ready > /dev/null 2>&1; do sleep 2; done && echo "Ready" | ||
|
|
||
| # Run tests | ||
| go test -mod=vendor -tags=integration -v -count=1 ./integration/... | ||
|
|
||
| # Cleanup | ||
| docker stop cortex-test && docker rm cortex-test | ||
| ``` | ||
|
|
||
| ## Coverage | ||
|
|
||
| These integration tests require a running Cortex instance. Offline commands (lint, check, prepare, parse) are covered by unit tests in `pkg/rules/`. | ||
|
|
||
| | Command | Tested? | | ||
| |---------|:---:| | ||
| | **rules load/list/print/get** | Yes | | ||
| | **rules delete (group)** | Yes | | ||
| | **rules delete-namespace** | Yes | | ||
| | **alertmanager load** | Yes | | ||
| | **alertmanager load (with templates)** | Yes | | ||
| | **alertmanager get** | Yes | | ||
| | **alertmanager delete** | Yes | | ||
| | **remote-read dump/stats** | Yes | | ||
| | **remote-read export** | Yes | | ||
| | **loadgen (write workload)** | Yes | | ||
| | **analyse** (grafana/ruler/dashboard/rule-file) | No | | ||
| | **bucket-validation** | No | | ||
| | **config** (use-context) | No | | ||
| | **alert verify** | No | | ||
| | **push-gateway** | No | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| route: | ||
| receiver: default | ||
| receivers: | ||
| - name: default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| auth_enabled: false | ||
|
|
||
| server: | ||
| http_listen_port: 9009 | ||
| grpc_server_max_recv_msg_size: 104857600 | ||
| grpc_server_max_send_msg_size: 104857600 | ||
| grpc_server_max_concurrent_streams: 1000 | ||
|
|
||
| distributor: | ||
| shard_by_all_labels: true | ||
| pool: | ||
| health_check_ingesters: true | ||
|
|
||
| ingester_client: | ||
| grpc_client_config: | ||
| max_recv_msg_size: 104857600 | ||
| max_send_msg_size: 104857600 | ||
| grpc_compression: gzip | ||
|
|
||
| ingester: | ||
| lifecycler: | ||
| min_ready_duration: 0s | ||
| final_sleep: 0s | ||
| num_tokens: 512 | ||
| ring: | ||
| kvstore: | ||
| store: inmemory | ||
| replication_factor: 1 | ||
|
|
||
| blocks_storage: | ||
| tsdb: | ||
| dir: /tmp/cortex/tsdb | ||
| bucket_store: | ||
| sync_dir: /tmp/cortex/tsdb-sync | ||
| backend: filesystem | ||
| filesystem: | ||
| dir: /tmp/cortex/data/tsdb | ||
|
|
||
| compactor: | ||
| data_dir: /tmp/cortex/compactor | ||
| sharding_ring: | ||
| kvstore: | ||
| store: inmemory | ||
|
|
||
| frontend_worker: | ||
| match_max_concurrent: true | ||
|
|
||
| ruler: | ||
| enable_api: true | ||
|
|
||
| ruler_storage: | ||
| backend: filesystem | ||
| filesystem: | ||
| dir: /tmp/cortex/rules | ||
|
|
||
| alertmanager: | ||
| enable_api: true | ||
| external_url: http://localhost:9009/alertmanager | ||
| sharding_ring: | ||
| kvstore: | ||
| store: inmemory | ||
| replication_factor: 1 | ||
|
|
||
| alertmanager_storage: | ||
| backend: filesystem | ||
| filesystem: | ||
| dir: /tmp/cortex/alerts |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.