@@ -31,9 +31,9 @@ func TestPgReplicationSlotCollectorActive(t *testing.T) {
31
31
32
32
inst := & instance {db : db }
33
33
34
- columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" }
34
+ columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" , "safe_wal_size" }
35
35
rows := sqlmock .NewRows (columns ).
36
- AddRow ("test_slot" , "physical" , 5 , 3 , true )
36
+ AddRow ("test_slot" , "physical" , 5 , 3 , true , 323906992 )
37
37
mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
38
38
39
39
ch := make (chan prometheus.Metric )
@@ -50,6 +50,7 @@ func TestPgReplicationSlotCollectorActive(t *testing.T) {
50
50
{labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 5 , metricType : dto .MetricType_GAUGE },
51
51
{labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 3 , metricType : dto .MetricType_GAUGE },
52
52
{labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 1 , metricType : dto .MetricType_GAUGE },
53
+ {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 323906992 , metricType : dto .MetricType_GAUGE },
53
54
}
54
55
55
56
convey .Convey ("Metrics comparison" , t , func () {
@@ -72,9 +73,9 @@ func TestPgReplicationSlotCollectorInActive(t *testing.T) {
72
73
73
74
inst := & instance {db : db }
74
75
75
- columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" }
76
+ columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" , "safe_wal_size" }
76
77
rows := sqlmock .NewRows (columns ).
77
- AddRow ("test_slot" , "physical" , 6 , 12 , false )
78
+ AddRow ("test_slot" , "physical" , 6 , 12 , false , - 4000 )
78
79
mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
79
80
80
81
ch := make (chan prometheus.Metric )
@@ -90,6 +91,7 @@ func TestPgReplicationSlotCollectorInActive(t *testing.T) {
90
91
expected := []MetricResult {
91
92
{labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 6 , metricType : dto .MetricType_GAUGE },
92
93
{labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 0 , metricType : dto .MetricType_GAUGE },
94
+ {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : - 4000 , metricType : dto .MetricType_GAUGE },
93
95
}
94
96
95
97
convey .Convey ("Metrics comparison" , t , func () {
@@ -113,9 +115,9 @@ func TestPgReplicationSlotCollectorActiveNil(t *testing.T) {
113
115
114
116
inst := & instance {db : db }
115
117
116
- columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" }
118
+ columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" , "safe_wal_size" }
117
119
rows := sqlmock .NewRows (columns ).
118
- AddRow ("test_slot" , "physical" , 6 , 12 , nil )
120
+ AddRow ("test_slot" , "physical" , 6 , 12 , nil , nil )
119
121
mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
120
122
121
123
ch := make (chan prometheus.Metric )
@@ -153,9 +155,9 @@ func TestPgReplicationSlotCollectorTestNilValues(t *testing.T) {
153
155
154
156
inst := & instance {db : db }
155
157
156
- columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" }
158
+ columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" , "safe_wal_size" }
157
159
rows := sqlmock .NewRows (columns ).
158
- AddRow (nil , nil , nil , nil , true )
160
+ AddRow (nil , nil , nil , nil , true , nil )
159
161
mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
160
162
161
163
ch := make (chan prometheus.Metric )
0 commit comments