Skip to content

Commit c9a9be3

Browse files
Use go-test/deep instead of daniel-nichter/deep-equal
1 parent 070cf62 commit c9a9be3

File tree

10 files changed

+163
-154
lines changed

10 files changed

+163
-154
lines changed

Godeps/Godeps.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aggregator_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import (
1313
"testing"
1414
"time"
1515

16-
"github.com/daniel-nichter/deep-equal"
1716
"github.com/go-mysql/query"
1817
"github.com/go-mysql/slowlog"
18+
"github.com/go-test/deep"
1919
)
2020

2121
var examples = true
@@ -78,7 +78,7 @@ func zeroPercentiles(r *slowlog.Result) {
7878

7979
func TestSlow001(t *testing.T) {
8080
got, expect := aggregateSlowLog(t, "slow001.log", "slow001.json", 0)
81-
if diff, _ := deep.Equal(got, expect); diff != nil {
81+
if diff := deep.Equal(got, expect); diff != nil {
8282
dump(got)
8383
t.Error(diff)
8484
}
@@ -89,7 +89,7 @@ func TestSlow001WithTzOffset(t *testing.T) {
8989
// Use the same files as TestSlow001NoExamples but with a tz=-1
9090
expect.Class["7F7D57ACDD8A346E"].Example.Ts = "2007-10-15 20:43:52"
9191
expect.Class["3A99CC42AEDCCFCD"].Example.Ts = "2007-10-15 20:45:10"
92-
if diff, _ := deep.Equal(got, expect); diff != nil {
92+
if diff := deep.Equal(got, expect); diff != nil {
9393
dump(got)
9494
t.Error(diff)
9595
}
@@ -99,7 +99,7 @@ func TestSlow001NoExamples(t *testing.T) {
9999
examples = false
100100
defer func() { examples = true }()
101101
got, expect := aggregateSlowLog(t, "slow001.log", "slow001-no-examples.json", 0)
102-
if diff, _ := deep.Equal(got, expect); diff != nil {
102+
if diff := deep.Equal(got, expect); diff != nil {
103103
dump(got)
104104
t.Error(diff)
105105
}
@@ -108,15 +108,15 @@ func TestSlow001NoExamples(t *testing.T) {
108108
// Test p95 and median.
109109
func TestSlow010(t *testing.T) {
110110
got, expect := aggregateSlowLog(t, "slow010.log", "slow010.json", 0)
111-
if diff, _ := deep.Equal(got, expect); diff != nil {
111+
if diff := deep.Equal(got, expect); diff != nil {
112112
dump(got)
113113
t.Error(diff)
114114
}
115115
}
116116

117117
func TestSlow018(t *testing.T) {
118118
got, expect := aggregateSlowLog(t, "slow018.log", "slow018.json", 0)
119-
if diff, _ := deep.Equal(got, expect); diff != nil {
119+
if diff := deep.Equal(got, expect); diff != nil {
120120
dump(got)
121121
t.Error(diff)
122122
}
@@ -126,27 +126,27 @@ func TestSlow018(t *testing.T) {
126126
func TestUseDb(t *testing.T) {
127127
// Test db is not inherited
128128
got, expect := aggregateSlowLog(t, "slow020.log", "slow020.json", 0)
129-
if diff, _ := deep.Equal(got, expect); diff != nil {
129+
if diff := deep.Equal(got, expect); diff != nil {
130130
dump(got)
131131
t.Error(diff)
132132
}
133133
// Test "use" is not case sensitive
134134
got, expect = aggregateSlowLog(t, "slow021.log", "slow021.json", 0)
135-
if diff, _ := deep.Equal(got, expect); diff != nil {
135+
if diff := deep.Equal(got, expect); diff != nil {
136136
dump(got)
137137
t.Error(diff)
138138
}
139139
// Test we are parsing db names in backticks
140140
got, expect = aggregateSlowLog(t, "slow022.log", "slow022.json", 0)
141-
if diff, _ := deep.Equal(got, expect); diff != nil {
141+
if diff := deep.Equal(got, expect); diff != nil {
142142
dump(got)
143143
t.Error(diff)
144144
}
145145
}
146146

147147
func TestOutlierSlow025(t *testing.T) {
148148
got, expect := aggregateSlowLog(t, "slow025.log", "slow025.json", 0)
149-
if diff, _ := deep.Equal(got, expect); diff != nil {
149+
if diff := deep.Equal(got, expect); diff != nil {
150150
dump(got)
151151
t.Error(diff)
152152
}

parser_test.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"path"
1111
"testing"
1212

13-
"github.com/daniel-nichter/deep-equal"
1413
"github.com/go-mysql/slowlog"
14+
"github.com/go-test/deep"
1515
)
1616

1717
func parseSlowLog(t *testing.T, filename string, o slowlog.Options) []slowlog.Event {
@@ -38,7 +38,7 @@ func parseSlowLog(t *testing.T, filename string, o slowlog.Options) []slowlog.Ev
3838
func TestParserEmptySlowLog(t *testing.T) {
3939
got := parseSlowLog(t, "empty.log", noOptions)
4040
expect := []slowlog.Event{}
41-
if diff, _ := deep.Equal(got, expect); diff != nil {
41+
if diff := deep.Equal(got, expect); diff != nil {
4242
dump(got)
4343
t.Error(diff)
4444
}
@@ -85,7 +85,7 @@ func TestParserSlowLog001(t *testing.T) {
8585
BoolMetrics: map[string]bool{},
8686
},
8787
}
88-
if diff, _ := deep.Equal(got, expect); diff != nil {
88+
if diff := deep.Equal(got, expect); diff != nil {
8989
dump(got)
9090
t.Error(diff)
9191
}
@@ -352,7 +352,7 @@ SET biz = '91848182522'`,
352352
},
353353
},
354354
}
355-
if diff, _ := deep.Equal(got, expect); diff != nil {
355+
if diff := deep.Equal(got, expect); diff != nil {
356356
dump(got)
357357
t.Error(diff)
358358
}
@@ -390,7 +390,7 @@ func TestParserSlowLog003(t *testing.T) {
390390
},
391391
},
392392
}
393-
if diff, _ := deep.Equal(got, expect); diff != nil {
393+
if diff := deep.Equal(got, expect); diff != nil {
394394
dump(got)
395395
t.Error(diff)
396396
}
@@ -418,7 +418,7 @@ func TestParserSlowLog004(t *testing.T) {
418418
},
419419
},
420420
}
421-
if diff, _ := deep.Equal(got, expect); diff != nil {
421+
if diff := deep.Equal(got, expect); diff != nil {
422422
dump(got)
423423
t.Error(diff)
424424
}
@@ -462,7 +462,7 @@ func TestParserSlowLog005(t *testing.T) {
462462
},
463463
},
464464
}
465-
if diff, _ := deep.Equal(got, expect); diff != nil {
465+
if diff := deep.Equal(got, expect); diff != nil {
466466
dump(got)
467467
t.Error(diff)
468468
}
@@ -642,7 +642,7 @@ func TestParserSlowLog006(t *testing.T) {
642642
},
643643
},
644644
}
645-
if diff, _ := deep.Equal(got, expect); diff != nil {
645+
if diff := deep.Equal(got, expect); diff != nil {
646646
dump(got)
647647
t.Error(diff)
648648
}
@@ -672,7 +672,7 @@ func TestParserSlowLog007(t *testing.T) {
672672
},
673673
},
674674
}
675-
if diff, _ := deep.Equal(got, expect); diff != nil {
675+
if diff := deep.Equal(got, expect); diff != nil {
676676
dump(got)
677677
t.Error(diff)
678678
}
@@ -742,7 +742,7 @@ func TestParserSlowLog008(t *testing.T) {
742742
},
743743
},
744744
}
745-
if diff, _ := deep.Equal(got, expect); diff != nil {
745+
if diff := deep.Equal(got, expect); diff != nil {
746746
dump(got)
747747
t.Error(diff)
748748
}
@@ -788,7 +788,7 @@ func TestParserSlowLog009(t *testing.T) {
788788
},
789789
},
790790
}
791-
if diff, _ := deep.Equal(got, expect); diff != nil {
791+
if diff := deep.Equal(got, expect); diff != nil {
792792
dump(got)
793793
t.Error(diff)
794794
}
@@ -920,7 +920,7 @@ func TestParserSlowLog011(t *testing.T) {
920920
},
921921
},
922922
}
923-
if diff, _ := deep.Equal(got, expect); diff != nil {
923+
if diff := deep.Equal(got, expect); diff != nil {
924924
dump(got)
925925
t.Error(diff)
926926
}
@@ -980,7 +980,7 @@ func TestParserSlowLog012(t *testing.T) {
980980
BoolMetrics: map[string]bool{},
981981
},
982982
}
983-
if diff, _ := deep.Equal(got, expect); diff != nil {
983+
if diff := deep.Equal(got, expect); diff != nil {
984984
dump(got)
985985
t.Error(diff)
986986
}
@@ -1096,7 +1096,7 @@ func TestParserSlowLog013(t *testing.T) {
10961096
BoolMetrics: map[string]bool{},
10971097
},
10981098
}
1099-
if diff, _ := deep.Equal(got, expect); diff != nil {
1099+
if diff := deep.Equal(got, expect); diff != nil {
11001100
dump(got)
11011101
t.Error(diff)
11021102
}
@@ -1272,7 +1272,7 @@ func TestParserSlowLog014(t *testing.T) {
12721272
},
12731273
},
12741274
}
1275-
if diff, _ := deep.Equal(got, expect); diff != nil {
1275+
if diff := deep.Equal(got, expect); diff != nil {
12761276
dump(got)
12771277
t.Error(diff)
12781278
}
@@ -1300,7 +1300,7 @@ func TestParserSlowLog001StartOffset(t *testing.T) {
13001300
BoolMetrics: map[string]bool{},
13011301
},
13021302
}
1303-
if diff, _ := deep.Equal(got, expect); diff != nil {
1303+
if diff := deep.Equal(got, expect); diff != nil {
13041304
dump(got)
13051305
t.Error(diff)
13061306
}
@@ -1338,7 +1338,7 @@ func TestParseSlow016(t *testing.T) {
13381338
BoolMetrics: map[string]bool{},
13391339
},
13401340
}
1341-
if diff, _ := deep.Equal(got, expect); diff != nil {
1341+
if diff := deep.Equal(got, expect); diff != nil {
13421342
dump(got)
13431343
t.Error(diff)
13441344
}
@@ -1367,7 +1367,7 @@ func TestParseSlow017(t *testing.T) {
13671367
BoolMetrics: map[string]bool{},
13681368
},
13691369
}
1370-
if diff, _ := deep.Equal(got, expect); diff != nil {
1370+
if diff := deep.Equal(got, expect); diff != nil {
13711371
dump(got)
13721372
t.Error(diff)
13731373
}
@@ -1517,7 +1517,7 @@ func TestParseSlow019(t *testing.T) {
15171517
},
15181518
},
15191519
}
1520-
if diff, _ := deep.Equal(got, expect); diff != nil {
1520+
if diff := deep.Equal(got, expect); diff != nil {
15211521
dump(got)
15221522
t.Error(diff)
15231523
}
@@ -1695,7 +1695,7 @@ func TestParseSlow023(t *testing.T) {
16951695
RateLimit: 0,
16961696
},
16971697
}
1698-
if diff, _ := deep.Equal(got, expect); diff != nil {
1698+
if diff := deep.Equal(got, expect); diff != nil {
16991699
dump(got)
17001700
//dump(expect)
17011701
t.Error(diff)
@@ -1789,7 +1789,7 @@ func TestParseSlow024(t *testing.T) {
17891789
RateLimit: 0,
17901790
},
17911791
}
1792-
if diff, _ := deep.Equal(got, expect); diff != nil {
1792+
if diff := deep.Equal(got, expect); diff != nil {
17931793
dump(got)
17941794
t.Error(diff)
17951795
}

slowlog_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ import (
99
"fmt"
1010

1111
"github.com/go-mysql/slowlog"
12+
"github.com/go-test/deep"
1213
)
1314

1415
var noOptions = slowlog.Options{}
1516

17+
func init() {
18+
deep.FloatPrecision = 6 // microsecond time
19+
deep.LogErrors = true
20+
}
21+
1622
func dump(v interface{}) {
1723
bytes, _ := json.MarshalIndent(v, "", " ")
1824
fmt.Println(string(bytes))

vendor/github.com/daniel-nichter/deep-equal/README.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

vendor/github.com/go-test/deep/.gitignore

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/go-test/deep/.travis.yml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/daniel-nichter/deep-equal/LICENSE renamed to vendor/github.com/go-test/deep/LICENSE

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)