Skip to content

Commit

Permalink
[bug] Use correct argument as jaeger-version (jaegertracing#5716)
Browse files Browse the repository at this point in the history
  • Loading branch information
yurishkuro authored Jul 8, 2024
1 parent 7b7e5cc commit 13c715b
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 39 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci-elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ jobs:
with:
go-version: 1.22.x

- name: Install tools
run: make install-ci

- uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0
- name: Run ${{ matrix.version.distribution }} integration tests
id: test-execution
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Validation Of Shell Scripts
name: Lint Shell Scripts

on:
push:
Expand All @@ -11,7 +11,7 @@ permissions:
contents: read

jobs:
validation-of-shell-scripts:
link-shell-scripts:
runs-on: ubuntu-latest

steps:
Expand All @@ -20,17 +20,11 @@ jobs:
with:
egress-policy: audit

- name: check out code
- name: check out code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Install shellcheck
run: sudo apt-get install shellcheck

- name: Run shellcheck
run: shellcheck scripts/*.sh






3 changes: 0 additions & 3 deletions .github/workflows/ci-opensearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ jobs:
with:
go-version: 1.22.x

- name: Install tools
run: make install-ci

- uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0

- name: Run ${{ matrix.version.distribution }} integration tests
Expand Down
40 changes: 21 additions & 19 deletions cmd/jaeger/internal/integration/e2e_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,35 +131,37 @@ func createStorageCleanerConfig(t *testing.T, configFile string, storage string)
err = yaml.Unmarshal(data, &config)
require.NoError(t, err)

service, ok := config["service"].(map[string]any)
serviceAny, ok := config["service"]
require.True(t, ok)
service := serviceAny.(map[string]any)
service["extensions"] = append(service["extensions"].([]any), "storage_cleaner")

extensions, ok := config["extensions"].(map[string]any)
extensionsAny, ok := config["extensions"]
require.True(t, ok)
query, ok := extensions["jaeger_query"].(map[string]any)
extensions := extensionsAny.(map[string]any)
queryAny, ok := extensions["jaeger_query"]
require.True(t, ok)
trace_storage := query["trace_storage"].(string)
extensions["storage_cleaner"] = map[string]string{"trace_storage": trace_storage}
traceStorageAny, ok := queryAny.(map[string]any)["trace_storage"]
require.True(t, ok)
traceStorage := traceStorageAny.(string)
extensions["storage_cleaner"] = map[string]string{"trace_storage": traceStorage}

jaegerStorage, ok := extensions["jaeger_storage"].(map[string]any)
jaegerStorageAny, ok := extensions["jaeger_storage"]
require.True(t, ok)
jaegerStorage := jaegerStorageAny.(map[string]any)
backendsAny, ok := jaegerStorage["backends"]
require.True(t, ok)
backends := backendsAny.(map[string]any)

switch storage {
case "elasticsearch":
elasticsearch, ok := jaegerStorage["elasticsearch"].(map[string]any)
require.True(t, ok)
esMain, ok := elasticsearch["es_main"].(map[string]any)
require.True(t, ok)
case "elasticsearch", "opensearch":
someStoreAny, ok := backends["some_storage"]
require.True(t, ok, "expecting 'some_storage' entry, found: %v", jaegerStorage)
someStore := someStoreAny.(map[string]any)
esMainAny, ok := someStore[storage]
require.True(t, ok, "expecting '%s' entry, found %v", storage, someStore)
esMain := esMainAny.(map[string]any)
esMain["service_cache_ttl"] = "1ms"

case "opensearch":
opensearch, ok := jaegerStorage["opensearch"].(map[string]any)
require.True(t, ok)
osMain, ok := opensearch["os_main"].(map[string]any)
require.True(t, ok)
osMain["service_cache_ttl"] = "1ms"

default:
// Do Nothing
}
Expand Down
13 changes: 13 additions & 0 deletions cmd/jaeger/internal/integration/e2e_integration_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) 2024 The Jaeger Authors.
// SPDX-License-Identifier: Apache-2.0

package integration

import "testing"

func TestCreateStorageCleanerConfig(t *testing.T) {
// Ensure that we can parse the existing configs correctly.
// This is faster to run than the full integration test.
createStorageCleanerConfig(t, "../../config-elasticsearch.yaml", "elasticsearch")
createStorageCleanerConfig(t, "../../config-opensearch.yaml", "opensearch")
}
18 changes: 13 additions & 5 deletions scripts/es-integration-test.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
#!/bin/bash

PS4='T$(date "+%H:%M:%S") '
set -euxf -o pipefail
set -euf -o pipefail

# use global variables to reflect status of db
db_is_up=

usage() {
echo $"Usage: $0 <elasticsearch|opensearch> <version>"
echo "Usage: $0 <backend> <backend_version> <jaeger_version>"
echo " backend: elasticsearch | opensearch"
echo " backend_version: major version, e.g. 7.x"
echo " jaeger_version: major version, e.g. v1 | v2"
exit 1
}

check_arg() {
if [ ! $# -eq 3 ]; then
echo "ERROR: need exactly three arguments, <elasticsearch|opensearch> <image> <jaeger-version>"
echo "ERROR: need exactly three arguments"
usage
fi
}
Expand Down Expand Up @@ -100,16 +103,21 @@ main() {
check_arg "$@"
local distro=$1
local es_version=$2
local j_version=$2
local j_version=$3

set -x

bring_up_storage "${distro}" "${es_version}"

if [[ "${j_version}" == "v2" ]]; then
STORAGE=${distro} SPAN_STORAGE_TYPE=${distro} make jaeger-v2-storage-integration-test
else
elif [[ "${j_version}" == "v1" ]]; then
STORAGE=${distro} make storage-integration-test
make index-cleaner-integration-test
make index-rollover-integration-test
else
echo "ERROR: Invalid argument value jaeger_version=${j_version}, expecing v1/v2".
exit 1
fi
}

Expand Down

0 comments on commit 13c715b

Please sign in to comment.