| 487 | } |
| 488 | |
| 489 | @Test |
| 490 | public void postQuerySimplePass() throws Exception { |
| 491 | final DataPoints[] datapoints = new DataPoints[1]; |
| 492 | datapoints[0] = new MockDataPoints().getMock(); |
| 493 | when(query_result.runAsync()).thenReturn( |
| 494 | Deferred.fromResult(datapoints)); |
| 495 | |
| 496 | HttpQuery query = NettyMocks.postQuery(tsdb, "/api/query", |
| 497 | "{\"start\":1425440315306,\"queries\":" + |
| 498 | "[{\"metric\":\"somemetric\",\"aggregator\":\"sum\",\"rate\":true," + |
| 499 | "\"rateOptions\":{\"counter\":false}}]}"); |
| 500 | NettyMocks.mockChannelFuture(query); |
| 501 | rpc.execute(tsdb, query); |
| 502 | assertEquals(HttpResponseStatus.OK, query.response().getStatus()); |
| 503 | } |
| 504 | |
| 505 | @Test |
| 506 | public void postQueryNoMetricBadRequest() throws Exception { |