@@ -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" , "safe_wal_size" }
34+ columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" , "safe_wal_size" , "wal_status" }
3535 rows := sqlmock .NewRows (columns ).
36- AddRow ("test_slot" , "physical" , 5 , 3 , true , 323906992 )
36+ AddRow ("test_slot" , "physical" , 5 , 3 , true , 323906992 , "reserved" )
3737 mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
3838
3939 ch := make (chan prometheus.Metric )
@@ -51,6 +51,7 @@ func TestPgReplicationSlotCollectorActive(t *testing.T) {
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 },
5353 {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 323906992 , metricType : dto .MetricType_GAUGE },
54+ {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 0 , metricType : dto .MetricType_GAUGE },
5455 }
5556
5657 convey .Convey ("Metrics comparison" , t , func () {
@@ -73,9 +74,9 @@ func TestPgReplicationSlotCollectorInActive(t *testing.T) {
7374
7475 inst := & instance {db : db }
7576
76- columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" , "safe_wal_size" }
77+ columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" , "safe_wal_size" , "wal_status" }
7778 rows := sqlmock .NewRows (columns ).
78- AddRow ("test_slot" , "physical" , 6 , 12 , false , - 4000 )
79+ AddRow ("test_slot" , "physical" , 6 , 12 , false , - 4000 , "extended" )
7980 mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
8081
8182 ch := make (chan prometheus.Metric )
@@ -92,6 +93,7 @@ func TestPgReplicationSlotCollectorInActive(t *testing.T) {
9293 {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 6 , metricType : dto .MetricType_GAUGE },
9394 {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 0 , metricType : dto .MetricType_GAUGE },
9495 {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : - 4000 , metricType : dto .MetricType_GAUGE },
96+ {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 1 , metricType : dto .MetricType_GAUGE },
9597 }
9698
9799 convey .Convey ("Metrics comparison" , t , func () {
@@ -115,9 +117,9 @@ func TestPgReplicationSlotCollectorActiveNil(t *testing.T) {
115117
116118 inst := & instance {db : db }
117119
118- columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" , "safe_wal_size" }
120+ columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" , "safe_wal_size" , "wal_status" }
119121 rows := sqlmock .NewRows (columns ).
120- AddRow ("test_slot" , "physical" , 6 , 12 , nil , nil )
122+ AddRow ("test_slot" , "physical" , 6 , 12 , nil , nil , "lost" )
121123 mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
122124
123125 ch := make (chan prometheus.Metric )
@@ -133,6 +135,7 @@ func TestPgReplicationSlotCollectorActiveNil(t *testing.T) {
133135 expected := []MetricResult {
134136 {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 6 , metricType : dto .MetricType_GAUGE },
135137 {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 0 , metricType : dto .MetricType_GAUGE },
138+ {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 3 , metricType : dto .MetricType_GAUGE },
136139 }
137140
138141 convey .Convey ("Metrics comparison" , t , func () {
@@ -155,9 +158,9 @@ func TestPgReplicationSlotCollectorTestNilValues(t *testing.T) {
155158
156159 inst := & instance {db : db }
157160
158- columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" , "safe_wal_size" }
161+ columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" , "safe_wal_size" , "wal_status" }
159162 rows := sqlmock .NewRows (columns ).
160- AddRow (nil , nil , nil , nil , true , nil )
163+ AddRow (nil , nil , nil , nil , true , nil , nil )
161164 mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
162165
163166 ch := make (chan prometheus.Metric )
0 commit comments