From eb122a1e281dca47be21561788bdf53a083514d2 Mon Sep 17 00:00:00 2001 From: kmetin Date: Fri, 22 Sep 2023 15:22:40 +0300 Subject: [PATCH] yuce's fix for default log path in tests --- base/commands/migration/start_stages_it_test.go | 15 +++++++-------- internal/it/test_context.go | 6 ++++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/base/commands/migration/start_stages_it_test.go b/base/commands/migration/start_stages_it_test.go index 069ae222..17d112cc 100644 --- a/base/commands/migration/start_stages_it_test.go +++ b/base/commands/migration/start_stages_it_test.go @@ -14,6 +14,7 @@ import ( _ "github.com/hazelcast/hazelcast-commandline-client/base" _ "github.com/hazelcast/hazelcast-commandline-client/base/commands" "github.com/hazelcast/hazelcast-commandline-client/base/commands/migration" + "github.com/hazelcast/hazelcast-commandline-client/clc/paths" . "github.com/hazelcast/hazelcast-commandline-client/internal/check" "github.com/hazelcast/hazelcast-commandline-client/internal/it" hz "github.com/hazelcast/hazelcast-go-client" @@ -77,14 +78,12 @@ func startMigrationTest(t *testing.T, expectedOutput string, statusMapStateFiles f := fmt.Sprintf("migration_report_%s.txt", mID) require.Equal(t, true, fileExists(f)) Must(os.Remove(f)) - /* - b := MustValue(os.ReadFile(paths.DefaultLogPath(time.Now()))) - for _, m := range ci.OrderedMembers() { - require.Contains(t, string(b), fmt.Sprintf("[%s_%s] log1", mID, m.UUID.String())) - require.Contains(t, string(b), fmt.Sprintf("[%s_%s] log2", mID, m.UUID.String())) - require.Contains(t, string(b), fmt.Sprintf("[%s_%s] log3", mID, m.UUID.String())) - } - */ + b := MustValue(os.ReadFile(paths.ResolveLogPath("test"))) + for _, m := range ci.OrderedMembers() { + require.Contains(t, string(b), fmt.Sprintf("[%s_%s] log1", mID, m.UUID.String())) + require.Contains(t, string(b), fmt.Sprintf("[%s_%s] log2", mID, m.UUID.String())) + require.Contains(t, string(b), fmt.Sprintf("[%s_%s] log3", mID, m.UUID.String())) + } }) }) } diff --git a/internal/it/test_context.go b/internal/it/test_context.go index 16555c22..e5413060 100644 --- a/internal/it/test_context.go +++ b/internal/it/test_context.go @@ -169,6 +169,12 @@ func (tcx TestContext) Tester(f func(tcx TestContext)) { d, _ := filepath.Split(p) check.Must(os.MkdirAll(d, 0700)) home.WithFile(p, bytesConfig, func(_ string) { + if tcx.LogPath == "" { + tcx.LogPath = paths.ResolveLogPath("test") + } + if tcx.LogLevel == "" { + tcx.LogLevel = "info" + } tcx.main = check.MustValue(tcx.createMain()) tcx.T.Logf("created CLC main") defer func() {