Skip to content

Commit

Permalink
string contain check
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 323e071 commit b0f415f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions plugins/clickhouse-monitor/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ import (

"github.com/DATA-DOG/go-sqlmock"
"github.com/stretchr/testify/assert"

"k8s.io/klog/v2"
)

func TestMonitorWithMockDB(t *testing.T) {
fmt.Println("into function TestMonitorWithMockDB")
klog.InfoS("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")
klog.InfoS("deferred DB close")
initEnv()

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

for _, tc := range testCases {
fmt.Println("running test case: " + tc.name)
klog.InfoS("running test case: " + tc.name)
t.Run(tc.name, func(t *testing.T) {
remainingRoundsNum = tc.remainingRoundsNum
if tc.setUpMock != nil {
Expand Down
1 change: 1 addition & 0 deletions test/e2e/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -1650,6 +1650,7 @@ func (data *TestData) killProcessesAndCollectCovFiles(namespace, podName, contai
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") {
log.Infof("reached into if condition")
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")
Expand Down

0 comments on commit b0f415f

Please sign in to comment.