Skip to content

Commit

Permalink
Testing Commit
Browse files Browse the repository at this point in the history
Signed-off-by: LogicalGuy77 <harshitacademia@gmail.com>
  • Loading branch information
LogicalGuy77 committed Jul 7, 2024
1 parent 7b7e5cc commit 90b7c8d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 14 deletions.
29 changes: 21 additions & 8 deletions plugin/storage/integration/es_index_cleaner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package integration
import (
"context"
"fmt"
"os"
"os/exec"
"testing"

Expand All @@ -27,16 +28,28 @@ import (
)

const (
archiveIndexName = "jaeger-span-archive"
dependenciesIndexName = "jaeger-dependencies-2019-01-01"
samplingIndexName = "jaeger-sampling-2019-01-01"
spanIndexName = "jaeger-span-2019-01-01"
serviceIndexName = "jaeger-service-2019-01-01"
indexCleanerImage = "jaegertracing/jaeger-es-index-cleaner:latest"
rolloverImage = "jaegertracing/jaeger-es-rollover:1.57.0"
rolloverNowEnvVar = `CONDITIONS='{"max_age":"0s"}'`
archiveIndexName = "jaeger-span-archive"
dependenciesIndexName = "jaeger-dependencies-2019-01-01"
samplingIndexName = "jaeger-sampling-2019-01-01"
spanIndexName = "jaeger-span-2019-01-01"
serviceIndexName = "jaeger-service-2019-01-01"
defaultIndexCleanerImage = "jaegertracing/jaeger-es-index-cleaner:latest"
defaultRolloverImage = "jaegertracing/jaeger-es-rollover:1.57.0"
rolloverNowEnvVar = `CONDITIONS='{"max_age":"0s"}'`
)

var (
indexCleanerImage = getEnvOrDefault("JAEGER_ES_INDEX_CLEANER_IMAGE", defaultIndexCleanerImage)
rolloverImage = getEnvOrDefault("JAEGER_ES_ROLLOVER_IMAGE", defaultRolloverImage)
)

func getEnvOrDefault(key, defaultValue string) string {
if value, exists := os.LookupEnv(key); exists {
return value
}
return defaultValue
}

func TestIndexCleaner_doNotFailOnEmptyStorage(t *testing.T) {
SkipUnlessEnv(t, "elasticsearch", "opensearch")
client, err := createESClient()
Expand Down
27 changes: 21 additions & 6 deletions scripts/es-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ check_arg() {
fi
}

# Build local images for index cleaner and rollover
build_local_images() {
local j_version=$1
JAEGER_VERSION=$(git describe --tags --abbrev=0)
LOCAL_TAG="local-${JAEGER_VERSION}"

bash scripts/build-upload-a-docker-image.sh -b -c jaeger-es-index-cleaner -d cmd/es-index-cleaner -t "${LOCAL_TAG}"
bash scripts/build-upload-a-docker-image.sh -b -c jaeger-es-rollover -d cmd/es-rollover -t "${LOCAL_TAG}"

# Set environment variables for the test
export JAEGER_ES_INDEX_CLEANER_IMAGE="jaegertracing/jaeger-es-index-cleaner:${LOCAL_TAG}"
export JAEGER_ES_ROLLOVER_IMAGE="jaegertracing/jaeger-es-rollover:${LOCAL_TAG}"
}

# start the elasticsearch/opensearch container
setup_db() {
local compose_file=$1
Expand Down Expand Up @@ -45,7 +59,7 @@ wait_for_storage() {
echo "Attempt: ${attempt} ${distro} is not yet available at ${url}..."
sleep 10
done

# if after all the attempts the storage is not accessible, terminate it and exit
if [[ "$(curl "${params[@]}" "${url}")" != "200" ]]; then
echo "ERROR: ${distro} is not ready at ${url} after $(( attempt * 10 )) seconds"
Expand All @@ -65,7 +79,7 @@ bring_up_storage() {
local version=$2
local major_version=${version%%.*}
local compose_file="docker-compose/${distro}/v${major_version}/docker-compose.yml"

echo "starting ${distro} ${major_version}"
for retry in 1 2 3
do
Expand Down Expand Up @@ -100,10 +114,11 @@ main() {
check_arg "$@"
local distro=$1
local es_version=$2
local j_version=$2

local j_version=$3

build_local_images "${j_version}"
bring_up_storage "${distro}" "${es_version}"

if [[ "${j_version}" == "v2" ]]; then
STORAGE=${distro} SPAN_STORAGE_TYPE=${distro} make jaeger-v2-storage-integration-test
else
Expand All @@ -113,4 +128,4 @@ main() {
fi
}

main "$@"
main "$@"

0 comments on commit 90b7c8d

Please sign in to comment.