This repository was archived by the owner on Nov 28, 2022. It is now read-only.
File tree 3 files changed +15
-2
lines changed
3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ func connect(t *testing.T) *sql.DB {
95
95
}
96
96
97
97
func createTestTable (t * testing.T , db * sql.DB ) func () {
98
- _ , err := db .Exec ("CREATE TABLE IF NOT EXISTS testtable(id bigint)" )
98
+ _ , err := db .Exec ("CREATE TABLE IF NOT EXISTS testtable(id bigint PRIMARY KEY )" )
99
99
require .NoError (t , err )
100
100
return func () {
101
101
_ , err := db .Exec ("DROP TABLE IF EXISTS testtable" )
Original file line number Diff line number Diff line change @@ -6,6 +6,19 @@ import (
6
6
"github.com/stretchr/testify/assert"
7
7
)
8
8
9
+ func TestIndexesScans (t * testing.T ) {
10
+ var assert = assert .New (t )
11
+ db , gauges , close := prepare (t )
12
+ defer close ()
13
+ dropTestTable := createTestTable (t , db )
14
+ defer dropTestTable ()
15
+
16
+ var metrics = evaluate (t , gauges .IndexesScans ())
17
+ assert .Len (metrics , 1 )
18
+ assertEqual (t , 0 , metrics [0 ])
19
+ assertNoErrs (t , gauges )
20
+ }
21
+
9
22
func TestUnusedIndexes (t * testing.T ) {
10
23
var assert = assert .New (t )
11
24
_ , gauges , close := prepare (t )
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ func TestTableSizes(t *testing.T) {
16
16
var metrics = evaluate (t , gauges .TableSizes ())
17
17
assert .Len (metrics , 3 )
18
18
for _ , metric := range metrics {
19
- assertEqual (t , 0 , metric )
19
+ assertGreaterThan (t , - 1 , metric )
20
20
}
21
21
assertNoErrs (t , gauges )
22
22
}
You can’t perform that action at this time.
0 commit comments