diff --git a/driver/src/test/java/oracle/nosql/driver/ProxyTestBase.java b/driver/src/test/java/oracle/nosql/driver/ProxyTestBase.java index 692450cf..dda592ef 100644 --- a/driver/src/test/java/oracle/nosql/driver/ProxyTestBase.java +++ b/driver/src/test/java/oracle/nosql/driver/ProxyTestBase.java @@ -678,7 +678,7 @@ protected static String stringVersion(int ver) { (ver % 1000); } - private static int getMinimumKVVersion() { + protected static int getMinimumKVVersion() { /* * Use the minimum of the kv client and server versions to * determine what features should be valid to test. diff --git a/driver/src/test/java/oracle/nosql/driver/QueryTest.java b/driver/src/test/java/oracle/nosql/driver/QueryTest.java index e553060e..464a3462 100644 --- a/driver/src/test/java/oracle/nosql/driver/QueryTest.java +++ b/driver/src/test/java/oracle/nosql/driver/QueryTest.java @@ -1583,15 +1583,31 @@ public void testEvolution() { assertEquals(10, qres.getResults().size()); /* - * evolve and try the query again. It will fail because the ??? + * Evolve and try the query again. It will fail because table schema + * has been changed, the query need to be prepared again. * + * The exception caught from query may vary depending on the + * different proxy and KV version. PrepareQueryException will be + * thrown for proxy(KVClient 25.1.1) + KV server 25.1.1 or higher. + * Otherwise, IllegalArgumentException will be thrown. */ tableOperation(handle, "alter table testTable(drop age)", null); + try { qres = handle.query(qreq); fail("Query should have failed"); - } catch (IllegalArgumentException iae) { - /* success */ + } catch (PrepareQueryException | IllegalArgumentException ex) { + /* + * If can't determine the versions of KV client and server, skip + * checking the specific exception. + */ + if (getMinimumKVVersion() > 0) { + if (checkKVVersion(25, 1, 1)) { + assertTrue(ex instanceof PrepareQueryException); + } else { + assertTrue(ex instanceof IllegalArgumentException); + } + } } } }