From 349f1489788d080b78046c1a4fbac908fa889cf1 Mon Sep 17 00:00:00 2001 From: Kamil Dziedzic Date: Tue, 14 Nov 2017 13:25:58 +0100 Subject: [PATCH 1/2] try to fix tests, not sure why we miss header here? --- src/go/pt-mongodb-query-digest/main_test.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/go/pt-mongodb-query-digest/main_test.go b/src/go/pt-mongodb-query-digest/main_test.go index 7e86b752..41331120 100644 --- a/src/go/pt-mongodb-query-digest/main_test.go +++ b/src/go/pt-mongodb-query-digest/main_test.go @@ -18,7 +18,6 @@ import ( "text/template" "time" - "github.com/kr/pretty" "github.com/pborman/getopt/v2" "github.com/percona/percona-toolkit/src/go/lib/profiling" "github.com/percona/percona-toolkit/src/go/lib/tutil" @@ -404,10 +403,6 @@ func testAllOperationsTemplate(t *testing.T, data Data) { expected := `Profiler is disabled for the "test" database but there are \s*[0-9]+ documents in the system.profile collection. Using those documents for the stats -pt-mongodb-query-digest .+ -Host: ` + data.url + ` -Skipping profiled queries on these collections: \[system\.profile\] - # Totals # Ratio [0-9\.]+ \(docs scanned/returned\) @@ -450,9 +445,7 @@ Skipping profiled queries on these collections: \[system\.profile\] expected += buf.String() } - fmt.Println("====================================================================================================") - pretty.Println(string(output)) - fmt.Println("====================================================================================================") + expected += "\n" // Looks like we expect additional line assertRegexpLines(t, expected, string(output)) } From f655e3f01489fcf0f2f4e3cbbd62c051331555a4 Mon Sep 17 00:00:00 2001 From: Kamil Dziedzic Date: Tue, 14 Nov 2017 13:49:16 +0100 Subject: [PATCH 2/2] make go vet happy --- src/go/mongolib/stats/stats_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/go/mongolib/stats/stats_test.go b/src/go/mongolib/stats/stats_test.go index 98af2347..f1249968 100644 --- a/src/go/mongolib/stats/stats_test.go +++ b/src/go/mongolib/stats/stats_test.go @@ -214,7 +214,7 @@ func TestStatsSingle(t *testing.T) { t.Fatalf("cannot load expected data %s: %s", dirExpect+f, err) } if !reflect.DeepEqual(got, expect) { - t.Errorf("s.Queries() = %s, want %s", got, expect) + t.Errorf("s.Queries() = %#v, want %#v", got, expect) } }) } @@ -261,7 +261,7 @@ func TestStatsAll(t *testing.T) { t.Fatalf("cannot load expected data %s: %s", f, err) } if !reflect.DeepEqual(got, expect) { - t.Errorf("s.Queries() = %s, want %s", got, expect) + t.Errorf("s.Queries() = %#v, want %#v", got, expect) } } @@ -343,7 +343,7 @@ func TestAvailableMetrics(t *testing.T) { } if !reflect.DeepEqual(got, expect) { - t.Errorf("s.Queries() = %s, want %s", got, expect) + t.Errorf("s.Queries() = %#v, want %#v", got, expect) } })