File tree 1 file changed +5
-7
lines changed
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 1
1
package collector
2
2
3
3
import (
4
+ "database/sql"
4
5
"testing"
5
6
6
7
"github.com/prometheus/client_golang/prometheus"
@@ -9,14 +10,16 @@ import (
9
10
"gopkg.in/DATA-DOG/go-sqlmock.v1"
10
11
)
11
12
13
+ const dsn = "root@/mysql"
14
+
12
15
func TestExporter (t * testing.T ) {
13
16
if testing .Short () {
14
17
t .Skip ("-short is passed, skipping test" )
15
18
}
16
19
17
- db , mock , err := sqlmock . New ( )
20
+ db , err := sql . Open ( "mysql" , dsn )
18
21
if err != nil {
19
- t .Fatalf ( "error opening a stub database connection: %s" , err )
22
+ t .Fatal ( err )
20
23
}
21
24
defer db .Close ()
22
25
@@ -49,11 +52,6 @@ func TestExporter(t *testing.T) {
49
52
}
50
53
}
51
54
})
52
-
53
- // We make sure that all expectations were met.
54
- if err := mock .ExpectationsWereMet (); err != nil {
55
- t .Errorf ("there were unfulfilled expectations: %s" , err )
56
- }
57
55
}
58
56
59
57
func TestGetMySQLVersion (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments