Skip to content

Commit

Permalink
file copy order switch, potential e2e test fix
Browse files Browse the repository at this point in the history
Signed-off-by: Dhruv-J <[email protected]>
  • Loading branch information
Dhruv-J committed Jul 17, 2023
1 parent 56ff2a3 commit 323e071
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/clickhouse-monitor/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ import (
)

func TestMonitorWithMockDB(t *testing.T) {
fmt.Println("into function TestMonitorWithMockDB")
db, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
if err != nil {
t.Fatalf("an error '%s' was not expected when opening a stub database connection", err)
}
defer db.Close()
fmt.Println("deferred DB close")
initEnv()

foreverRun = func(f func(), period time.Duration) {
Expand Down Expand Up @@ -81,6 +83,7 @@ func TestMonitorWithMockDB(t *testing.T) {
}

for _, tc := range testCases {
fmt.Println("running test case: " + tc.name)
t.Run(tc.name, func(t *testing.T) {
remainingRoundsNum = tc.remainingRoundsNum
if tc.setUpMock != nil {
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -1648,9 +1648,12 @@ func (data *TestData) killProcessesAndCollectCovFiles(namespace, podName, contai
log.Infof("first find command run")
var files []string
if err != nil || rc != 0 {
log.Infof("error for first find command is not nil")
if !strings.Contains(err.Error(), "No such file or directory") {
return fmt.Errorf("error when running this find command (for coverage file) '%s' on Node kind-worker, stderr: <%v>, err: <%v>", cmd, stderr, err)
}
log.Infof("successfully searched substring, was not file not found error")
} else {
stdout = strings.TrimSpace(stdout)
files = strings.Split(stdout, "\n")
}
Expand All @@ -1661,6 +1664,7 @@ func (data *TestData) killProcessesAndCollectCovFiles(namespace, podName, contai
if !strings.Contains(err.Error(), "No such file or directory") {
return fmt.Errorf("error when running this find command (for coverage file) '%s' on Node kind-worker, stderr: <%v>, err: <%v>", cmd, stderr, err)
}
} else {
stdout = strings.TrimSpace(stdout)
files = append(files, strings.Split(stdout, "\n")...)
}
Expand All @@ -1683,6 +1687,7 @@ func (data *TestData) killProcessesAndCollectCovFiles(namespace, podName, contai
if !strings.Contains(err.Error(), "No such file or directory") {
return fmt.Errorf("error when running this find command (for coverage file) '%s' on Node kind-worker2, stderr: <%v>, err: <%v>", cmd, stderr, err)
}
} else {
stdout = strings.TrimSpace(stdout)
files = strings.Split(stdout, "\n")
}
Expand All @@ -1693,6 +1698,7 @@ func (data *TestData) killProcessesAndCollectCovFiles(namespace, podName, contai
if !strings.Contains(err.Error(), "No such file or directory") {
return fmt.Errorf("error when running this find command (for coverage file) '%s' on Node kind-worker2, stderr: <%v>, err: <%v>", cmd, stderr, err)
}
} else {
stdout = strings.TrimSpace(stdout)
files = append(files, strings.Split(stdout, "\n")...)
}
Expand Down

0 comments on commit 323e071

Please sign in to comment.