Skip to content

Commit

Permalink
Tests: Fix convert error tests to use fixed value (#32415)
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 #32370
  • Loading branch information
rjernst authored Jul 30, 2018
1 parent 0cae19c commit 34d006f
Showing 1 changed file with 2 additions and 4 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 @@ -138,10 +137,9 @@ public void testConvertLongLeadingZero() throws Exception {
assertThat(ingestDocument.getFieldValue(fieldName, Long.class), equalTo(10L));
}

@AwaitsFix( bugUrl = "https://github.com/elastic/elasticsearch/issues/32370")
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 34d006f

Please sign in to comment.