Skip to content

Commit 73d76ad

Browse files
committed
BWC changes
1 parent acc5907 commit 73d76ad

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

docs/changelog/130325.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ issues: []
66

77
breaking:
88
title: Return 400 on invalid processor(s) in Simulate API
9-
area: Ingest Node
9+
area: Ingest
1010
details: >-
1111
In earlier versions of {es}, the Simulate API would return a 500 error when encountering invalid processors. Now, it returns a 400 Bad Request error instead.
1212

modules/ingest-common/src/yamlRestTest/resources/rest-api-spec/test/ingest/120_grok.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ teardown:
158158
159159
---
160160
"Test simulate with invalid GROK pattern":
161+
- requires:
162+
cluster_features: ["simulate.ingest.400_on_failure"]
163+
reason: "simulate.ingest returned 500 on failure before"
161164
- skip:
162165
features: headers
163166
- do:

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/simulate.ingest/10_basic.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,9 @@ setup:
600600

601601
---
602602
"Test bad pipeline substitution":
603-
603+
- requires:
604+
cluster_features: ["simulate.ingest.400_on_failure"]
605+
reason: "simulate.ingest returned 500 on failure before"
604606
- skip:
605607
features: [headers, allowed_warnings]
606608

@@ -764,7 +766,7 @@ setup:
764766
- skip:
765767
features: headers
766768
- do:
767-
catch: request
769+
catch: bad_request
768770
headers:
769771
Content-Type: application/json
770772
simulate.ingest:
@@ -786,5 +788,5 @@ setup:
786788
}
787789
}
788790
}
789-
- match: { status: 500 }
791+
- match: { status: 400 }
790792
- contains: { error.reason: "Provided a pipeline property which is managed by the system: created_date." }

server/src/main/java/org/elasticsearch/ingest/IngestFeatures.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
import java.util.Set;
1717

1818
public class IngestFeatures implements FeatureSpecification {
19+
20+
private static final NodeFeature SIMULATE_INGEST_400_ON_FAILURE = new NodeFeature("simulate.ingest.400_on_failure", true);
21+
1922
@Override
2023
public Set<NodeFeature> getFeatures() {
2124
if (DataStream.LOGS_STREAM_FEATURE_FLAG) {
@@ -24,4 +27,9 @@ public Set<NodeFeature> getFeatures() {
2427
return Set.of();
2528
}
2629
}
30+
31+
@Override
32+
public Set<NodeFeature> getTestFeatures() {
33+
return Set.of(SIMULATE_INGEST_400_ON_FAILURE);
34+
}
2735
}

server/src/test/java/org/elasticsearch/ingest/SimulateIngestServiceTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import static org.hamcrest.Matchers.contains;
3737
import static org.hamcrest.Matchers.equalTo;
3838
import static org.hamcrest.Matchers.is;
39-
import static org.junit.Assert.assertThrows;
4039
import static org.mockito.ArgumentMatchers.anyString;
4140
import static org.mockito.Mockito.mock;
4241
import static org.mockito.Mockito.when;
@@ -136,7 +135,8 @@ public void testRethrowingOfElasticParseExceptionFromProcessors() {
136135
newHashMap("pipeline1", newHashMap("processors", List.of(Map.of("parse_exception_processor", new HashMap<>(0))))),
137136
Map.of(),
138137
Map.of(),
139-
Map.of()
138+
Map.of(),
139+
null
140140
);
141141

142142
final ElasticsearchParseException ex = assertThrows(

0 commit comments

Comments
 (0)