@@ -30,12 +30,10 @@ import (
30
30
json "github.com/json-iterator/go"
31
31
32
32
"github.com/prometheus/common/model"
33
-
34
- "github.com/prometheus/client_golang/api"
35
33
)
36
34
37
35
type apiTest struct {
38
- do func () (interface {}, api. Warnings , error )
36
+ do func () (interface {}, Warnings , error )
39
37
inWarnings []string
40
38
inErr error
41
39
inStatusCode int
@@ -45,7 +43,7 @@ type apiTest struct {
45
43
reqParam url.Values
46
44
reqMethod string
47
45
res interface {}
48
- warnings api. Warnings
46
+ warnings Warnings
49
47
err error
50
48
}
51
49
@@ -66,7 +64,7 @@ func (c *apiTestClient) URL(ep string, args map[string]string) *url.URL {
66
64
return u
67
65
}
68
66
69
- func (c * apiTestClient ) Do (ctx context.Context , req * http.Request ) (* http.Response , []byte , api. Warnings , error ) {
67
+ func (c * apiTestClient ) Do (ctx context.Context , req * http.Request ) (* http.Response , []byte , Warnings , error ) {
70
68
71
69
test := c .curTest
72
70
@@ -94,7 +92,7 @@ func (c *apiTestClient) Do(ctx context.Context, req *http.Request) (*http.Respon
94
92
return resp , b , test .inWarnings , test .inErr
95
93
}
96
94
97
- func (c * apiTestClient ) DoGetFallback (ctx context.Context , u * url.URL , args url.Values ) (* http.Response , []byte , api. Warnings , error ) {
95
+ func (c * apiTestClient ) DoGetFallback (ctx context.Context , u * url.URL , args url.Values ) (* http.Response , []byte , Warnings , error ) {
98
96
req , err := http .NewRequest (http .MethodPost , u .String (), strings .NewReader (args .Encode ()))
99
97
if err != nil {
100
98
return nil , nil , nil , err
@@ -113,92 +111,92 @@ func TestAPIs(t *testing.T) {
113
111
client : tc ,
114
112
}
115
113
116
- doAlertManagers := func () func () (interface {}, api. Warnings , error ) {
117
- return func () (interface {}, api. Warnings , error ) {
114
+ doAlertManagers := func () func () (interface {}, Warnings , error ) {
115
+ return func () (interface {}, Warnings , error ) {
118
116
v , err := promAPI .AlertManagers (context .Background ())
119
117
return v , nil , err
120
118
}
121
119
}
122
120
123
- doCleanTombstones := func () func () (interface {}, api. Warnings , error ) {
124
- return func () (interface {}, api. Warnings , error ) {
121
+ doCleanTombstones := func () func () (interface {}, Warnings , error ) {
122
+ return func () (interface {}, Warnings , error ) {
125
123
return nil , nil , promAPI .CleanTombstones (context .Background ())
126
124
}
127
125
}
128
126
129
- doConfig := func () func () (interface {}, api. Warnings , error ) {
130
- return func () (interface {}, api. Warnings , error ) {
127
+ doConfig := func () func () (interface {}, Warnings , error ) {
128
+ return func () (interface {}, Warnings , error ) {
131
129
v , err := promAPI .Config (context .Background ())
132
130
return v , nil , err
133
131
}
134
132
}
135
133
136
- doDeleteSeries := func (matcher string , startTime time.Time , endTime time.Time ) func () (interface {}, api. Warnings , error ) {
137
- return func () (interface {}, api. Warnings , error ) {
134
+ doDeleteSeries := func (matcher string , startTime time.Time , endTime time.Time ) func () (interface {}, Warnings , error ) {
135
+ return func () (interface {}, Warnings , error ) {
138
136
return nil , nil , promAPI .DeleteSeries (context .Background (), []string {matcher }, startTime , endTime )
139
137
}
140
138
}
141
139
142
- doFlags := func () func () (interface {}, api. Warnings , error ) {
143
- return func () (interface {}, api. Warnings , error ) {
140
+ doFlags := func () func () (interface {}, Warnings , error ) {
141
+ return func () (interface {}, Warnings , error ) {
144
142
v , err := promAPI .Flags (context .Background ())
145
143
return v , nil , err
146
144
}
147
145
}
148
146
149
- doLabelNames := func (label string ) func () (interface {}, api. Warnings , error ) {
150
- return func () (interface {}, api. Warnings , error ) {
147
+ doLabelNames := func (label string ) func () (interface {}, Warnings , error ) {
148
+ return func () (interface {}, Warnings , error ) {
151
149
return promAPI .LabelNames (context .Background ())
152
150
}
153
151
}
154
152
155
- doLabelValues := func (label string ) func () (interface {}, api. Warnings , error ) {
156
- return func () (interface {}, api. Warnings , error ) {
153
+ doLabelValues := func (label string ) func () (interface {}, Warnings , error ) {
154
+ return func () (interface {}, Warnings , error ) {
157
155
return promAPI .LabelValues (context .Background (), label )
158
156
}
159
157
}
160
158
161
- doQuery := func (q string , ts time.Time ) func () (interface {}, api. Warnings , error ) {
162
- return func () (interface {}, api. Warnings , error ) {
159
+ doQuery := func (q string , ts time.Time ) func () (interface {}, Warnings , error ) {
160
+ return func () (interface {}, Warnings , error ) {
163
161
return promAPI .Query (context .Background (), q , ts )
164
162
}
165
163
}
166
164
167
- doQueryRange := func (q string , rng Range ) func () (interface {}, api. Warnings , error ) {
168
- return func () (interface {}, api. Warnings , error ) {
165
+ doQueryRange := func (q string , rng Range ) func () (interface {}, Warnings , error ) {
166
+ return func () (interface {}, Warnings , error ) {
169
167
return promAPI .QueryRange (context .Background (), q , rng )
170
168
}
171
169
}
172
170
173
- doSeries := func (matcher string , startTime time.Time , endTime time.Time ) func () (interface {}, api. Warnings , error ) {
174
- return func () (interface {}, api. Warnings , error ) {
171
+ doSeries := func (matcher string , startTime time.Time , endTime time.Time ) func () (interface {}, Warnings , error ) {
172
+ return func () (interface {}, Warnings , error ) {
175
173
return promAPI .Series (context .Background (), []string {matcher }, startTime , endTime )
176
174
}
177
175
}
178
176
179
- doSnapshot := func (skipHead bool ) func () (interface {}, api. Warnings , error ) {
180
- return func () (interface {}, api. Warnings , error ) {
177
+ doSnapshot := func (skipHead bool ) func () (interface {}, Warnings , error ) {
178
+ return func () (interface {}, Warnings , error ) {
181
179
v , err := promAPI .Snapshot (context .Background (), skipHead )
182
180
return v , nil , err
183
181
}
184
182
}
185
183
186
- doRules := func () func () (interface {}, api. Warnings , error ) {
187
- return func () (interface {}, api. Warnings , error ) {
184
+ doRules := func () func () (interface {}, Warnings , error ) {
185
+ return func () (interface {}, Warnings , error ) {
188
186
v , err := promAPI .Rules (context .Background ())
189
187
return v , nil , err
190
188
}
191
189
}
192
190
193
- doTargets := func () func () (interface {}, api. Warnings , error ) {
194
- return func () (interface {}, api. Warnings , error ) {
191
+ doTargets := func () func () (interface {}, Warnings , error ) {
192
+ return func () (interface {}, Warnings , error ) {
195
193
v , err := promAPI .Targets (context .Background ())
196
194
return v , nil , err
197
195
}
198
196
}
199
197
200
- doTargetsMetadata := func (matchTarget string , metric string , limit string ) func () (interface {}, api. Warnings , error ) {
201
- return func () (interface {}, api. Warnings , error ) {
198
+ doTargetsMetadata := func (matchTarget string , metric string , limit string ) func () (interface {}, Warnings , error ) {
199
+ return func () (interface {}, Warnings , error ) {
202
200
v , err := promAPI .TargetsMetadata (context .Background (), matchTarget , metric , limit )
203
201
return v , nil , err
204
202
}
@@ -911,7 +909,7 @@ type apiClientTest struct {
911
909
response interface {}
912
910
expectedBody string
913
911
expectedErr * Error
914
- expectedWarnings api. Warnings
912
+ expectedWarnings Warnings
915
913
}
916
914
917
915
func (c * testClient ) URL (ep string , args map [string ]string ) * url.URL {
0 commit comments