Skip to content

Commit

Permalink
added all AKV tests to use reqExternalSetup tag so they will be skipp…
Browse files Browse the repository at this point in the history
…ed by default (microsoft#1254)

* skip AKV test properly

* removed enclave properties string to failed errors as enclave tests could be skipped
  • Loading branch information
lilgreenbird authored Feb 10, 2020
1 parent f632089 commit 6ab2831
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ void checkAESetup(String serverName, String url, String protocol) throws Excepti
} catch (SQLException e) {
isAEv2 = false;
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + TestResource.getResource("R_unexpectedErrorMessage")
+ e.getMessage());
fail(TestResource.getResource("R_unexpectedErrorMessage") + e.getMessage());
}
}

Expand Down Expand Up @@ -318,7 +317,7 @@ private static void readFromFile(String inputFile, String lookupValue) throws IO
}
}
} catch (IOException e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -347,7 +346,7 @@ protected static void createTable(String tableName, String cekName, String table
stmt.execute(sql);
stmt.execute("DBCC FREEPROCCACHE");
} catch (SQLException e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -381,7 +380,7 @@ protected static void createPrecisionTable(String tableName, String table[][], S
stmt.execute(sql);
stmt.execute("DBCC FREEPROCCACHE");
} catch (SQLException e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -409,7 +408,7 @@ protected static void createScaleTable(String tableName, String table[][], Strin
stmt.execute(sql);
stmt.execute("DBCC FREEPROCCACHE");
} catch (SQLException e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ private static void createSPTables(String cekName) throws SQLException {
Statement stmt = con.createStatement()) {
stmt.execute(sql);
} catch (SQLException e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}

sql = "create table " + table6 + " ("
Expand All @@ -439,7 +439,7 @@ private static void createSPTables(String cekName) throws SQLException {
TestUtils.dropTableIfExists(table6, stmt);
stmt.execute(sql);
} catch (SQLException e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -617,7 +617,7 @@ private void MultiInsertionSelection() throws SQLException {
results = callableStatement.getMoreResults();
}
} catch (SQLException e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -694,7 +694,7 @@ private void testInputProcedure(String sql, String[] values) throws SQLException
assertEquals(rs.getString(1), values[3], "" + TestResource.getResource("R_inputParamFailed"));
}
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -746,7 +746,7 @@ private void testInputProcedure2(String sql) throws SQLException {
assertEquals(rs.getString(8).trim(), charValues[8], TestResource.getResource("R_inputParamFailed"));
}
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -793,7 +793,7 @@ private void testOutputProcedure3RandomOrder(String sql) throws SQLException {
int intValue5 = callableStatement.getInt(1);
assertEquals("" + intValue5, numericValues[3], TestResource.getResource("R_outputParamFailed"));
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand All @@ -815,7 +815,7 @@ private void testOutputProcedure3Inorder(String sql) throws SQLException {
assertEquals("" + intValue2, numericValues[3], TestResource.getResource("R_outputParamFailed"));
} catch (Exception e) {

fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand All @@ -836,7 +836,7 @@ private void testOutputProcedure3ReverseOrder(String sql) throws SQLException {
int intValue = callableStatement.getInt(1);
assertEquals("" + intValue, numericValues[3], TestResource.getResource("R_outputParamFailed"));
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -909,7 +909,7 @@ private void testOutputProcedure2RandomOrder(String sql, String[] values) throws
int encryptedInt = callableStatement.getInt(2);
assertEquals("" + encryptedInt, values[3], TestResource.getResource("R_outputParamFailed"));
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -962,7 +962,7 @@ private void testOutputProcedure2Inorder(String sql, String[] values) throws SQL
assertEquals("" + encryptedMoney, values[13], TestResource.getResource("R_outputParamFailed"));

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -1016,7 +1016,7 @@ private void testOutputProcedure2ReverseOrder(String sql, String[] values) throw
assertEquals("" + intValue, values[3], TestResource.getResource("R_outputParamFailed"));

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -1084,7 +1084,7 @@ private void testOutputProcedureRandomOrder(String sql, String[] values) throws
BigDecimal money1 = callableStatement.getMoney(7);
assertEquals("" + money1, "" + values[13], TestResource.getResource("R_outputParamFailed"));
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -1126,7 +1126,7 @@ private void testOutputProcedureInorder(String sql, String[] values) throws SQLE
assertEquals("" + money1, values[13], TestResource.getResource("R_outputParamFailed"));

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -1167,7 +1167,7 @@ private void testOutputProcedureReverseOrder(String sql, String[] values) throws
assertEquals("" + intValue2, values[3], TestResource.getResource("R_outputParamFailed"));

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -1201,7 +1201,7 @@ private void testInOutProcedure(String sql) throws SQLException {

assertEquals("" + intValue, numericValues[3], "Test for Inout parameter fails.\n");
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -1247,7 +1247,7 @@ private void testMixedProcedure(String sql) throws SQLException {
int returnedValue = callableStatement.getInt(1);
assertEquals("" + returnedValue, "" + 123, "Test for Inout parameter fails.\n");
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -1299,7 +1299,7 @@ private void testMixedProcedure2RandomOrder(String sql) throws SQLException {
assertEquals("" + floatValue3, numericValues[5], TestResource.getResource("R_outputParamFailed"));

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand All @@ -1321,7 +1321,7 @@ private void testMixedProcedure2Inorder(String sql) throws SQLException {
double floatValue = callableStatement.getDouble(2);
assertEquals("" + floatValue, numericValues[5], TestResource.getResource("R_outputParamFailed"));
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -1373,7 +1373,7 @@ private void testMixedProcedure3RandomOrder(String sql) throws SQLException {
assertEquals("" + bigintValue3, numericValues[4], TestResource.getResource("R_outputParamFailed"));

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand All @@ -1395,7 +1395,7 @@ private void testMixedProcedure3Inorder(String sql) throws SQLException {
double floatValue = callableStatement.getDouble(2);
assertEquals("" + floatValue, numericValues[5], TestResource.getResource("R_outputParamFailed"));
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand All @@ -1417,7 +1417,7 @@ private void testMixedProcedure3ReverseOrder(String sql) throws SQLException {
long bigintValue = callableStatement.getLong(1);
assertEquals("" + bigintValue, numericValues[4], TestResource.getResource("R_outputParamFailed"));
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -1468,7 +1468,7 @@ private void testmixedProcedureNumericPrecisionScaleInorder(String sql) throws S
assertEquals(value4, new BigDecimal(numericValues[11]), "Test for input output parameter fails.\n");

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -1499,7 +1499,7 @@ private void testmixedProcedureNumericPrecisionScaleParameterName(String sql) th
assertEquals(value4, new BigDecimal(numericValues[11]), "Test for input output parameter fails.\n");

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -1570,7 +1570,7 @@ private void testOutputProcedureCharInorder(String sql) throws SQLException {
assertEquals(nvarcharValue4000, charValues[8], TestResource.getResource("R_outputParamFailed"));

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -1623,7 +1623,7 @@ private void testOutputProcedureCharInorderObject(String sql) throws SQLExceptio
assertEquals(nvarcharValue4000, charValues[8], TestResource.getResource("R_outputParamFailed"));

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -1735,7 +1735,7 @@ private void testOutputProcedureNumericInorder(String sql) throws SQLException {
TestResource.getResource("R_outputParamFailed"));

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -1955,7 +1955,7 @@ else if (value.toString().equals("0") || value.equals(false) || value.toString()
}

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -2016,7 +2016,7 @@ private Object getxxx(int ordinal, Class<?> coercion,
return callableStatement.getDateTimeOffset(ordinal);
} else {
// Otherwise
fail("enclaveProperties: " + enclaveProperties + "\n" + "Unhandled type: " + coercion);
fail("Unhandled type: " + coercion);
}

return null;
Expand Down Expand Up @@ -2085,7 +2085,7 @@ private void testOutputProcedureBinaryInorder(String sql) throws SQLException {
assertEquals(received5[i], expected[i], TestResource.getResource("R_outputParamFailed"));
}
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -2120,13 +2120,13 @@ private void testOutputProcedureBinaryInorderObject(String sql) throws SQLExcept
}
}
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
} finally {
index++;
}
}
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -2162,7 +2162,7 @@ private void testOutputProcedureBinaryInorderString(String sql) throws SQLExcept
assertEquals(stringValue1.startsWith(expectedStr), true, "\nDecryption failed with getString(): "
+ stringValue1 + ".\nExpected Value: " + expectedStr);
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
} finally {
index++;
}
Expand Down Expand Up @@ -2233,7 +2233,7 @@ protected static void createDateTableCallableStatement(String cekName) throws SQ
stmt.execute(sql);
stmt.execute("DBCC FREEPROCCACHE");
} catch (SQLException e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -2391,7 +2391,7 @@ private void testOutputProcedureDateInorder(String sql) throws SQLException {
TestResource.getResource("R_outputParamFailed"));

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -2442,7 +2442,7 @@ private void testOutputProcedureDateInorderObject(String sql) throws SQLExceptio
TestResource.getResource("R_outputParamFailed"));

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -2492,7 +2492,7 @@ private void testOutputProcedureBatchInorder(String sql) throws SQLException {
BigDecimal smallmoneyValue = callableStatement.getSmallMoney(4);
assertEquals("" + smallmoneyValue, numericValues[12], TestResource.getResource("R_outputParamFailed"));
} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -2563,7 +2563,7 @@ private void testMixedProcedureDateScaleInorder(String sql) throws SQLException
TestResource.getResource("R_outputParamFailed"));

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}

Expand Down Expand Up @@ -2594,7 +2594,7 @@ private void testMixedProcedureDateScaleWithParameterName(String sql) throws SQL
TestResource.getResource("R_outputParamFailed"));

} catch (Exception e) {
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
fail(e.getMessage());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ public void testAEv2Disabled(String serverName, String url, String protocol) thr
SQLServerStatement stmt = (SQLServerStatement) con.createStatement()) {
String[] values = createCharValues(nullable);
testChars(stmt, cekJks, charTable, values, TestCase.NORMAL, true);
fail("enclaveProperties: " + enclaveProperties + "\n"
+ TestResource.getResource("R_expectedExceptionNotThrown"));
fail(TestResource.getResource("R_expectedExceptionNotThrown"));
} catch (Throwable e) {
// testChars called fail()
assertTrue(e.getMessage().contains(TestResource.getResource("R_AlterAEv2Error")));
Expand Down
Loading

0 comments on commit 6ab2831

Please sign in to comment.