Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
Signed-off-by: Manik2708 <[email protected]>
  • Loading branch information
Manik2708 committed Jan 2, 2025
1 parent d9efd5f commit 5a58a58
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 27 deletions.
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ updates:
- /cmd/anonymizer
- /cmd/collector
- /cmd/es-index-cleaner
- /cmd/es-rollover
- /cmd/ingester
- /cmd/jaeger
- /cmd/query
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ cmd/jaeger/internal/integration/results
cmd/remote-storage/remote-storage
cmd/remote-storage/remote-storage-*
cmd/es-index-cleaner/es-index-cleaner-*
cmd/es-rollover/es-rollover-*
cmd/query/query
cmd/query/query-*
cmd/tracegen/tracegen
Expand Down
1 change: 0 additions & 1 deletion Makefile.Windows.mk
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ _build-syso: $(GOVERSIONINFO)
$(call _build_syso_macro,Jaeger Tracegen,cmd/tracegen)
$(call _build_syso_macro,Jaeger Anonymizer,cmd/anonymizer)
$(call _build_syso_macro,Jaeger ES-Index-Cleaner,cmd/es-index-cleaner)
$(call _build_syso_macro,Jaeger ES-Rollover,cmd/es-rollover)
# TODO in the future this should be in v2
$(call _build_syso_macro,Jaeger V2,cmd/jaeger)

Expand Down
30 changes: 8 additions & 22 deletions cmd/jaeger/esrollover/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import (
)

const (
argumentsError = "accepts 1 arg(s), received 0"
argumentsError = "accepts 1 arg(s), received 0"
connectionRefused = "connection refused"
)

func TestCommand(t *testing.T) {
Expand All @@ -32,31 +33,15 @@ func TestCommand(t *testing.T) {
}

func TestAllCommands(t *testing.T) {
tests := []struct {
name string
expected string
}{
{
name: "init",
expected: "Get \"http://localhost:9200/\": dial tcp 127.0.0.1:9200: connect: connection refused",
},
{
name: "lookback",
expected: "failed to query indices: Get \"http://localhost:9200/jaeger-*?flat_settings=true&filter_path=*.aliases,*.settings\": dial tcp 127.0.0.1:9200: connect: connection refused",
},
{
name: "rollover",
expected: "failed to create rollover: Post \"http://localhost:9200/jaeger-span-write/_rollover/\": dial tcp 127.0.0.1:9200: connect: connection refused",
},
}
tests := []string{"init", "lookback", "rollover"}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
testCommands(t, test.name, test.expected)
t.Run(test, func(t *testing.T) {
testCommands(t, test)
})
}
}

func testCommands(t *testing.T, action, connectionError string) {
func testCommands(t *testing.T, action string) {
v := viper.New()
logger, err := zap.NewDevelopment()
require.NoError(t, err)
Expand All @@ -65,7 +50,8 @@ func testCommands(t *testing.T, action, connectionError string) {
var b bytes.Buffer
cmd.SetOut(&b)
err = cmd.Execute()
require.EqualError(t, err, connectionError)
require.Error(t, err)
assert.Contains(t, err.Error(), connectionRefused)
cmd.SetArgs([]string{action})
err = cmd.Execute()
assert.EqualError(t, err, argumentsError)
Expand Down
1 change: 0 additions & 1 deletion scripts/build/build-upload-docker-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ do
done

bash scripts/build/build-upload-a-docker-image.sh "${FLAGS[@]}" -b -c jaeger-es-index-cleaner -d cmd/es-index-cleaner -p "${platforms}" -t release
bash scripts/build/build-upload-a-docker-image.sh "${FLAGS[@]}" -b -c jaeger-es-rollover -d cmd/es-rollover -p "${platforms}" -t release
bash scripts/build/build-upload-a-docker-image.sh "${FLAGS[@]}" -c jaeger-cassandra-schema -d plugin/storage/cassandra/ -p "${platforms}"

# build/upload images for jaeger-tracegen and jaeger-anonymizer
Expand Down
1 change: 0 additions & 1 deletion scripts/build/package-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ function stage-tool-platform-files {
local -r FILE_EXTENSION=${3:-}

cp "./cmd/es-index-cleaner/es-index-cleaner-${PLATFORM}" "${TOOLS_PACKAGE_STAGING_DIR}/jaeger-es-index-cleaner${FILE_EXTENSION}"
cp "./cmd/es-rollover/es-rollover-${PLATFORM}" "${TOOLS_PACKAGE_STAGING_DIR}/jaeger-es-rollover${FILE_EXTENSION}"
cp "./plugin/storage/es/esmapping-generator-${PLATFORM}" "${TOOLS_PACKAGE_STAGING_DIR}/jaeger-esmapping-generator${FILE_EXTENSION}"
}

Expand Down

0 comments on commit 5a58a58

Please sign in to comment.