@@ -31,9 +31,9 @@ func TestPgReplicationSlotCollectorActive(t *testing.T) {
3131
3232 inst := & instance {db : db }
3333
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" }
3535 rows := sqlmock .NewRows (columns ).
36- AddRow ("test_slot" , "physical" , 5 , 3 , true )
36+ AddRow ("test_slot" , "physical" , 5 , 3 , true , 323906992 )
3737 mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
3838
3939 ch := make (chan prometheus.Metric )
@@ -50,6 +50,7 @@ func TestPgReplicationSlotCollectorActive(t *testing.T) {
5050 {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 5 , metricType : dto .MetricType_GAUGE },
5151 {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 3 , metricType : dto .MetricType_GAUGE },
5252 {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 },
5354 }
5455
5556 convey .Convey ("Metrics comparison" , t , func () {
@@ -72,9 +73,9 @@ func TestPgReplicationSlotCollectorInActive(t *testing.T) {
7273
7374 inst := & instance {db : db }
7475
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" }
7677 rows := sqlmock .NewRows (columns ).
77- AddRow ("test_slot" , "physical" , 6 , 12 , false )
78+ AddRow ("test_slot" , "physical" , 6 , 12 , false , - 4000 )
7879 mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
7980
8081 ch := make (chan prometheus.Metric )
@@ -90,6 +91,7 @@ func TestPgReplicationSlotCollectorInActive(t *testing.T) {
9091 expected := []MetricResult {
9192 {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 6 , metricType : dto .MetricType_GAUGE },
9293 {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 },
9395 }
9496
9597 convey .Convey ("Metrics comparison" , t , func () {
@@ -113,9 +115,9 @@ func TestPgReplicationSlotCollectorActiveNil(t *testing.T) {
113115
114116 inst := & instance {db : db }
115117
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" }
117119 rows := sqlmock .NewRows (columns ).
118- AddRow ("test_slot" , "physical" , 6 , 12 , nil )
120+ AddRow ("test_slot" , "physical" , 6 , 12 , nil , nil )
119121 mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
120122
121123 ch := make (chan prometheus.Metric )
@@ -153,9 +155,9 @@ func TestPgReplicationSlotCollectorTestNilValues(t *testing.T) {
153155
154156 inst := & instance {db : db }
155157
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" }
157159 rows := sqlmock .NewRows (columns ).
158- AddRow (nil , nil , nil , nil , true )
160+ AddRow (nil , nil , nil , nil , true , nil )
159161 mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
160162
161163 ch := make (chan prometheus.Metric )
0 commit comments