@@ -56,39 +56,3 @@ func TestPGRolesCollector(t *testing.T) {
56
56
t .Errorf ("there were unfulfilled exceptions: %s" , err )
57
57
}
58
58
}
59
-
60
- func TestPGRolesCollectorNullMetric (t * testing.T ) {
61
- db , mock , err := sqlmock .New ()
62
- if err != nil {
63
- t .Fatalf ("Error opening a stub db connection: %s" , err )
64
- }
65
- defer db .Close ()
66
-
67
- inst := & instance {db : db }
68
-
69
- mock .ExpectQuery (sanitizeQuery (pgRolesConnectionLimitsQuery )).WillReturnRows (sqlmock .NewRows ([]string {"rolname" , "rolconnlimit" }).
70
- AddRow (nil , nil ))
71
-
72
- ch := make (chan prometheus.Metric )
73
- go func () {
74
- defer close (ch )
75
- c := PGRolesCollector {}
76
-
77
- if err := c .Update (context .Background (), inst , ch ); err != nil {
78
- t .Errorf ("Error calling PGRolesCollector.Update: %s" , err )
79
- }
80
- }()
81
-
82
- expected := []MetricResult {
83
- {labels : labelMap {"rolname" : "unknown" }, value : 0 , metricType : dto .MetricType_GAUGE },
84
- }
85
- convey .Convey ("Metrics comparison" , t , func () {
86
- for _ , expect := range expected {
87
- m := readMetric (<- ch )
88
- convey .So (expect , convey .ShouldResemble , m )
89
- }
90
- })
91
- if err := mock .ExpectationsWereMet (); err != nil {
92
- t .Errorf ("there were unfulfilled exceptions: %s" , err )
93
- }
94
- }
0 commit comments