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

Method validateSpans

test/core/TestMultiGetQuery.java:873–947  ·  view source on GitHub ↗

Validates the data setup in #setupStorage() is returned in the requests. @throws Exception if something went pear shaped.

()

Source from the content-addressed store, hash-verified

871 * @throws Exception if something went pear shaped.
872 */
873 protected void validateSpans() throws Exception {
874 System.out.println(spans);
875 assertEquals(3, spans.size());
876 Span span = spans.get(getRowKey(METRIC_STRING, (int) start_ts, TAGK_STRING,
877 "A", TAGK_B_STRING, "D"));
878 SeekableView view = span.iterator();
879 long ts = start_ts * 1000;
880 long v = 1;
881 while (view.hasNext()) {
882 DataPoint dp = view.next();
883 assertEquals(ts, dp.timestamp());
884 assertEquals(v++, dp.longValue());
885 ts += 3600000;
886 }
887
888 span = spans.get(getRowKey(METRIC_STRING, (int) start_ts, TAGK_STRING,
889 "B", TAGK_B_STRING, "D"));
890 view = span.iterator();
891 ts = start_ts * 1000;
892 v = 11;
893 while (view.hasNext()) {
894 DataPoint dp = view.next();
895 assertEquals(ts, dp.timestamp());
896 assertEquals(v++, dp.longValue());
897 ts += 3600000;
898 }
899
900 span = spans.get(getRowKey(METRIC_STRING, (int) start_ts, TAGK_STRING,
901 "C", TAGK_B_STRING, "D"));
902 view = span.iterator();
903 ts = start_ts * 1000;
904 v = 111;
905 while (view.hasNext()) {
906 DataPoint dp = view.next();
907 assertEquals(ts, dp.timestamp());
908 assertEquals(v++, dp.longValue());
909 ts += 3600000;
910 }
911
912 span = spans.get(getRowKey(METRIC_STRING, (int) start_ts, TAGK_STRING,
913 "A", TAGK_B_STRING, "D"));
914 view = span.iterator();
915 ts = start_ts * 1000;
916 v = 1;
917 while (view.hasNext()) {
918 DataPoint dp = view.next();
919 assertEquals(ts, dp.timestamp());
920 assertEquals(v++, dp.longValue());
921 ts += 3600000;
922 }
923
924 span = spans.get(getRowKey(METRIC_STRING, (int) start_ts, TAGK_STRING,
925 "B", TAGK_B_STRING, "D"));
926 view = span.iterator();
927 ts = start_ts * 1000;
928 v = 11;
929 while (view.hasNext()) {
930 DataPoint dp = view.next();

Callers 3

fetchMethod · 0.95
fetchSmallBatchMethod · 0.95

Calls 8

iteratorMethod · 0.95
hasNextMethod · 0.95
nextMethod · 0.95
timestampMethod · 0.95
longValueMethod · 0.95
sizeMethod · 0.65
getMethod · 0.45
getRowKeyMethod · 0.45

Tested by

no test coverage detected