MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / postQueryNoMetricBadRequest

Method postQueryNoMetricBadRequest

test/tsd/TestQueryRpc.java:505–522  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 9

postQueryMethod · 0.95
getCauseMethod · 0.80
responseMethod · 0.80
containsMethod · 0.80
configureFromQueryMethod · 0.65
executeMethod · 0.65
getStatusMethod · 0.65
toStringMethod · 0.45
getContentMethod · 0.45

Tested by

no test coverage detected