@@ -31,9 +31,9 @@ func TestPgReplicationSlotCollectorActive(t *testing.T) {
31
31
32
32
inst := & instance {db : db }
33
33
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" }
35
35
rows := sqlmock .NewRows (columns ).
36
- AddRow ("test_slot" , 5 , 3 , true )
36
+ AddRow ("test_slot" , "physical" , 5 , 3 , true )
37
37
mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
38
38
39
39
ch := make (chan prometheus.Metric )
@@ -47,9 +47,9 @@ func TestPgReplicationSlotCollectorActive(t *testing.T) {
47
47
}()
48
48
49
49
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 },
53
53
}
54
54
55
55
convey .Convey ("Metrics comparison" , t , func () {
@@ -72,9 +72,9 @@ func TestPgReplicationSlotCollectorInActive(t *testing.T) {
72
72
73
73
inst := & instance {db : db }
74
74
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" }
76
76
rows := sqlmock .NewRows (columns ).
77
- AddRow ("test_slot" , 6 , 12 , false )
77
+ AddRow ("test_slot" , "physical" , 6 , 12 , false )
78
78
mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
79
79
80
80
ch := make (chan prometheus.Metric )
@@ -88,8 +88,8 @@ func TestPgReplicationSlotCollectorInActive(t *testing.T) {
88
88
}()
89
89
90
90
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 },
93
93
}
94
94
95
95
convey .Convey ("Metrics comparison" , t , func () {
@@ -113,9 +113,9 @@ func TestPgReplicationSlotCollectorActiveNil(t *testing.T) {
113
113
114
114
inst := & instance {db : db }
115
115
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" }
117
117
rows := sqlmock .NewRows (columns ).
118
- AddRow ("test_slot" , 6 , 12 , nil )
118
+ AddRow ("test_slot" , "physical" , 6 , 12 , nil )
119
119
mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
120
120
121
121
ch := make (chan prometheus.Metric )
@@ -129,8 +129,8 @@ func TestPgReplicationSlotCollectorActiveNil(t *testing.T) {
129
129
}()
130
130
131
131
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 },
134
134
}
135
135
136
136
convey .Convey ("Metrics comparison" , t , func () {
@@ -153,9 +153,9 @@ func TestPgReplicationSlotCollectorTestNilValues(t *testing.T) {
153
153
154
154
inst := & instance {db : db }
155
155
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" }
157
157
rows := sqlmock .NewRows (columns ).
158
- AddRow (nil , nil , nil , true )
158
+ AddRow (nil , nil , nil , nil , true )
159
159
mock .ExpectQuery (sanitizeQuery (pgReplicationSlotQuery )).WillReturnRows (rows )
160
160
161
161
ch := make (chan prometheus.Metric )
@@ -169,9 +169,9 @@ func TestPgReplicationSlotCollectorTestNilValues(t *testing.T) {
169
169
}()
170
170
171
171
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 },
175
175
}
176
176
177
177
convey .Convey ("Metrics comparison" , t , func () {
0 commit comments