Skip to content

Commit

Permalink
Tests: Fix convert error tests to use fixed value
Browse files Browse the repository at this point in the history
The error tests for hex values previously used a random string of
digits, but this could be a valid hex value. This commit changes these
tests to use a fixed invalid hex value.

closes elastic#32370
  • Loading branch information
rjernst committed Jul 26, 2018
1 parent 1628c83 commit 0cf7737
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ public void testConvertIntLeadingZero() throws Exception {
assertThat(ingestDocument.getFieldValue(fieldName, Integer.class), equalTo(10));
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/32370")
public void testConvertIntHexError() {
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random());
String value = "0x" + randomAlphaOfLengthBetween(1, 10);
String value = "0xnotanumber";
String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, value);
Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, Type.INTEGER, false);
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> processor.execute(ingestDocument));
Expand Down Expand Up @@ -140,7 +139,7 @@ public void testConvertLongLeadingZero() throws Exception {

public void testConvertLongHexError() {
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random());
String value = "0x" + randomAlphaOfLengthBetween(1, 10);
String value = "0xnotanumber";
String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, value);
Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, Type.LONG, false);
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> processor.execute(ingestDocument));
Expand Down

0 comments on commit 0cf7737

Please sign in to comment.