From 323e0713c26d8bdedc6ca8949f826df7a5a1be40 Mon Sep 17 00:00:00 2001 From: Dhruv-J Date: Mon, 17 Jul 2023 01:51:29 -0700 Subject: [PATCH] file copy order switch, potential e2e test fix Signed-off-by: Dhruv-J --- plugins/clickhouse-monitor/main_test.go | 3 +++ test/e2e/framework.go | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/plugins/clickhouse-monitor/main_test.go b/plugins/clickhouse-monitor/main_test.go index e07e50c6..7e13439d 100644 --- a/plugins/clickhouse-monitor/main_test.go +++ b/plugins/clickhouse-monitor/main_test.go @@ -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) { @@ -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 { diff --git a/test/e2e/framework.go b/test/e2e/framework.go index 39621a22..d5c63bb4 100644 --- a/test/e2e/framework.go +++ b/test/e2e/framework.go @@ -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") } @@ -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")...) } @@ -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") } @@ -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")...) }