Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

There is a plane to have Full API test coverage of Ignite unctionalityfunctionality. See: 

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyIGNITE-2521
.

...

Ignite already has Full API test suites, but currently it's hard to test all configuration combinations

Configuration variations test framework

The framework provides an ability to write a test-case once and run it in multiple Ignite and Cache configurations.

How to use the framework:

  • Test class has to extend IgniteConfigVariationsAbstractTest or IgniteCacheConfigVariationsAbstractTest.

  • TestSuite has to be built using ConfigVariationsTestSuiteBuilder.

As an example see IgniteCacheBasicConfigVariationsFullApiTestSuite.

Examples:

  1. The following code will test SomeFunctionalityTest with basic set of IgniteConfiguration variations (BinaryMarshaller / OptimizedMarshaller and enabled / disabled per class loading), will be used Ignite cluster with 3 nodes, the second started node is client (client with idx=1), each test-method will be run with testedGrid=0 and testedGrid=1 (see testedGrid() method) .

    Code Block
    TestSuite suite = new ConfigVariationsTestSuiteBuilder(
        "Basic Ignite Configuration Variations Some Functionality Test Suite", 
    	SomeFunctionalityTest.class)
        .gridsCount(3)
        .testedNodesCount(2).withClients()
        .build();
  2. The following code will test SomeFunctionalityTest with basic set of IgniteConfiguration variations (see above), will be used Ignite cluster with 5 nodes, the second started node is client (with nodeIdx=1) and the third started node is client with near-only cache (with nodeIdx=2), each test-method will be run with testedGrid=0 and testedGrid=1 (see testedGrid() method) .

    Code Block
    TestSuite suite = new ConfigVariationsTestSuiteBuilder(
        "Basic Cache Configuration Variations Some Cache Functionality Test Suite",
        SomeCacheFunctionalityTest.class)
        .withBasicCacheParams()
        .gridsCount(5).backups(1)
        .testedNodesCount(3).withClients()
        .build();

Run in all data modes

IgniteConfigVariationsAbstractTest has methods key(int i) and value(int i). To run a test scenario in all supported by the framework data modes (Serializable, Externaliazable, plane, mixed and etc. objects), it's enough to write test scenario using these methods to generate different keys and values and to place test scenario inside runInAllDataModes(TestRunnable runnable) method. 

For example to test cache's put-get scenario in all supported by the framework data modes you can write the following code:

Code Block
public void testPutGet() throws Exception {
    runInAllDataModes(new TestRunnable() {
        @Override public void run() throws Exception {
            IgniteCache cache = jcache();

            Object key = key(1);
            Object val = value(1);
            
            cache.put(key, val);
            
            assertEquals(val, cache.get(key));
        }
    });
}