diff --git a/java/yb-cql/src/test/java/org/yb/cql/TestBasicStatements.java b/java/yb-cql/src/test/java/org/yb/cql/TestBasicStatements.java index b9eaa3623873..dc73bc0ac6ed 100644 --- a/java/yb-cql/src/test/java/org/yb/cql/TestBasicStatements.java +++ b/java/yb-cql/src/test/java/org/yb/cql/TestBasicStatements.java @@ -15,6 +15,8 @@ import org.junit.Ignore; import org.junit.Test; +import com.datastax.driver.core.Session; + public class TestBasicStatements extends BaseCQLTest { @Test public void testCreateTable() throws Exception { @@ -23,12 +25,20 @@ public void testCreateTable() throws Exception { } // We need to work on reporting error from SQL before activating this test. - @Ignore + @Test public void testInvalidStatement() throws Exception { LOG.info("Execute nothing ..."); thrown.expect(com.datastax.driver.core.exceptions.SyntaxError.class); - thrown.expectMessage("unknown statement"); + thrown.expectMessage("Invalid SQL Statement"); session.execute("NOTHING"); } + @Test + public void testUnsupportedProtocol() throws Exception { + thrown.expect(com.datastax.driver.core.exceptions.UnsupportedProtocolVersionException.class); + Session s = getDefaultClusterBuilder() + .allowBetaProtocolVersion() + .build() + .connect(); + } } diff --git a/src/yb/yql/cql/cqlserver/cql_message.cc b/src/yb/yql/cql/cqlserver/cql_message.cc index a724cc190e8d..3927fb270068 100644 --- a/src/yb/yql/cql/cqlserver/cql_message.cc +++ b/src/yb/yql/cql/cqlserver/cql_message.cc @@ -218,8 +218,8 @@ bool CQLRequest::ParseRequest( error_response->reset( new ErrorResponse( header.stream_id, ErrorResponse::Code::PROTOCOL_ERROR, - Substitute("Protocol version $0 not supported. Supported versions are between " - "$1 and $2.", header.version, kMinimumVersion, kCurrentVersion))); + Substitute("Invalid or unsupported protocol version $0. Supported versions are between " + "$1 and $2.", header.version, kMinimumVersion, kCurrentVersion))); return false; } diff --git a/src/yb/yql/cql/cqlserver/cqlserver-test.cc b/src/yb/yql/cql/cqlserver/cqlserver-test.cc index 7c329e237875..45d2ef4ef7a5 100644 --- a/src/yb/yql/cql/cqlserver/cqlserver-test.cc +++ b/src/yb/yql/cql/cqlserver/cqlserver-test.cc @@ -159,9 +159,10 @@ TEST_F(TestCQLService, StartupRequest) { BINARY_STRING("\x05\x00\x00\x00\x01" "\x00\x00\x00\x16" "\x00\x01" "\x00\x0b" "CQL_VERSION" "\x00\x05" "3.0.0"), - BINARY_STRING("\x84\x00\x00\x00\x00" "\x00\x00\x00\x4f" - "\x00\x00\x00\x0a" "\x00\x49" - "Protocol version 5 not supported. Supported versions are between 3 and 4.")); + BINARY_STRING("\x84\x00\x00\x00\x00" "\x00\x00\x00\x58" + "\x00\x00\x00\x0a" "\x00\x52" + "Invalid or unsupported protocol version 5. " + "Supported versions are between 3 and 4.")); // Send STARTUP request with compression SendRequestAndExpectResponse(