-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[jaeger-v2] add Badger storage backend integration test #5281
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
Closed
Closed
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d4cebe2
init
pushkarm029 206dc33
working locally
pushkarm029 dbf4032
fix badger mkdir issue
pushkarm029 bab56b5
fix
pushkarm029 6bcd218
some fixes
pushkarm029 52b6ac5
Merge branch 'main' into badger_integration
pushkarm029 6c70cea
fix gh cli error
pushkarm029 2dfd9b9
fix
pushkarm029 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
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,16 @@ | ||
| // Copyright (c) 2024 The Jaeger Authors. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package integration | ||
|
|
||
| import ( | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestBadgerStorage(t *testing.T) { | ||
| s := &StorageIntegration{ | ||
| Name: "badger", | ||
| ConfigFile: "fixtures/badger_config.yaml", | ||
| } | ||
| s.Test(t) | ||
| } |
23 changes: 23 additions & 0 deletions
23
cmd/jaeger/internal/integration/fixtures/badger_config.yaml
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,23 @@ | ||
| service: | ||
| extensions: [jaeger_storage] | ||
| pipelines: | ||
| traces: | ||
| receivers: [otlp] | ||
| exporters: [jaeger_storage_exporter] | ||
|
|
||
| extensions: | ||
| jaeger_storage: | ||
| grpc: | ||
| some-external-storage: | ||
| server: localhost:17271 | ||
| connection-timeout: 5s | ||
|
|
||
| receivers: | ||
| otlp: | ||
| protocols: | ||
| grpc: | ||
| http: | ||
|
|
||
| exporters: | ||
| jaeger_storage_exporter: | ||
| trace_storage: some-external-storage | ||
File renamed without changes.
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,119 @@ | ||
| #!/bin/bash | ||
|
|
||
| PS4='T$(date "+%H:%M:%S") ' | ||
| set -euxf -o pipefail | ||
|
|
||
| # use global variables to reflect status of db | ||
| db_is_up= | ||
| badger_data=/badger | ||
|
|
||
| usage() { | ||
| echo $"Usage: $0 <image_version>" | ||
| exit 1 | ||
| } | ||
|
|
||
| check_arg() { | ||
| if [ ! $# -eq 1 ]; then | ||
| echo "ERROR: need exactly one argument, <image_version>" | ||
| usage | ||
| fi | ||
| } | ||
|
|
||
| setup_remote_storage() { | ||
| local image=$1 | ||
| local tag=$2 | ||
| local params=( | ||
| --rm | ||
| --detach | ||
| --publish 17271:17271 | ||
| --publish 17270:17270 | ||
| --env SPAN_STORAGE_TYPE=badger | ||
| --env BADGER_EPHEMERAL=false | ||
| --env BADGER_DIRECTORY_VALUE="$badger_data/values" | ||
| --env BADGER_DIRECTORY_KEY="$badger_data/keys" | ||
| -v test:"$badger_data" | ||
| ) | ||
| local cid | ||
| cid=$(docker run "${params[@]}" "${image}:${tag}") | ||
| echo "${cid}" | ||
| } | ||
|
|
||
| wait_for_storage() { | ||
| local image=$1 | ||
| local url=$2 | ||
| local cid=$3 | ||
| local params=( | ||
| --silent | ||
| --output | ||
| /dev/null | ||
| --write-out | ||
| "%{http_code}" | ||
| ) | ||
| local counter=0 | ||
| local max_counter=60 | ||
| while [[ "$(curl "${params[@]}" "${url}")" != "200" && ${counter} -le ${max_counter} ]]; do | ||
| docker inspect "${cid}" | jq '.[].State' | ||
| echo "waiting for ${url} to be up..." | ||
| sleep 10 | ||
| counter=$((counter+1)) | ||
| done | ||
| # after the loop, do final verification and set status as global var | ||
| if [[ "$(curl "${params[@]}" "${url}")" != "200" ]]; then | ||
| echo "ERROR: ${image} is not ready" | ||
| docker logs "${cid}" | ||
| docker kill "${cid}" | ||
| db_is_up=0 | ||
| else | ||
| echo "SUCCESS: ${image} is ready" | ||
| db_is_up=1 | ||
| fi | ||
| } | ||
|
|
||
| bring_up_storage() { | ||
| local version=$1 | ||
| local image="jaegertracing/jaeger-remote-storage" | ||
| local cid | ||
|
|
||
| # create a dir | ||
| docker volume create test | ||
| docker run --rm -v test:"$badger_data" busybox sh -c ' | ||
| mkdir -p '"$badger_data"' && \ | ||
| touch '"$badger_data"'/.initialized && \ | ||
| chown -R 10001:10001 '"$badger_data"' | ||
| ' | ||
|
|
||
| echo "starting ${image} ${version}" | ||
| for retry in 1 2 3 | ||
| do | ||
| echo "attempt $retry" | ||
| cid=$(setup_remote_storage "${image}" "${version}") | ||
|
|
||
| wait_for_storage "${image}" "http://localhost:17270" "${cid}" | ||
| if [ ${db_is_up} = "1" ]; then | ||
| break | ||
| fi | ||
| done | ||
| if [ ${db_is_up} = "1" ]; then | ||
| # shellcheck disable=SC2064 | ||
| trap "teardown_storage ${cid}" EXIT | ||
| else | ||
| echo "ERROR: unable to start ${image}" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| teardown_storage() { | ||
| local cid=$1 | ||
| docker kill "${cid}" | ||
| docker volume rm test | ||
| } | ||
|
|
||
| main() { | ||
| check_arg "$@" | ||
| local version=$1 | ||
|
|
||
| bring_up_storage "${version}" | ||
| STORAGE="badger" make jaeger-storage-integration-test | ||
| } | ||
|
|
||
| main "$@" |
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.