@@ -31,9 +31,9 @@ func TestPgReplicationSlotCollectorActive(t *testing.T) {
3131
3232 inst := & instance {db : db }
3333
34- columns := []string {"slot_name" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" }
34+ columns := []string {"slot_name" , "slot_type" , " current_wal_lsn" , "confirmed_flush_lsn" , "active" }
3535 rows := sqlmock .NewRows (columns ).
36- AddRow ("test_slot" , 5 , 3 , true )
36+ AddRow ("test_slot" , "physical" , 5 , 3 , true )
3737 mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
3838
3939 ch := make (chan prometheus.Metric )
@@ -47,9 +47,9 @@ func TestPgReplicationSlotCollectorActive(t *testing.T) {
4747 }()
4848
4949 expected := []MetricResult {
50- {labels : labelMap {"slot_name" : "test_slot" }, value : 5 , metricType : dto .MetricType_GAUGE },
51- {labels : labelMap {"slot_name" : "test_slot" }, value : 3 , metricType : dto .MetricType_GAUGE },
52- {labels : labelMap {"slot_name" : "test_slot" }, value : 1 , metricType : dto .MetricType_GAUGE },
50+ {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 5 , metricType : dto .MetricType_GAUGE },
51+ {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 3 , metricType : dto .MetricType_GAUGE },
52+ {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 1 , metricType : dto .MetricType_GAUGE },
5353 }
5454
5555 convey .Convey ("Metrics comparison" , t , func () {
@@ -72,9 +72,9 @@ func TestPgReplicationSlotCollectorInActive(t *testing.T) {
7272
7373 inst := & instance {db : db }
7474
75- columns := []string {"slot_name" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" }
75+ columns := []string {"slot_name" , "slot_type" , " current_wal_lsn" , "confirmed_flush_lsn" , "active" }
7676 rows := sqlmock .NewRows (columns ).
77- AddRow ("test_slot" , 6 , 12 , false )
77+ AddRow ("test_slot" , "physical" , 6 , 12 , false )
7878 mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
7979
8080 ch := make (chan prometheus.Metric )
@@ -88,8 +88,8 @@ func TestPgReplicationSlotCollectorInActive(t *testing.T) {
8888 }()
8989
9090 expected := []MetricResult {
91- {labels : labelMap {"slot_name" : "test_slot" }, value : 6 , metricType : dto .MetricType_GAUGE },
92- {labels : labelMap {"slot_name" : "test_slot" }, value : 0 , metricType : dto .MetricType_GAUGE },
91+ {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 6 , metricType : dto .MetricType_GAUGE },
92+ {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 0 , metricType : dto .MetricType_GAUGE },
9393 }
9494
9595 convey .Convey ("Metrics comparison" , t , func () {
@@ -113,9 +113,9 @@ func TestPgReplicationSlotCollectorActiveNil(t *testing.T) {
113113
114114 inst := & instance {db : db }
115115
116- columns := []string {"slot_name" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" }
116+ columns := []string {"slot_name" , "slot_type" , " current_wal_lsn" , "confirmed_flush_lsn" , "active" }
117117 rows := sqlmock .NewRows (columns ).
118- AddRow ("test_slot" , 6 , 12 , nil )
118+ AddRow ("test_slot" , "physical" , 6 , 12 , nil )
119119 mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
120120
121121 ch := make (chan prometheus.Metric )
@@ -129,8 +129,8 @@ func TestPgReplicationSlotCollectorActiveNil(t *testing.T) {
129129 }()
130130
131131 expected := []MetricResult {
132- {labels : labelMap {"slot_name" : "test_slot" }, value : 6 , metricType : dto .MetricType_GAUGE },
133- {labels : labelMap {"slot_name" : "test_slot" }, value : 0 , metricType : dto .MetricType_GAUGE },
132+ {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 6 , metricType : dto .MetricType_GAUGE },
133+ {labels : labelMap {"slot_name" : "test_slot" , "slot_type" : "physical" }, value : 0 , metricType : dto .MetricType_GAUGE },
134134 }
135135
136136 convey .Convey ("Metrics comparison" , t , func () {
@@ -153,9 +153,9 @@ func TestPgReplicationSlotCollectorTestNilValues(t *testing.T) {
153153
154154 inst := & instance {db : db }
155155
156- columns := []string {"slot_name" , "current_wal_lsn" , "confirmed_flush_lsn" , "active" }
156+ columns := []string {"slot_name" , "slot_type" , " current_wal_lsn" , "confirmed_flush_lsn" , "active" }
157157 rows := sqlmock .NewRows (columns ).
158- AddRow (nil , nil , nil , true )
158+ AddRow (nil , nil , nil , nil , true )
159159 mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
160160
161161 ch := make (chan prometheus.Metric )
@@ -169,9 +169,9 @@ func TestPgReplicationSlotCollectorTestNilValues(t *testing.T) {
169169 }()
170170
171171 expected := []MetricResult {
172- {labels : labelMap {"slot_name" : "unknown" }, value : 0 , metricType : dto .MetricType_GAUGE },
173- {labels : labelMap {"slot_name" : "unknown" }, value : 0 , metricType : dto .MetricType_GAUGE },
174- {labels : labelMap {"slot_name" : "unknown" }, value : 1 , metricType : dto .MetricType_GAUGE },
172+ {labels : labelMap {"slot_name" : "unknown" , "slot_type" : "unknown" }, value : 0 , metricType : dto .MetricType_GAUGE },
173+ {labels : labelMap {"slot_name" : "unknown" , "slot_type" : "unknown" }, value : 0 , metricType : dto .MetricType_GAUGE },
174+ {labels : labelMap {"slot_name" : "unknown" , "slot_type" : "unknown" }, value : 1 , metricType : dto .MetricType_GAUGE },
175175 }
176176
177177 convey .Convey ("Metrics comparison" , t , func () {
0 commit comments