ChinmaySKulkarni commented on a change in pull request #696: PHOENIX-5607 
Client-server backward compatibility tests
URL: https://github.com/apache/phoenix/pull/696#discussion_r383560314
 
 

 ##########
 File path: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java
 ##########
 @@ -0,0 +1,353 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeFalse;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.InputStreamReader;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.util.Collection;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.curator.shaded.com.google.common.collect.Lists;
+import org.apache.phoenix.coprocessor.MetaDataProtocol;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * This class is meant for testing all compatible client versions 
+ * against the current server version. It runs SQL queries with given 
+ * client versions and compares the output against gold files
+ */
+
+@RunWith(Parameterized.class)
+public class BackwardCompatibilityIT extends BaseOwnClusterIT {
+
+    private static final String SQL_DIR = "src/it/resources/sql_files/";
+    private static final String RESULT_DIR = "src/it/resources/gold_files/";
+    private static final String RESULT_PREFIX = "result_";
+    private static final String SQL_EXTENSION = ".sql";
+    private static final String TEXT_EXTENSION = ".txt";
+    private static final String CREATE_ADD = "create_add";
+    private static final String ADD_DATA = "add_data";
+    private static final String ADD_DELETE = "add_delete";
+    private static final String QUERY = "query";
+    private static final String QUERY_ADD_DELETE = "query_add_delete";
+
+    private final String compatibleClientVersion;
+
+    public BackwardCompatibilityIT(String compatibleClientVersion) {
+        this.compatibleClientVersion = compatibleClientVersion;
+    }
+
+    @Parameters(name = "BackwardCompatibilityIT_compatibleClientVersion={0}")
+    public static synchronized Collection<String> data() {
+        return MetaDataProtocol.COMPATIBLE_CLIENT_VERSIONS;
+    }
+
+    @Before
+    public synchronized void doSetup() throws Exception {
+        setUpTestDriver(ReadOnlyProps.EMPTY_PROPS);
+    }
+
+    /**
+     * Scenario: 
+     * 1. Old Client connects to the updated server 
+     * 2. Old Client creates tables and inserts data 
+     * 3. New Client reads the data inserted by the old client
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testUpsertWithOldClient() throws Exception {
+        checkForCurrentVersion();
+        // Insert data with old client and read with new client
+        executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
+        executeQueriesWithCurrentVersion(QUERY);
+        assertEquals(true, compareOutput(CREATE_ADD, QUERY));
 
 Review comment:
   nit: Use `assertTrue` everywhere instead

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to