@@ -10,7 +10,6 @@ import (
10
10
"github.com/influxdata/flux/execute"
11
11
"github.com/influxdata/flux/mock"
12
12
"github.com/influxdata/flux/plan"
13
- "github.com/influxdata/platform"
14
13
"github.com/pkg/errors"
15
14
"github.com/prometheus/client_golang/prometheus"
16
15
dto "github.com/prometheus/client_model/go"
@@ -33,18 +32,14 @@ func TestController_CompileQuery_Failure(t *testing.T) {
33
32
}
34
33
35
34
ctrl := New (Config {})
36
- req := & flux.Request {
37
- OrganizationID : platform .ID ("a" ),
38
- Compiler : compiler ,
39
- }
40
35
41
36
// Run the query. It should return an error.
42
- if _ , err := ctrl .Query (context .Background (), req ); err == nil {
37
+ if _ , err := ctrl .Query (context .Background (), compiler ); err == nil {
43
38
t .Fatal ("expected error" )
44
39
}
45
40
46
41
// Verify the metrics say there are no queries.
47
- gauge , err := ctrl .metrics .all .GetMetricWithLabelValues (req . OrganizationID . String () )
42
+ gauge , err := ctrl .metrics .all .GetMetricWithLabelValues ()
48
43
if err != nil {
49
44
t .Fatalf ("unexpected error: %s" , err )
50
45
}
@@ -71,13 +66,9 @@ func TestController_EnqueueQuery_Failure(t *testing.T) {
71
66
}
72
67
73
68
ctrl := New (Config {})
74
- req := & flux.Request {
75
- OrganizationID : platform .ID ("a" ),
76
- Compiler : compiler ,
77
- }
78
69
79
70
// Run the query. It should return an error.
80
- if _ , err := ctrl .Query (context .Background (), req ); err == nil {
71
+ if _ , err := ctrl .Query (context .Background (), compiler ); err == nil {
81
72
t .Fatal ("expected error" )
82
73
}
83
74
@@ -86,7 +77,7 @@ func TestController_EnqueueQuery_Failure(t *testing.T) {
86
77
"all" : ctrl .metrics .all ,
87
78
"queueing" : ctrl .metrics .queueing ,
88
79
} {
89
- gauge , err := gaugeVec .GetMetricWithLabelValues (req . OrganizationID . String () )
80
+ gauge , err := gaugeVec .GetMetricWithLabelValues ()
90
81
if err != nil {
91
82
t .Fatalf ("unexpected error: %s" , err )
92
83
}
@@ -104,19 +95,15 @@ func TestController_EnqueueQuery_Failure(t *testing.T) {
104
95
105
96
func TestController_ExecuteQuery_Failure (t * testing.T ) {
106
97
executor := mock .NewExecutor ()
107
- executor .ExecuteFn = func (context.Context , platform. ID , * plan.PlanSpec , * execute.Allocator ) (map [string ]flux.Result , error ) {
98
+ executor .ExecuteFn = func (context.Context , * plan.PlanSpec , * execute.Allocator ) (map [string ]flux.Result , error ) {
108
99
return nil , errors .New ("expected" )
109
100
}
110
101
111
102
ctrl := New (Config {})
112
103
ctrl .executor = executor
113
- req := & flux.Request {
114
- OrganizationID : platform .ID ("a" ),
115
- Compiler : mockCompiler ,
116
- }
117
104
118
105
// Run a query and then wait for it to be ready.
119
- q , err := ctrl .Query (context .Background (), req )
106
+ q , err := ctrl .Query (context .Background (), mockCompiler )
120
107
if err != nil {
121
108
t .Fatalf ("unexpected error: %s" , err )
122
109
}
@@ -134,7 +121,7 @@ func TestController_ExecuteQuery_Failure(t *testing.T) {
134
121
q .Done ()
135
122
136
123
// Verify the metrics say there are no queries.
137
- gauge , err := ctrl .metrics .all .GetMetricWithLabelValues (req . OrganizationID . String () )
124
+ gauge , err := ctrl .metrics .all .GetMetricWithLabelValues ()
138
125
if err != nil {
139
126
t .Fatalf ("unexpected error: %s" , err )
140
127
}
@@ -151,20 +138,16 @@ func TestController_ExecuteQuery_Failure(t *testing.T) {
151
138
152
139
func TestController_CancelQuery (t * testing.T ) {
153
140
executor := mock .NewExecutor ()
154
- executor .ExecuteFn = func (context.Context , platform. ID , * plan.PlanSpec , * execute.Allocator ) (map [string ]flux.Result , error ) {
141
+ executor .ExecuteFn = func (context.Context , * plan.PlanSpec , * execute.Allocator ) (map [string ]flux.Result , error ) {
155
142
// Return an empty result.
156
143
return map [string ]flux.Result {}, nil
157
144
}
158
145
159
146
ctrl := New (Config {})
160
147
ctrl .executor = executor
161
- req := & flux.Request {
162
- OrganizationID : platform .ID ("a" ),
163
- Compiler : mockCompiler ,
164
- }
165
148
166
149
// Run a query and then wait for it to be ready.
167
- q , err := ctrl .Query (context .Background (), req )
150
+ q , err := ctrl .Query (context .Background (), mockCompiler )
168
151
if err != nil {
169
152
t .Fatalf ("unexpected error: %s" , err )
170
153
}
@@ -179,7 +162,7 @@ func TestController_CancelQuery(t *testing.T) {
179
162
q .Done ()
180
163
181
164
// Verify the metrics say there are no queries.
182
- gauge , err := ctrl .metrics .all .GetMetricWithLabelValues (req . OrganizationID . String () )
165
+ gauge , err := ctrl .metrics .all .GetMetricWithLabelValues ()
183
166
if err != nil {
184
167
t .Fatalf ("unexpected error: %s" , err )
185
168
}
@@ -198,20 +181,16 @@ func TestController_BlockedExecutor(t *testing.T) {
198
181
done := make (chan struct {})
199
182
200
183
executor := mock .NewExecutor ()
201
- executor .ExecuteFn = func (context.Context , platform. ID , * plan.PlanSpec , * execute.Allocator ) (map [string ]flux.Result , error ) {
184
+ executor .ExecuteFn = func (context.Context , * plan.PlanSpec , * execute.Allocator ) (map [string ]flux.Result , error ) {
202
185
<- done
203
186
return nil , nil
204
187
}
205
188
206
189
ctrl := New (Config {})
207
190
ctrl .executor = executor
208
- req := & flux.Request {
209
- OrganizationID : platform .ID ("a" ),
210
- Compiler : mockCompiler ,
211
- }
212
191
213
192
// Run a query that will cause the controller to stall.
214
- q , err := ctrl .Query (context .Background (), req )
193
+ q , err := ctrl .Query (context .Background (), mockCompiler )
215
194
if err != nil {
216
195
t .Fatalf ("unexpected error: %s" , err )
217
196
}
@@ -234,7 +213,7 @@ func TestController_BlockedExecutor(t *testing.T) {
234
213
}
235
214
}()
236
215
237
- if _ , err := ctrl .Query (ctx , req ); err == nil {
216
+ if _ , err := ctrl .Query (ctx , mockCompiler ); err == nil {
238
217
t .Fatal ("expected error" )
239
218
} else if got , want := err , context .Canceled ; got != want {
240
219
t .Fatalf ("unexpected error: got=%q want=%q" , got , want )
0 commit comments