Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEWTS-132: Add 5 exceptional-behavior tests #188

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,13 @@ public void testBlacklist() {
compute.next().getElement("sum");
}
}

@Test(expected = UnsupportedOperationException.class)
public void testRemove() {
Iterator<Row<Measurement>> testData = new MeasurementRowsBuilder(new Resource("localhost")).row(300).element("in", 2).element("out", 2).row(600).element("in", 6).element("out", 4).build();
ResultDescriptor rDescriptor = new ResultDescriptor().datasource("in", AVERAGE).datasource("out", AVERAGE).calculate("total", PLUS, "in", "out");
Iterator<Row<Measurement>> expected = new MeasurementRowsBuilder(new Resource("localhost")).row(300).element("in", 2).element("out", 2).element("total", 4).row(600).element("in", 6).element("out", 4).element("total", 10).build();
Compute compute = new Compute(rDescriptor, testData);
compute.remove();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,14 @@ public void test() {

}

@Test(expected = UnsupportedOperationException.class)
public void testRemove() {
Iterator<Row<Measurement>> testData = new MeasurementRowsBuilder(new Resource("localhost")).row(1).element("m0", 1).element("m1", 2).element("m2", 3).row(300).element("m0", 1).element("m1", 2).element("m2", 3).row(600).element("m0", 1).element("m1", 2).element("m2", 3).build();
ResultDescriptor rDescriptor = new ResultDescriptor().datasource("m1", null).export("m1");
Iterator<Row<Measurement>> expected = new MeasurementRowsBuilder(new Resource("localhost")).row(1).element("m1", 2).row(300).element("m1", 2).row(600).element("m1", 2).build();
assertRowsEqual(expected, new Export(rDescriptor.getExports(), testData));
Iterator<Row<Measurement>> it = new Export(rDescriptor.getExports(), testData);
it.remove();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -430,4 +430,9 @@ public void testHeartbeatNaNs() {
assertRowsEqual(expected, primaryData);

}

@Test(expected = UnsupportedOperationException.class)
public void testRemove() {
new PrimaryData(new Resource("localhost"), Timestamp.fromEpochSeconds(0), Timestamp.fromEpochSeconds(1000), new ResultDescriptor(), new SampleRowsBuilder(new Resource("localhost"), MetricType.GAUGE).row(0).element("m0", 0).row(100).element("m0", 1).build()).remove();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ public void testNanOnCounterWrap() {
}
}

@Test(expected = UnsupportedOperationException.class)
public void testRemove() {
Iterator<Results.Row<Sample>> input = new Rate(new Results<Sample>().iterator(), getMetrics(2)).iterator();
input.remove();
}

private Set<String> getMetrics(int number) {
return Sets.newHashSet(Arrays.copyOf(m_metrics, number));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,9 @@ public void test() {

}

@Test(expected = IllegalArgumentException.class)
public void testInvalidDuration() {
Duration.parse("100d 100w");
}

}