Class ESClientYamlSuiteTestCase

java.lang.Object
org.junit.Assert
org.apache.lucene.tests.util.LuceneTestCase
org.elasticsearch.test.ESTestCase
org.elasticsearch.test.rest.ESRestTestCase
org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase

public abstract class ESClientYamlSuiteTestCase extends ESRestTestCase
Runs a suite of yaml tests shared with all the official Elasticsearch clients against an elasticsearch cluster. The suite timeout is extended to account for projects with a large number of tests.
  • Field Details

    • REST_TESTS_SUITE

      public static final String REST_TESTS_SUITE
      Property that allows to control which REST tests get run. Supports comma separated list of tests or directories that contain tests e.g. -Dtests.rest.suite=index,get,create/10_with_id
      See Also:
    • REST_TESTS_BLACKLIST

      public static final String REST_TESTS_BLACKLIST
      Property that allows to blacklist some of the REST tests based on a comma separated list of globs e.g. "-Dtests.rest.blacklist=get/10_basic/*"
      See Also:
    • REST_TESTS_BLACKLIST_ADDITIONS

      public static final String REST_TESTS_BLACKLIST_ADDITIONS
      We use tests.rest.blacklist in build files to blacklist tests; this property enables a user to add additional blacklisted tests on top of the tests blacklisted in the build.
      See Also:
  • Constructor Details

  • Method Details

    • initAndResetContext

      public void initAndResetContext() throws Exception
      Throws:
      Exception
    • createRestTestExecutionContext

      protected ClientYamlTestExecutionContext createRestTestExecutionContext(ClientYamlTestCandidate clientYamlTestCandidate, ClientYamlTestClient clientYamlTestClient, Set<String> nodesVersions, TestFeatureService testFeatureService, Set<String> osSet)
      Create the test execution context. Can be overwritten in sub-implementations of the test if the context needs to be modified.
    • initClientYamlTestClient

      protected ClientYamlTestClient initClientYamlTestClient(ClientYamlSuiteRestSpec restSpec, RestClient restClient, List<org.apache.http.HttpHost> hosts)
    • closeClient

      public static void closeClient() throws IOException
      Throws:
      IOException
    • createParametersWithLegacyNodeSelectorSupport

      @Deprecated public static Iterable<Object[]> createParametersWithLegacyNodeSelectorSupport() throws Exception
      Deprecated.
      Create parameters for this parameterized test. Enables support for parsing the legacy version-based node_selector format.
      Throws:
      Exception
    • createParameters

      public static Iterable<Object[]> createParameters() throws Exception
      Create parameters for this parameterized test. Uses the list of executable sections defined in ExecutableSection.
      Throws:
      Exception
    • createParameters

      public static Iterable<Object[]> createParameters(org.elasticsearch.xcontent.NamedXContentRegistry executeableSectionRegistry) throws Exception
      Create parameters for this parameterized test.
      Throws:
      Exception
    • createParameters

      public static Iterable<Object[]> createParameters(String[] testPaths, Map<String,Object> yamlParameters) throws Exception
      Create parameters for this parameterized test.
      Throws:
      Exception
    • createParameters

      public static Iterable<Object[]> createParameters(String[] testPaths) throws Exception
      Create parameters for this parameterized test.
      Throws:
      Exception
    • createParameters

      public static Iterable<Object[]> createParameters(org.elasticsearch.xcontent.NamedXContentRegistry executeableSectionRegistry, String[] testPaths) throws Exception
      Create parameters for this parameterized test.
      Parameters:
      executeableSectionRegistry - registry of executable sections
      testPaths - list of paths to explicitly search for tests. If null then include all tests in root path.
      Returns:
      list of test candidates.
      Throws:
      Exception
    • createParameters

      public static Iterable<Object[]> createParameters(org.elasticsearch.xcontent.NamedXContentRegistry executeableSectionRegistry, String[] testPaths, Map<String,?> yamlParameters) throws Exception
      Create parameters for this parameterized test.
      Parameters:
      executeableSectionRegistry - registry of executable sections
      testPaths - list of paths to explicitly search for tests. If null then include all tests in root path.
      yamlParameters - map or parameters used within the yaml specs to be replaced at parsing time.
      Returns:
      list of test candidates.
      Throws:
      Exception
    • getAdminExecutionContext

      protected ClientYamlTestExecutionContext getAdminExecutionContext()
    • test

      public void test() throws IOException
      Throws:
      IOException
    • skipSetupSections

      protected boolean skipSetupSections()
    • randomizeContentType

      protected boolean randomizeContentType()
    • getClientBuilderWithSniffedHosts

      protected final RestClientBuilder getClientBuilderWithSniffedHosts() throws IOException
      Sniff the cluster for host metadata and return a RestClientBuilder for a client with that metadata.
      Throws:
      IOException
    • getTestCandidate

      public ClientYamlTestCandidate getTestCandidate()