From c7fd503ddb2f1b3fb6af9a898f1d31bd1a4907e0 Mon Sep 17 00:00:00 2001 From: Suraj Singh Date: Fri, 20 May 2022 07:29:55 -0700 Subject: [PATCH] [Type removal] _type removal from tests of yaml tests (#3406) * [Type removal] _type removal from tests of yaml tests Signed-off-by: Suraj Singh * Fix spotless failures Signed-off-by: Suraj Singh * Fix assertion failures Signed-off-by: Suraj Singh * Fix assertion failures in DoSectionTests Signed-off-by: Suraj Singh (cherry picked from commit 6699624dde2ee214b8f40951a054e2dae0a45170) --- .../section/ClientYamlTestSuiteTests.java | 105 ++++-------------- .../rest/yaml/section/DoSectionTests.java | 52 +++------ .../rest-api-spec/test/suite1/10_basic.yml | 4 - 3 files changed, 40 insertions(+), 121 deletions(-) diff --git a/test/framework/src/test/java/org/opensearch/test/rest/yaml/section/ClientYamlTestSuiteTests.java b/test/framework/src/test/java/org/opensearch/test/rest/yaml/section/ClientYamlTestSuiteTests.java index f995e18d0f2df..40421ef43ab6b 100644 --- a/test/framework/src/test/java/org/opensearch/test/rest/yaml/section/ClientYamlTestSuiteTests.java +++ b/test/framework/src/test/java/org/opensearch/test/rest/yaml/section/ClientYamlTestSuiteTests.java @@ -32,8 +32,6 @@ package org.opensearch.test.rest.yaml.section; -import org.opensearch.LegacyESVersion; -import org.opensearch.Version; import org.opensearch.client.NodeSelector; import org.opensearch.common.ParsingException; import org.opensearch.common.xcontent.XContentLocation; @@ -76,23 +74,9 @@ public void testParseTestSetupTeardownAndSections() throws Exception { + " indices.get_mapping:\n" + " index: test_index\n" + "\n" - + " - match: {test_index.test_type.properties.text.type: string}\n" - + " - match: {test_index.test_type.properties.text.analyzer: whitespace}\n" + + " - match: {test_index.properties.text.type: string}\n" + + " - match: {test_index.properties.text.analyzer: whitespace}\n" + "\n" - + "---\n" - + "\"Get type mapping - pre 6.0\":\n" - + "\n" - + " - skip:\n" - + " version: \"6.0.0 - \"\n" - + " reason: \"for newer versions the index name is always returned\"\n" - + "\n" - + " - do:\n" - + " indices.get_mapping:\n" - + " index: test_index\n" - + " type: test_type\n" - + "\n" - + " - match: {test_type.properties.text.type: string}\n" - + " - match: {test_type.properties.text.analyzer: whitespace}\n" ); ClientYamlTestSuite restTestSuite = ClientYamlTestSuite.parse(getTestClass().getName(), getTestName(), parser); @@ -135,7 +119,7 @@ public void testParseTestSetupTeardownAndSections() throws Exception { assertThat(restTestSuite.getTeardownSection().isEmpty(), equalTo(true)); } - assertThat(restTestSuite.getTestSections().size(), equalTo(2)); + assertThat(restTestSuite.getTestSections().size(), equalTo(1)); assertThat(restTestSuite.getTestSections().get(0).getName(), equalTo("Get index mapping")); assertThat(restTestSuite.getTestSections().get(0).getSkipSection().isEmpty(), equalTo(true)); @@ -147,36 +131,13 @@ public void testParseTestSetupTeardownAndSections() throws Exception { assertThat(doSection.getApiCallSection().getParams().get("index"), equalTo("test_index")); assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(1), instanceOf(MatchAssertion.class)); MatchAssertion matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(1); - assertThat(matchAssertion.getField(), equalTo("test_index.test_type.properties.text.type")); + assertThat(matchAssertion.getField(), equalTo("test_index.properties.text.type")); assertThat(matchAssertion.getExpectedValue().toString(), equalTo("string")); assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(2), instanceOf(MatchAssertion.class)); matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(2); - assertThat(matchAssertion.getField(), equalTo("test_index.test_type.properties.text.analyzer")); + assertThat(matchAssertion.getField(), equalTo("test_index.properties.text.analyzer")); assertThat(matchAssertion.getExpectedValue().toString(), equalTo("whitespace")); - assertThat(restTestSuite.getTestSections().get(1).getName(), equalTo("Get type mapping - pre 6.0")); - assertThat(restTestSuite.getTestSections().get(1).getSkipSection().isEmpty(), equalTo(false)); - assertThat( - restTestSuite.getTestSections().get(1).getSkipSection().getReason(), - equalTo("for newer versions the index name is always returned") - ); - assertThat(restTestSuite.getTestSections().get(1).getSkipSection().getLowerVersion(), equalTo(LegacyESVersion.fromString("6.0.0"))); - assertThat(restTestSuite.getTestSections().get(1).getSkipSection().getUpperVersion(), equalTo(Version.CURRENT)); - assertThat(restTestSuite.getTestSections().get(1).getExecutableSections().size(), equalTo(3)); - assertThat(restTestSuite.getTestSections().get(1).getExecutableSections().get(0), instanceOf(DoSection.class)); - doSection = (DoSection) restTestSuite.getTestSections().get(1).getExecutableSections().get(0); - assertThat(doSection.getApiCallSection().getApi(), equalTo("indices.get_mapping")); - assertThat(doSection.getApiCallSection().getParams().size(), equalTo(2)); - assertThat(doSection.getApiCallSection().getParams().get("index"), equalTo("test_index")); - assertThat(doSection.getApiCallSection().getParams().get("type"), equalTo("test_type")); - assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(1), instanceOf(MatchAssertion.class)); - matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(1).getExecutableSections().get(1); - assertThat(matchAssertion.getField(), equalTo("test_type.properties.text.type")); - assertThat(matchAssertion.getExpectedValue().toString(), equalTo("string")); - assertThat(restTestSuite.getTestSections().get(1).getExecutableSections().get(2), instanceOf(MatchAssertion.class)); - matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(1).getExecutableSections().get(2); - assertThat(matchAssertion.getField(), equalTo("test_type.properties.text.analyzer")); - assertThat(matchAssertion.getExpectedValue().toString(), equalTo("whitespace")); } public void testParseTestSingleTestSection() throws Exception { @@ -188,24 +149,20 @@ public void testParseTestSingleTestSection() throws Exception { + " - do:\n" + " index:\n" + " index: test-weird-index-中文\n" - + " type: weird.type\n" + " id: 1\n" + " body: { foo: bar }\n" + "\n" + " - is_true: ok\n" + " - match: { _index: test-weird-index-中文 }\n" - + " - match: { _type: weird.type }\n" + " - match: { _id: \"1\"}\n" + " - match: { _version: 1}\n" + "\n" + " - do:\n" + " get:\n" + " index: test-weird-index-中文\n" - + " type: weird.type\n" + " id: 1\n" + "\n" + " - match: { _index: test-weird-index-中文 }\n" - + " - match: { _type: weird.type }\n" + " - match: { _id: \"1\"}\n" + " - match: { _version: 1}\n" + " - match: { _source: { foo: bar }}" @@ -222,12 +179,12 @@ public void testParseTestSingleTestSection() throws Exception { assertThat(restTestSuite.getTestSections().get(0).getName(), equalTo("Index with ID")); assertThat(restTestSuite.getTestSections().get(0).getSkipSection().isEmpty(), equalTo(true)); - assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().size(), equalTo(12)); + assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().size(), equalTo(10)); assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(0), instanceOf(DoSection.class)); DoSection doSection = (DoSection) restTestSuite.getTestSections().get(0).getExecutableSections().get(0); assertThat(doSection.getCatch(), nullValue()); assertThat(doSection.getApiCallSection().getApi(), equalTo("index")); - assertThat(doSection.getApiCallSection().getParams().size(), equalTo(3)); + assertThat(doSection.getApiCallSection().getParams().size(), equalTo(2)); assertThat(doSection.getApiCallSection().hasBody(), equalTo(true)); assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(1), instanceOf(IsTrueAssertion.class)); IsTrueAssertion trueAssertion = (IsTrueAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(1); @@ -238,40 +195,32 @@ public void testParseTestSingleTestSection() throws Exception { assertThat(matchAssertion.getExpectedValue().toString(), equalTo("test-weird-index-中文")); assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(3), instanceOf(MatchAssertion.class)); matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(3); - assertThat(matchAssertion.getField(), equalTo("_type")); - assertThat(matchAssertion.getExpectedValue().toString(), equalTo("weird.type")); - assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(4), instanceOf(MatchAssertion.class)); - matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(4); assertThat(matchAssertion.getField(), equalTo("_id")); assertThat(matchAssertion.getExpectedValue().toString(), equalTo("1")); - assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(5), instanceOf(MatchAssertion.class)); - matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(5); + assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(4), instanceOf(MatchAssertion.class)); + matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(4); assertThat(matchAssertion.getField(), equalTo("_version")); assertThat(matchAssertion.getExpectedValue().toString(), equalTo("1")); - assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(6), instanceOf(DoSection.class)); - doSection = (DoSection) restTestSuite.getTestSections().get(0).getExecutableSections().get(6); + assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(5), instanceOf(DoSection.class)); + doSection = (DoSection) restTestSuite.getTestSections().get(0).getExecutableSections().get(5); assertThat(doSection.getCatch(), nullValue()); assertThat(doSection.getApiCallSection().getApi(), equalTo("get")); - assertThat(doSection.getApiCallSection().getParams().size(), equalTo(3)); + assertThat(doSection.getApiCallSection().getParams().size(), equalTo(2)); assertThat(doSection.getApiCallSection().hasBody(), equalTo(false)); - assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(7), instanceOf(MatchAssertion.class)); - matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(7); + assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(6), instanceOf(MatchAssertion.class)); + matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(6); assertThat(matchAssertion.getField(), equalTo("_index")); assertThat(matchAssertion.getExpectedValue().toString(), equalTo("test-weird-index-中文")); - assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(8), instanceOf(MatchAssertion.class)); - matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(8); - assertThat(matchAssertion.getField(), equalTo("_type")); - assertThat(matchAssertion.getExpectedValue().toString(), equalTo("weird.type")); - assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(9), instanceOf(MatchAssertion.class)); - matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(9); + assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(7), instanceOf(MatchAssertion.class)); + matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(7); assertThat(matchAssertion.getField(), equalTo("_id")); assertThat(matchAssertion.getExpectedValue().toString(), equalTo("1")); - assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(10), instanceOf(MatchAssertion.class)); - matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(10); + assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(8), instanceOf(MatchAssertion.class)); + matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(8); assertThat(matchAssertion.getField(), equalTo("_version")); assertThat(matchAssertion.getExpectedValue().toString(), equalTo("1")); - assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(11), instanceOf(MatchAssertion.class)); - matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(11); + assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(9), instanceOf(MatchAssertion.class)); + matchAssertion = (MatchAssertion) restTestSuite.getTestSections().get(0).getExecutableSections().get(9); assertThat(matchAssertion.getField(), equalTo("_source")); assertThat(matchAssertion.getExpectedValue(), instanceOf(Map.class)); assertThat(((Map) matchAssertion.getExpectedValue()).get("foo").toString(), equalTo("bar")); @@ -287,14 +236,12 @@ public void testParseTestMultipleTestSections() throws Exception { + " catch: missing\n" + " update:\n" + " index: test_1\n" - + " type: test\n" + " id: 1\n" + " body: { doc: { foo: bar } }\n" + "\n" + " - do:\n" + " update:\n" + " index: test_1\n" - + " type: test\n" + " id: 1\n" + " body: { doc: { foo: bar } }\n" + " ignore: 404\n" @@ -307,7 +254,6 @@ public void testParseTestMultipleTestSections() throws Exception { + " catch: missing\n" + " update:\n" + " index: test_1\n" - + " type: test\n" + " id: 1\n" + " body:\n" + " script: \"ctx._source.foo = bar\"\n" @@ -316,7 +262,6 @@ public void testParseTestMultipleTestSections() throws Exception { + " - do:\n" + " update:\n" + " index: test_1\n" - + " type: test\n" + " id: 1\n" + " ignore: 404\n" + " body:\n" @@ -341,13 +286,13 @@ public void testParseTestMultipleTestSections() throws Exception { DoSection doSection = (DoSection) restTestSuite.getTestSections().get(0).getExecutableSections().get(0); assertThat(doSection.getCatch(), equalTo("missing")); assertThat(doSection.getApiCallSection().getApi(), equalTo("update")); - assertThat(doSection.getApiCallSection().getParams().size(), equalTo(3)); + assertThat(doSection.getApiCallSection().getParams().size(), equalTo(2)); assertThat(doSection.getApiCallSection().hasBody(), equalTo(true)); assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(1), instanceOf(DoSection.class)); doSection = (DoSection) restTestSuite.getTestSections().get(0).getExecutableSections().get(1); assertThat(doSection.getCatch(), nullValue()); assertThat(doSection.getApiCallSection().getApi(), equalTo("update")); - assertThat(doSection.getApiCallSection().getParams().size(), equalTo(4)); + assertThat(doSection.getApiCallSection().getParams().size(), equalTo(3)); assertThat(doSection.getApiCallSection().hasBody(), equalTo(true)); assertThat(restTestSuite.getTestSections().get(1).getName(), equalTo("Missing document (script)")); @@ -358,13 +303,13 @@ public void testParseTestMultipleTestSections() throws Exception { doSection = (DoSection) restTestSuite.getTestSections().get(1).getExecutableSections().get(0); assertThat(doSection.getCatch(), equalTo("missing")); assertThat(doSection.getApiCallSection().getApi(), equalTo("update")); - assertThat(doSection.getApiCallSection().getParams().size(), equalTo(3)); + assertThat(doSection.getApiCallSection().getParams().size(), equalTo(2)); assertThat(doSection.getApiCallSection().hasBody(), equalTo(true)); assertThat(restTestSuite.getTestSections().get(0).getExecutableSections().get(1), instanceOf(DoSection.class)); doSection = (DoSection) restTestSuite.getTestSections().get(1).getExecutableSections().get(1); assertThat(doSection.getCatch(), nullValue()); assertThat(doSection.getApiCallSection().getApi(), equalTo("update")); - assertThat(doSection.getApiCallSection().getParams().size(), equalTo(4)); + assertThat(doSection.getApiCallSection().getParams().size(), equalTo(3)); assertThat(doSection.getApiCallSection().hasBody(), equalTo(true)); } @@ -378,7 +323,6 @@ public void testParseTestDuplicateTestSections() throws Exception { + " catch: missing\n" + " update:\n" + " index: test_1\n" - + " type: test\n" + " id: 1\n" + " body: { doc: { foo: bar } }\n" + "\n" @@ -390,7 +334,6 @@ public void testParseTestDuplicateTestSections() throws Exception { + " catch: missing\n" + " update:\n" + " index: test_1\n" - + " type: test\n" + " id: 1\n" + " body:\n" + " script: \"ctx._source.foo = bar\"\n" diff --git a/test/framework/src/test/java/org/opensearch/test/rest/yaml/section/DoSectionTests.java b/test/framework/src/test/java/org/opensearch/test/rest/yaml/section/DoSectionTests.java index 53cae686e3cac..1fb08934c8b8b 100644 --- a/test/framework/src/test/java/org/opensearch/test/rest/yaml/section/DoSectionTests.java +++ b/test/framework/src/test/java/org/opensearch/test/rest/yaml/section/DoSectionTests.java @@ -173,19 +173,15 @@ public void testIgnoreTypesWarnings() { } public void testParseDoSectionNoBody() throws Exception { - parser = createParser( - YamlXContent.yamlXContent, - "get:\n" + " index: test_index\n" + " type: test_type\n" + " id: 1" - ); + parser = createParser(YamlXContent.yamlXContent, "get:\n" + " index: test_index\n" + " id: 1"); DoSection doSection = DoSection.parse(parser); ApiCallSection apiCallSection = doSection.getApiCallSection(); assertThat(apiCallSection, notNullValue()); assertThat(apiCallSection.getApi(), equalTo("get")); - assertThat(apiCallSection.getParams().size(), equalTo(3)); + assertThat(apiCallSection.getParams().size(), equalTo(2)); assertThat(apiCallSection.getParams().get("index"), equalTo("test_index")); - assertThat(apiCallSection.getParams().get("type"), equalTo("test_type")); assertThat(apiCallSection.getParams().get("id"), equalTo("1")); assertThat(apiCallSection.hasBody(), equalTo(false)); } @@ -204,19 +200,15 @@ public void testParseDoSectionNoParamsNoBody() throws Exception { public void testParseDoSectionWithJsonBody() throws Exception { String body = "{ \"include\": { \"field1\": \"v1\", \"field2\": \"v2\" }, \"count\": 1 }"; - parser = createParser( - YamlXContent.yamlXContent, - "index:\n" + " index: test_1\n" + " type: test\n" + " id: 1\n" + " body: " + body - ); + parser = createParser(YamlXContent.yamlXContent, "index:\n" + " index: test_1\n" + " id: 1\n" + " body: " + body); DoSection doSection = DoSection.parse(parser); ApiCallSection apiCallSection = doSection.getApiCallSection(); assertThat(apiCallSection, notNullValue()); assertThat(apiCallSection.getApi(), equalTo("index")); - assertThat(apiCallSection.getParams().size(), equalTo(3)); + assertThat(apiCallSection.getParams().size(), equalTo(2)); assertThat(apiCallSection.getParams().get("index"), equalTo("test_1")); - assertThat(apiCallSection.getParams().get("type"), equalTo("test")); assertThat(apiCallSection.getParams().get("id"), equalTo("1")); assertThat(apiCallSection.hasBody(), equalTo(true)); @@ -225,9 +217,9 @@ public void testParseDoSectionWithJsonBody() throws Exception { public void testParseDoSectionWithJsonMultipleBodiesAsLongString() throws Exception { String bodies[] = new String[] { - "{ \"index\": { \"_index\":\"test_index\", \"_type\":\"test_type\", \"_id\":\"test_id\" } }\n", + "{ \"index\": { \"_index\":\"test_index\", \"_id\":\"test_id\" } }\n", "{ \"f1\":\"v1\", \"f2\":42 }\n", - "{ \"index\": { \"_index\":\"test_index2\", \"_type\":\"test_type2\", \"_id\":\"test_id2\" } }\n", + "{ \"index\": { \"_index\":\"test_index2\", \"_id\":\"test_id2\" } }\n", "{ \"f1\":\"v2\", \"f2\":47 }\n" }; parser = createParser( YamlXContent.yamlXContent, @@ -284,21 +276,19 @@ public void testParseDoSectionWithYamlMultipleBodies() throws Exception { + " body:\n" + " - index:\n" + " _index: test_index\n" - + " _type: test_type\n" + " _id: test_id\n" + " - f1: v1\n" + " f2: 42\n" + " - index:\n" + " _index: test_index2\n" - + " _type: test_type2\n" + " _id: test_id2\n" + " - f1: v2\n" + " f2: 47" ); String[] bodies = new String[4]; - bodies[0] = "{\"index\": {\"_index\": \"test_index\", \"_type\": \"test_type\", \"_id\": \"test_id\"}}"; + bodies[0] = "{\"index\": {\"_index\": \"test_index\", \"_id\": \"test_id\"}}"; bodies[1] = "{ \"f1\":\"v1\", \"f2\": 42 }"; - bodies[2] = "{\"index\": {\"_index\": \"test_index2\", \"_type\": \"test_type2\", \"_id\": \"test_id2\"}}"; + bodies[2] = "{\"index\": {\"_index\": \"test_index2\", \"_id\": \"test_id2\"}}"; bodies[3] = "{ \"f1\":\"v2\", \"f2\": 47 }"; DoSection doSection = DoSection.parse(parser); @@ -322,13 +312,10 @@ public void testParseDoSectionWithYamlBodyMultiGet() throws Exception { "mget:\n" + " body:\n" + " docs:\n" - + " - { _index: test_2, _type: test, _id: 1}\n" - + " - { _index: test_1, _type: none, _id: 1}" + + " - { _index: test_2, _id: 1}\n" + + " - { _index: test_1, _id: 1}" ); - String body = "{ \"docs\": [ " - + "{\"_index\": \"test_2\", \"_type\":\"test\", \"_id\":1}, " - + "{\"_index\": \"test_1\", \"_type\":\"none\", \"_id\":1} " - + "]}"; + String body = "{ \"docs\": [ " + "{\"_index\": \"test_2\", \"_id\":1}, " + "{\"_index\": \"test_1\", \"_id\":1} " + "]}"; DoSection doSection = DoSection.parse(parser); ApiCallSection apiCallSection = doSection.getApiCallSection(); @@ -346,7 +333,6 @@ public void testParseDoSectionWithBodyStringified() throws Exception { YamlXContent.yamlXContent, "index:\n" + " index: test_1\n" - + " type: test\n" + " id: 1\n" + " body: \"{ \\\"_source\\\": true, \\\"query\\\": { \\\"match_all\\\": {} } }\"" ); @@ -356,9 +342,8 @@ public void testParseDoSectionWithBodyStringified() throws Exception { assertThat(apiCallSection, notNullValue()); assertThat(apiCallSection.getApi(), equalTo("index")); - assertThat(apiCallSection.getParams().size(), equalTo(3)); + assertThat(apiCallSection.getParams().size(), equalTo(2)); assertThat(apiCallSection.getParams().get("index"), equalTo("test_1")); - assertThat(apiCallSection.getParams().get("type"), equalTo("test")); assertThat(apiCallSection.getParams().get("id"), equalTo("1")); assertThat(apiCallSection.hasBody(), equalTo(true)); assertThat(apiCallSection.getBodies().size(), equalTo(1)); @@ -444,16 +429,15 @@ public void testParseDoSectionWithoutClientCallSection() throws Exception { public void testParseDoSectionMultivaluedField() throws Exception { parser = createParser( YamlXContent.yamlXContent, - "indices.get_field_mapping:\n" + " index: test_index\n" + " type: test_type\n" + " field: [ text , text1 ]" + "indices.get_field_mapping:\n" + " index: test_index\n" + " field: [ text , text1 ]" ); DoSection doSection = DoSection.parse(parser); assertThat(doSection.getCatch(), nullValue()); assertThat(doSection.getApiCallSection(), notNullValue()); assertThat(doSection.getApiCallSection().getApi(), equalTo("indices.get_field_mapping")); - assertThat(doSection.getApiCallSection().getParams().size(), equalTo(3)); + assertThat(doSection.getApiCallSection().getParams().size(), equalTo(2)); assertThat(doSection.getApiCallSection().getParams().get("index"), equalTo("test_index")); - assertThat(doSection.getApiCallSection().getParams().get("type"), equalTo("test_type")); assertThat(doSection.getApiCallSection().getParams().get("field"), equalTo("text,text1")); assertThat(doSection.getApiCallSection().hasBody(), equalTo(false)); assertThat(doSection.getApiCallSection().getBodies().size(), equalTo(0)); @@ -464,7 +448,6 @@ public void testParseDoSectionExpectedWarnings() throws Exception { YamlXContent.yamlXContent, "indices.get_field_mapping:\n" + " index: test_index\n" - + " type: test_type\n" + "warnings:\n" + " - some test warning they are typically pretty long\n" + " - some other test warning sometimes they have [in] them" @@ -474,9 +457,8 @@ public void testParseDoSectionExpectedWarnings() throws Exception { assertThat(doSection.getCatch(), nullValue()); assertThat(doSection.getApiCallSection(), notNullValue()); assertThat(doSection.getApiCallSection().getApi(), equalTo("indices.get_field_mapping")); - assertThat(doSection.getApiCallSection().getParams().size(), equalTo(2)); + assertThat(doSection.getApiCallSection().getParams().size(), equalTo(1)); assertThat(doSection.getApiCallSection().getParams().get("index"), equalTo("test_index")); - assertThat(doSection.getApiCallSection().getParams().get("type"), equalTo("test_type")); assertThat(doSection.getApiCallSection().hasBody(), equalTo(false)); assertThat(doSection.getApiCallSection().getBodies().size(), equalTo(0)); assertThat( @@ -502,7 +484,6 @@ public void testParseDoSectionAllowedWarnings() throws Exception { YamlXContent.yamlXContent, "indices.get_field_mapping:\n" + " index: test_index\n" - + " type: test_type\n" + "allowed_warnings:\n" + " - some test warning they are typically pretty long\n" + " - some other test warning sometimes they have [in] them" @@ -512,9 +493,8 @@ public void testParseDoSectionAllowedWarnings() throws Exception { assertThat(doSection.getCatch(), nullValue()); assertThat(doSection.getApiCallSection(), notNullValue()); assertThat(doSection.getApiCallSection().getApi(), equalTo("indices.get_field_mapping")); - assertThat(doSection.getApiCallSection().getParams().size(), equalTo(2)); + assertThat(doSection.getApiCallSection().getParams().size(), equalTo(1)); assertThat(doSection.getApiCallSection().getParams().get("index"), equalTo("test_index")); - assertThat(doSection.getApiCallSection().getParams().get("type"), equalTo("test_type")); assertThat(doSection.getApiCallSection().hasBody(), equalTo(false)); assertThat(doSection.getApiCallSection().getBodies().size(), equalTo(0)); assertThat( diff --git a/test/framework/src/test/resources/rest-api-spec/test/suite1/10_basic.yml b/test/framework/src/test/resources/rest-api-spec/test/suite1/10_basic.yml index 0689f714d6416..c5fde76e94cc2 100644 --- a/test/framework/src/test/resources/rest-api-spec/test/suite1/10_basic.yml +++ b/test/framework/src/test/resources/rest-api-spec/test/suite1/10_basic.yml @@ -4,18 +4,15 @@ - do: index: index: test_1 - type: test id: 中文 body: { "foo": "Hello: 中文" } - do: get: index: test_1 - type: test id: 中文 - match: { _index: test_1 } - - match: { _type: test } - match: { _id: 中文 } - match: { _source: { foo: "Hello: 中文" } } @@ -26,6 +23,5 @@ id: 中文 - match: { _index: test_1 } - - match: { _type: test } - match: { _id: 中文 } - match: { _source: { foo: "Hello: 中文" } }