@@ -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" , "safe_wal_size" }
34
+ columns := []string {"slot_name" , "slot_type" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" , "safe_wal_size" , "wal_status" }
35
35
rows := sqlmock .NewRows (columns ).
36
- AddRow ("test_slot" , "physical" , 5 , 3 , true , 323906992 )
36
+ AddRow ("test_slot" , "physical" , 5 , 3 , true , 323906992 , "reserved" )
37
37
mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
38
38
39
39
ch := make (chan prometheus.Metric )
@@ -51,6 +51,7 @@ func TestPgReplicationSlotCollectorActive(t *testing.T) {
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
53
{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 },
54
55
}
55
56
56
57
convey .Convey ("Metrics comparison" , t , func () {
@@ -73,9 +74,9 @@ func TestPgReplicationSlotCollectorInActive(t *testing.T) {
73
74
74
75
inst := & instance {db : db }
75
76
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" }
77
78
rows := sqlmock .NewRows (columns ).
78
- AddRow ("test_slot" , "physical" , 6 , 12 , false , - 4000 )
79
+ AddRow ("test_slot" , "physical" , 6 , 12 , false , - 4000 , "extended" )
79
80
mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
80
81
81
82
ch := make (chan prometheus.Metric )
@@ -92,6 +93,7 @@ func TestPgReplicationSlotCollectorInActive(t *testing.T) {
92
93
{labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 6 , metricType : dto .MetricType_GAUGE },
93
94
{labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 0 , metricType : dto .MetricType_GAUGE },
94
95
{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 },
95
97
}
96
98
97
99
convey .Convey ("Metrics comparison" , t , func () {
@@ -115,9 +117,9 @@ func TestPgReplicationSlotCollectorActiveNil(t *testing.T) {
115
117
116
118
inst := & instance {db : db }
117
119
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" }
119
121
rows := sqlmock .NewRows (columns ).
120
- AddRow ("test_slot" , "physical" , 6 , 12 , nil , nil )
122
+ AddRow ("test_slot" , "physical" , 6 , 12 , nil , nil , "lost" )
121
123
mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
122
124
123
125
ch := make (chan prometheus.Metric )
@@ -133,6 +135,7 @@ func TestPgReplicationSlotCollectorActiveNil(t *testing.T) {
133
135
expected := []MetricResult {
134
136
{labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 6 , metricType : dto .MetricType_GAUGE },
135
137
{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 },
136
139
}
137
140
138
141
convey .Convey ("Metrics comparison" , t , func () {
@@ -155,9 +158,9 @@ func TestPgReplicationSlotCollectorTestNilValues(t *testing.T) {
155
158
156
159
inst := & instance {db : db }
157
160
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" }
159
162
rows := sqlmock .NewRows (columns ).
160
- AddRow (nil , nil , nil , nil , true , nil )
163
+ AddRow (nil , nil , nil , nil , true , nil , nil )
161
164
mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
162
165
163
166
ch := make (chan prometheus.Metric )
0 commit comments