Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests | Support multi-platform testing with exclusion tags and fix Skipping tests #1015

Merged
merged 15 commits into from
Apr 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ jobs:
matrix:
SQL-2017:
Target_SQL: 'SQL-2k17-03'
Ex_Groups: 'xSQLv13'
SQL-2008R2:
Target_SQL: 'SQL-2k8R2-SP3-1'
Ex_Groups: 'xSQLv12'
maxParallel: 2
steps:
- powershell: |
Expand All @@ -31,7 +33,7 @@ jobs:
displayName: 'Maven build 43'
inputs:
mavenPomFile: 'pom.xml'
goals: 'clean -Dmssql_jdbc_test_connection_properties=jdbc:sqlserver://$(Target_SQL)$(server_domain);$(database);$(user);$(password); install -Pbuild43'
goals: 'clean -Dmssql_jdbc_test_connection_properties=jdbc:sqlserver://$(Target_SQL)$(server_domain);$(database);$(user);$(password); install -Pbuild43 -DexcludeGroups=$(Ex_Groups)'
testResultsFiles: '**/TEST-*.xml'
testRunTitle: 'Maven build 43'
javaHomeOption: Path
Expand All @@ -43,7 +45,7 @@ jobs:
displayName: 'Maven build 42'
inputs:
mavenPomFile: 'pom.xml'
goals: 'clean -Dmssql_jdbc_test_connection_properties=jdbc:sqlserver://$(Target_SQL)$(server_domain);$(database);$(user);$(password); install -Pbuild42'
goals: 'clean -Dmssql_jdbc_test_connection_properties=jdbc:sqlserver://$(Target_SQL)$(server_domain);$(database);$(user);$(password); install -Pbuild42 -DexcludeGroups=$(Ex_Groups)'
testRunTitle: 'Maven build 42'
javaHomeOption: Path
jdkDirectory: $(JDK11)
Expand Down
34 changes: 31 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,17 @@
</scm>

<properties>
<!-- Allowed values for excluded Groups here - - - - - - - - - - - - -
xSQLv12 - - - - - - For tests not compatible with SQL Server 2008 R2 - 2014
xSQLv13 - - - - - - For tests not compatible with SQL Server 2008 R2 - 2017
xSQLv14 - - - - - - For tests not compatible with SQL Server 2008 R2 - 2019
xAzureSQLDB - - - - For tests not compatible with Azure SQL Database - -
xAzureSQLDW - - - - For tests not compatible with Azure Data Warehouse -
xAzureSQLMI - - - - For tests not compatible with Azure SQL Managed Instance
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Default testing enabled with SQL Server 2019 (SQLv14) -->
<excludeGroups>xSQLv14</excludeGroups>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<testGroup></testGroup>
<!-- Driver Dependencies -->
<azure.keyvault.version>1.2.0</azure.keyvault.version>
<azure.adal4j.version>1.6.3</azure.adal4j.version>
Expand Down Expand Up @@ -235,7 +244,8 @@
<properties>
<excludeTags>${skipTestTag}</excludeTags>
</properties>
<groups>${testGroup}</groups>
<!-- Exclude [xJDBC42] For tests not compatible with JDBC 4.2 Specifications -->
<excludedGroups>${excludeGroups}, xJDBC42</excludedGroups>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -305,7 +315,8 @@
<properties>
<excludeTags>${skipTestTag}</excludeTags>
</properties>
<groups>${testGroup}</groups>
<excludedGroups>
${excludeGroups}</excludedGroups>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -437,6 +448,23 @@
<rulesUri>file:///${session.executionRootDirectory}/maven-version-rules.xml</rulesUri>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<configuration>
<fileSets>
<fileSet>
<directory>jacoco-execs/</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
</fileSets>
<!-- File containing the merged coverage data -->
<destFile>${project.build.directory}/jacoco.exec</destFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package com.microsoft.sqlserver.jdbc.AlwaysEncrypted;

import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

import java.io.BufferedReader;
import java.io.File;
Expand Down Expand Up @@ -35,12 +34,10 @@
import com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement;
import com.microsoft.sqlserver.jdbc.SQLServerStatement;
import com.microsoft.sqlserver.jdbc.SQLServerStatementColumnEncryptionSetting;
import com.microsoft.sqlserver.jdbc.TestResource;
import com.microsoft.sqlserver.jdbc.TestUtils;
import com.microsoft.sqlserver.testframework.AbstractSQLGenerator;
import com.microsoft.sqlserver.testframework.AbstractTest;
import com.microsoft.sqlserver.testframework.Constants;
import com.microsoft.sqlserver.testframework.DBConnection;
import com.microsoft.sqlserver.testframework.PrepUtil;

import microsoft.sql.DateTimeOffset;
Expand Down Expand Up @@ -74,14 +71,10 @@ public class AESetup extends AbstractTest {
*/
@BeforeAll
public static void setUpConnection() throws TestAbortedException, Exception {
try (DBConnection con = new DBConnection(connectionString)) {
assumeTrue(13 <= con.getServerVersion(), TestResource.getResource("R_Incompat_SQLServerVersion"));
}

AETestConnectionString = connectionString + ";sendTimeAsDateTime=false";
readFromFile(Constants.JAVA_KEY_STORE_FILENAME, "Alias name");
try (SQLServerConnection con = (SQLServerConnection) PrepUtil.getConnection(AETestConnectionString);
SQLServerStatement stmt = (SQLServerStatement) con.createStatement()) {
try (Connection con = PrepUtil.getConnection(AETestConnectionString);
Statement stmt = con.createStatement()) {
dropCEK(stmt);
dropCMK(stmt);
}
Expand All @@ -108,11 +101,7 @@ public static void setUpConnection() throws TestAbortedException, Exception {
*/
@AfterAll
public static void dropAll() throws Exception {
try (DBConnection con = new DBConnection(connectionString)) {
assumeTrue(13 <= con.getServerVersion(), TestResource.getResource("R_Incompat_SQLServerVersion"));
}

try (Connection con = getConnection(); Statement stmt = con.createStatement()) {
try (Statement stmt = connection.createStatement()) {
dropTables(stmt);
dropCEK(stmt);
dropCMK(stmt);
Expand All @@ -131,7 +120,6 @@ private static void readFromFile(String inputFile, String lookupValue) throws IO
filePath = TestUtils.getCurrentClassPath();
try {
File f = new File(filePath + inputFile);
assumeTrue(f.exists(), TestResource.getResource("R_noKeyStore"));
try (BufferedReader buffer = new BufferedReader(new FileReader(f))) {
String readLine = "";
String[] linecontents;
Expand Down
Loading