confluentinc / ksql

The database purpose-built for stream processing applications.
https://ksqldb.io
Other
128 stars 1.04k forks source link

Test harness : Exception in thread "main" java.lang.AssertionError: keyset mismatch at VALUE-SPEC #3105

Open rmoff opened 5 years ago

rmoff commented 5 years ago
$ docker exec ksql-cli ksql-test-runner -i /opt/app/test/input.json -s opt/app/src/statements.sql -o /opt/app/test/output.json
Exception in thread "main" java.lang.AssertionError: keyset mismatch at VALUE-SPEC
Expected: <[SESSION_END_TS, SESSION_START_TS, SESSION_LENGTH_MS , IP, CLICK_COUNT]>
     but: was <[SESSION_END_TS, SESSION_START_TS, IP, CLICK_COUNT, SESSION_LENGTH_MS]>
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.junit.Assert.assertThat(Assert.java:956)
        at io.confluent.ksql.test.serde.ValueSpec.compare(ValueSpec.java:41)
        at io.confluent.ksql.test.serde.ValueSpec.equals(ValueSpec.java:70)
        at io.confluent.ksql.test.tools.TestCase.validateCreatedMessage(TestCase.java:367)
        at io.confluent.ksql.test.tools.TestCase.validateTopicData(TestCase.java:353)
        at io.confluent.ksql.test.tools.TestCase.lambda$verifyOutputTopics$7(TestCase.java:336)
        at java.util.HashMap$KeySet.forEach(HashMap.java:933)
        at io.confluent.ksql.test.tools.TestCase.verifyOutputTopics(TestCase.java:336)
        at io.confluent.ksql.test.tools.TestExecutor.buildAndExecuteQuery(TestExecutor.java:99)
        at io.confluent.ksql.test.tools.KsqlTestingTool.executeTestCase(KsqlTestingTool.java:141)
        at io.confluent.ksql.test.tools.KsqlTestingTool.runWithTripleFiles(KsqlTestingTool.java:130)
        at io.confluent.ksql.test.tools.KsqlTestingTool.main(KsqlTestingTool.java:56)
rmoff commented 5 years ago

See attached code to reproduce

issue-3105.zip

This error is not clear what the problem is. If it is that columns are specified in the wrong order, then it should be clear that this is a requirement and be clearer in the error. However since schema fields are not order-specific then the test should not need to be either IMO.

rmoff commented 5 years ago

Changing the order of the columns in output.json didn't make any difference. Error remains.

Expected: <[SESSION_END_TS, SESSION_START_TS, SESSION_LENGTH_MS , IP, CLICK_COUNT]>
     but: was <[SESSION_END_TS, SESSION_START_TS, IP, CLICK_COUNT, SESSION_LENGTH_MS]>