()
| 503 | } |
| 504 | |
| 505 | @Test |
| 506 | public void postQueryNoMetricBadRequest() throws Exception { |
| 507 | final DeferredGroupException dge = mock(DeferredGroupException.class); |
| 508 | when(dge.getCause()).thenReturn(new NoSuchUniqueName("foo", "metrics")); |
| 509 | |
| 510 | when(query_result.configureFromQuery((TSQuery)any(), anyInt())) |
| 511 | .thenReturn(Deferred.fromError(dge)); |
| 512 | |
| 513 | HttpQuery query = NettyMocks.postQuery(tsdb, "/api/query", |
| 514 | "{\"start\":1425440315306,\"queries\":" + |
| 515 | "[{\"metric\":\"nonexistent\",\"aggregator\":\"sum\",\"rate\":true," + |
| 516 | "\"rateOptions\":{\"counter\":false}}]}"); |
| 517 | rpc.execute(tsdb, query); |
| 518 | assertEquals(HttpResponseStatus.BAD_REQUEST, query.response().getStatus()); |
| 519 | final String json = |
| 520 | query.response().getContent().toString(Charset.forName("UTF-8")); |
| 521 | assertTrue(json.contains("No such name for 'foo': 'metrics'")); |
| 522 | } |
| 523 | |
| 524 | @Test |
| 525 | public void executeEmpty() throws Exception { |
nothing calls this directly
no test coverage detected