lucene/solr/bin-test
Jason Gerlowski 2ca741d36a SOLR-11749: Introduce bin/solr test suite 2018-03-15 21:20:13 -04:00
..
utils SOLR-11749: Introduce bin/solr test suite 2018-03-15 21:20:13 -04:00
README.md SOLR-11749: Introduce bin/solr test suite 2018-03-15 21:20:13 -04:00
test SOLR-11749: Introduce bin/solr test suite 2018-03-15 21:20:13 -04:00
test_create_collection.sh SOLR-11749: Introduce bin/solr test suite 2018-03-15 21:20:13 -04:00
test_delete_collection.sh SOLR-11749: Introduce bin/solr test suite 2018-03-15 21:20:13 -04:00
test_help.sh SOLR-11749: Introduce bin/solr test suite 2018-03-15 21:20:13 -04:00
test_start_solr.sh SOLR-11749: Introduce bin/solr test suite 2018-03-15 21:20:13 -04:00

README.md

bin/solr Tests

This directory contains tests for the bin/solr command-line scripts. For instructions on running these tests, run bin-test/test -h.

Test Harness/Infrastructure

Where possible, these tests model themselves after the pattern well-established by JUnit.

  • JUnit's @Test is emulated using the function name prefix: solr_test_ Any bash functions starting with that prefix are identified as tests.
  • JUnit's @Before and @After are imitated using the function names solr_unit_test_before, and solr_unit_test_after. If a suite contains these functions, they will be run before and after each test.
  • JUnit's @BeforeClass and @AfterClass are imitated using the function names: solr_suite_before, and solr_suite_after. If a suite contains these functions, they will be run at the very beginning and end of suite execution.
  • Test success/failure is judged by the test's return value. 0 indicates success; non-zero indicates failure. Unlike in JUnit/Java which has exceptions, bash assertions have no way to suspend test execution on failure. Because of this, assertions are often followed by || return 1, which ensures the test exists immediately if the assertion fails. Existing tests provided examples of this.

Test Helpers

A variety of assertions and general utilities are available for use in bin-test/utils/.

Limitations

  1. Currently this test suite is only available for *nix environments
  2. Tests written in bash are both slow, and harder to maintain than traditional JUnit tests. If a test can be written as a JUnit test, it should be. This suite should only be used to test things that cannot be tested by JUnit.