| 665 | } |
| 666 | |
| 667 | @Test |
| 668 | public void gexpBadExpression() throws Exception { |
| 669 | final DataPoints[] datapoints = new DataPoints[1]; |
| 670 | datapoints[0] = new MockDataPoints().getMock(); |
| 671 | when(query_result.runAsync()).thenReturn( |
| 672 | Deferred.fromResult(datapoints)); |
| 673 | |
| 674 | final HttpQuery query = NettyMocks.getQuery(tsdb, |
| 675 | "/api/query/gexp?start=1h-ago&exp=scale(sum:sys.cpu.user,notanumber)"); |
| 676 | rpc.execute(tsdb, query); |
| 677 | assertEquals(query.response().getStatus(), HttpResponseStatus.BAD_REQUEST); |
| 678 | final String json = |
| 679 | query.response().getContent().toString(Charset.forName("UTF-8")); |
| 680 | assertTrue(json.contains("factor")); |
| 681 | } |
| 682 | |
| 683 | @Test |
| 684 | public void testParsePercentile() { |