Skip to content

Commit

Permalink
yuce's fix for default log path in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kutluhanmetin committed Sep 22, 2023
1 parent 6b7119b commit eb122a1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
15 changes: 7 additions & 8 deletions base/commands/migration/start_stages_it_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()))
}
})
})
}
Expand Down
6 changes: 6 additions & 0 deletions internal/it/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit eb122a1

Please sign in to comment.