zabetak commented on a change in pull request #3081:
URL: https://github.com/apache/hive/pull/3081#discussion_r820854060
##########
File path:
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/tools/schematool/TestSchemaToolForMetastore.java
##########
@@ -370,6 +370,44 @@ public void testSchemaUpgrade() throws Exception {
schemaTool.verifySchemaVersion();
}
+ /**
+ * Test schema upgrade checking that the alpha version is called
+ */
+ @Test
+ public void testSchemaUpgradeFromAlphaVersion() throws Exception {
+ boolean foundException = false;
+ // Initialize 1.2.0 schema
+ execute(new SchemaToolTaskInit(), "-initSchemaTo 3.1.0");
+ // verify that driver fails due to older version schema
+ try {
+ schemaTool.verifySchemaVersion();
+ } catch (HiveMetaException e) {
+ // Expected to fail due to old schema
+ foundException = true;
+ }
+ if (!foundException) {
+ throw new Exception(
+ "Hive operations shouldn't pass with older version schema");
+ }
+
+ // Capture system out and err
+ schemaTool.setVerbose(true);
+ OutputStream stderr = new ByteArrayOutputStream();
+ PrintStream errPrintStream = new PrintStream(stderr);
+ System.setErr(errPrintStream);
+ OutputStream stdout = new ByteArrayOutputStream();
+ PrintStream outPrintStream = new PrintStream(stdout);
+ System.setOut(outPrintStream);
+
+ // Upgrade schema from 0.7.0 to latest
+ execute(new SchemaToolTaskUpgrade(), "-upgradeSchemaFrom 3.1.0");
Review comment:
nit: same comment as above
##########
File path:
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/tools/schematool/TestSchemaToolForMetastore.java
##########
@@ -370,6 +370,44 @@ public void testSchemaUpgrade() throws Exception {
schemaTool.verifySchemaVersion();
}
+ /**
+ * Test schema upgrade checking that the alpha version is called
+ */
+ @Test
+ public void testSchemaUpgradeFromAlphaVersion() throws Exception {
Review comment:
Aren't tests under `DbInstallBase` sufficient to cover the upgrade? If
they are not sufficient maybe it would make sense to add additional tests there
so that we cover all supported backends.
##########
File path:
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/tools/schematool/TestSchemaToolForMetastore.java
##########
@@ -370,6 +370,44 @@ public void testSchemaUpgrade() throws Exception {
schemaTool.verifySchemaVersion();
}
+ /**
+ * Test schema upgrade checking that the alpha version is called
+ */
+ @Test
+ public void testSchemaUpgradeFromAlphaVersion() throws Exception {
+ boolean foundException = false;
+ // Initialize 1.2.0 schema
+ execute(new SchemaToolTaskInit(), "-initSchemaTo 3.1.0");
+ // verify that driver fails due to older version schema
+ try {
+ schemaTool.verifySchemaVersion();
+ } catch (HiveMetaException e) {
+ // Expected to fail due to old schema
+ foundException = true;
+ }
+ if (!foundException) {
+ throw new Exception(
+ "Hive operations shouldn't pass with older version schema");
+ }
+
+ // Capture system out and err
+ schemaTool.setVerbose(true);
+ OutputStream stderr = new ByteArrayOutputStream();
+ PrintStream errPrintStream = new PrintStream(stderr);
+ System.setErr(errPrintStream);
+ OutputStream stdout = new ByteArrayOutputStream();
+ PrintStream outPrintStream = new PrintStream(stdout);
+ System.setOut(outPrintStream);
+
+ // Upgrade schema from 0.7.0 to latest
+ execute(new SchemaToolTaskUpgrade(), "-upgradeSchemaFrom 3.1.0");
+
+
Assert.assertTrue(stdout.toString().contains("upgrade-3.2.0-to-4.0.0-alpha-1.derby.sql"));
+
+ // Verify that driver works fine with latest schema
+ schemaTool.verifySchemaVersion();
Review comment:
nit: redundant comment
##########
File path:
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/tools/schematool/TestSchemaToolForMetastore.java
##########
@@ -370,6 +370,44 @@ public void testSchemaUpgrade() throws Exception {
schemaTool.verifySchemaVersion();
}
+ /**
+ * Test schema upgrade checking that the alpha version is called
+ */
+ @Test
+ public void testSchemaUpgradeFromAlphaVersion() throws Exception {
+ boolean foundException = false;
+ // Initialize 1.2.0 schema
+ execute(new SchemaToolTaskInit(), "-initSchemaTo 3.1.0");
Review comment:
nit: comment does not add much to the code thus could be removed. Also
the version in the comment is different than the one actually used.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]