Skip to content

Commit

Permalink
Add "requireSecret" exclude tag for tests which require adding a secr…
Browse files Browse the repository at this point in the history
…et to app registration (#2596)

* add secretRequired tag

* more

* update

* add test
  • Loading branch information
lilgreenbird authored Feb 7, 2025
1 parent 25ea8da commit b1d9b3e
Show file tree
Hide file tree
Showing 19 changed files with 99 additions and 44 deletions.
110 changes: 73 additions & 37 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@
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
NTLM - - - - - - - For tests using NTLM Authentication mode (excluded by default)
kerberos - - - - - For tests using Kerberos authentication (excluded by default)
NTLM - - - For tests using NTLM Authentication mode (excluded by default)
kerberos - - - - For tests using Kerberos authentication (excluded by default)
reqExternalSetup - For tests requiring external setup (excluded by default)
clientCertAuth - - For tests requiring client certificate authentication
setup (excluded by default) - - - - - - - - - - - - - - - - - - - - - - -
setup (excluded by default) - - - - - - - - - - - - - - - - - - - - - - -
requireSecret - For tests requiring setting up secrets manually
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Default testing enabled with SQL Server 2019 (SQLv15) -->
<excludedGroups>xSQLv12,xSQLv15,NTLM,MSI,reqExternalSetup,clientCertAuth,fedAuth,kerberos</excludedGroups>
<excludedGroups>
xSQLv12,xSQLv15,NTLM,MSI,reqExternalSetup,clientCertAuth,fedAuth,kerberos,requireSecret</excludedGroups>
<!-- Use -preview for preview release, leave empty for official release. -->
<releaseExt>-preview</releaseExt>
<!-- Driver Dependencies -->
Expand Down Expand Up @@ -228,7 +230,8 @@
<repositories>
<repository>
<id>central</id>
<url>https://sqlclientdrivers.pkgs.visualstudio.com/public/_packaging/mssql-jdbc/maven/v1</url>
<url>
https://sqlclientdrivers.pkgs.visualstudio.com/public/_packaging/mssql-jdbc/maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
Expand All @@ -240,7 +243,8 @@
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://sqlclientdrivers.pkgs.visualstudio.com/public/_packaging/mssql-jdbc/maven/v1</url>
<url>
https://sqlclientdrivers.pkgs.visualstudio.com/public/_packaging/mssql-jdbc/maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
Expand All @@ -253,22 +257,29 @@
<profile>
<id>jre8</id>
<build>
<finalName>${project.artifactId}-${project.version}.jre8${releaseExt}</finalName>
<finalName>
${project.artifactId}-${project.version}.jre8${releaseExt}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<excludes>
<exclude>**/com/microsoft/sqlserver/jdbc/ISQLServerConnection43.java</exclude>
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerConnection43.java</exclude>
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerJdbc43.java</exclude>
<exclude>
**/com/microsoft/sqlserver/jdbc/ISQLServerConnection43.java</exclude>
<exclude>
**/com/microsoft/sqlserver/jdbc/SQLServerConnection43.java</exclude>
<exclude>
**/com/microsoft/sqlserver/jdbc/SQLServerJdbc43.java</exclude>
</excludes>
<testExcludes>
<exclude>**/com/microsoft/sqlserver/jdbc/connection/ConnectionWrapper43Test.java</exclude>
<exclude>**/com/microsoft/sqlserver/jdbc/connection/RequestBoundaryMethodsTest.java</exclude>
<exclude>**/com/microsoft/sqlserver/jdbc/JDBC43Test.java</exclude>
<exclude>
**/com/microsoft/sqlserver/jdbc/connection/ConnectionWrapper43Test.java</exclude>
<exclude>
**/com/microsoft/sqlserver/jdbc/connection/RequestBoundaryMethodsTest.java</exclude>
<exclude>
**/com/microsoft/sqlserver/jdbc/JDBC43Test.java</exclude>
</testExcludes>
<source>1.8</source>
<target>1.8</target>
Expand All @@ -287,7 +298,8 @@
<version>3.1.1</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestFile>
${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
Expand All @@ -296,7 +308,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<!-- Exclude [xJDBC42] For tests not compatible with JDBC 4.2 Specifications -->
<!-- Exclude [xJDBC42] For tests not compatible with
JDBC 4.2 Specifications -->
<excludedGroups>${excludedGroups}, xJDBC42</excludedGroups>
</configuration>
</plugin>
Expand All @@ -306,15 +319,17 @@
<profile>
<id>jre11</id>
<build>
<finalName>${project.artifactId}-${project.version}.jre11${releaseExt}</finalName>
<finalName>
${project.artifactId}-${project.version}.jre11${releaseExt}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<excludes>
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java</exclude>
<exclude>
**/com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java</exclude>
</excludes>
<source>11</source>
<target>11</target>
Expand All @@ -326,9 +341,11 @@
<version>3.1.1</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestFile>
${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Automatic-Module-Name>com.microsoft.sqlserver.jdbc</Automatic-Module-Name>
<Automatic-Module-Name>
com.microsoft.sqlserver.jdbc</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
Expand All @@ -339,15 +356,17 @@
<profile>
<id>jre17</id>
<build>
<finalName>${project.artifactId}-${project.version}.jre17${releaseExt}</finalName>
<finalName>
${project.artifactId}-${project.version}.jre17${releaseExt}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<excludes>
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java</exclude>
<exclude>
**/com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java</exclude>
</excludes>
<source>17</source>
<target>17</target>
Expand All @@ -359,9 +378,11 @@
<version>3.1.1</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestFile>
${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Automatic-Module-Name>com.microsoft.sqlserver.jdbc</Automatic-Module-Name>
<Automatic-Module-Name>
com.microsoft.sqlserver.jdbc</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
Expand All @@ -372,15 +393,17 @@
<profile>
<id>jre21</id>
<build>
<finalName>${project.artifactId}-${project.version}.jre21${releaseExt}</finalName>
<finalName>
${project.artifactId}-${project.version}.jre21${releaseExt}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<excludes>
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java</exclude>
<exclude>
**/com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java</exclude>
</excludes>
<source>21</source>
<target>21</target>
Expand All @@ -392,9 +415,11 @@
<version>3.1.1</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestFile>
${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Automatic-Module-Name>com.microsoft.sqlserver.jdbc</Automatic-Module-Name>
<Automatic-Module-Name>
com.microsoft.sqlserver.jdbc</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
Expand All @@ -408,15 +433,17 @@
<activeByDefault>true</activeByDefault>
</activation>
<build>
<finalName>${project.artifactId}-${project.version}.jre23${releaseExt}</finalName>
<finalName>
${project.artifactId}-${project.version}.jre23${releaseExt}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<excludes>
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java</exclude>
<exclude>
**/com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java</exclude>
</excludes>
<source>23</source>
<target>23</target>
Expand All @@ -428,9 +455,11 @@
<version>3.1.1</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestFile>
${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Automatic-Module-Name>com.microsoft.sqlserver.jdbc</Automatic-Module-Name>
<Automatic-Module-Name>
com.microsoft.sqlserver.jdbc</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
Expand Down Expand Up @@ -477,12 +506,16 @@
<configuration>
<rules>
<bannedPlugins>
<!-- will only display a warning but does not fail the build. -->
<!-- will only display a warning but does
not fail the build. -->
<level>WARN</level>
<excludes>
<exclude>org.apache.maven.plugins:maven-verifier-plugin</exclude>
<exclude>
org.apache.maven.plugins:maven-verifier-plugin</exclude>
</excludes>
<message>Please consider using the maven-invoker-plugin
<message>
Please consider using the
maven-invoker-plugin
(http://maven.apache.org/plugins/maven-invoker-plugin/)!</message>
</bannedPlugins>
<requireMavenVersion>
Expand Down Expand Up @@ -535,8 +568,10 @@
com.microsoft.sqlserver.jdbc.dataclassification,
microsoft.sql
</_exportcontents>
<Import-Package>!microsoft.sql,jdk.net;resolution:=optional,*</Import-Package>
<Bundle-Activator>com.microsoft.sqlserver.jdbc.osgi.Activator</Bundle-Activator>
<Import-Package>
!microsoft.sql,jdk.net;resolution:=optional,*</Import-Package>
<Bundle-Activator>
com.microsoft.sqlserver.jdbc.osgi.Activator</Bundle-Activator>
</instructions>
</configuration>
<executions>
Expand Down Expand Up @@ -573,7 +608,8 @@
<inherited>true</inherited>
<configuration>
<outputFile>outdated-dependencies.txt</outputFile>
<rulesUri>file:///${session.executionRootDirectory}/maven-version-rules.xml</rulesUri>
<rulesUri>
file:///${session.executionRootDirectory}/maven-version-rules.xml</rulesUri>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
@Tag(Constants.xAzureSQLDB)
@Tag(Constants.xAzureSQLDW)
@Tag(Constants.reqExternalSetup)
@Tag(Constants.requireSecret)
public class BulkCopySendTemporalDataTypesAsStringAETest extends AESetup {
static String inputFile = "BulkCopyCSVSendTemporalDataTypesAsStringForBulkCopy.csv";
static String encoding = "UTF-8";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
@Tag(Constants.xAzureSQLDW)
@Tag(Constants.xAzureSQLDB)
@Tag(Constants.reqExternalSetup)
@Tag(Constants.requireSecret)
public class CallableStatementTest extends AESetup {

private static String multiStatementsProcedure = AbstractSQLGenerator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
@Tag(Constants.xAzureSQLDW)
@Tag(Constants.xAzureSQLDB)
@Tag(Constants.reqExternalSetup)
@Tag(Constants.requireSecret)
public class EnclaveTest extends AESetup {
/**
* Tests basic connection.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
@Tag(Constants.xAzureSQLDW)
@Tag(Constants.xAzureSQLDB)
@Tag(Constants.reqExternalSetup)
@Tag(Constants.requireSecret)
public class JDBCEncryptionDecryptionTest extends AESetup {
private boolean nullable = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
*/
@RunWith(JUnitPlatform.class)
@Tag(Constants.MSI)
@Tag(Constants.requireSecret)
public class MSITest extends AESetup {

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
@Tag(Constants.xAzureSQLDW)
@Tag(Constants.xAzureSQLDB)
@Tag(Constants.reqExternalSetup)
@Tag(Constants.requireSecret)
public class MultiUserAKVTest extends AESetup {

private static Map<String, SQLServerColumnEncryptionKeyStoreProvider> requiredKeyStoreProvider = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
@Tag(Constants.xSQLv12)
@Tag(Constants.xSQLv14)
@Tag(Constants.reqExternalSetup)
@Tag(Constants.requireSecret)
public class ParameterMetaDataCacheTest extends AESetup {

@BeforeAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
@Tag(Constants.xAzureSQLDW)
@Tag(Constants.xAzureSQLDB)
@Tag(Constants.reqExternalSetup)
@Tag(Constants.requireSecret)
public class PrecisionScaleTest extends AESetup {
private static java.util.Date date = null;
private static int offsetFromGMT = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
@Tag(Constants.xAzureSQLDW)
@Tag(Constants.xAzureSQLDB)
@Tag(Constants.reqExternalSetup)
@Tag(Constants.requireSecret)
public class RegressionAlwaysEncryptedTest extends AESetup {
static String numericTable[][] = {{"Bit", "bit"}, {"Tinyint", "tinyint"}, {"Smallint", "smallint"},};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
@Tag(Constants.xAzureSQLDW)
@Tag(Constants.xAzureSQLDB)
@Tag(Constants.reqExternalSetup)
@Tag(Constants.requireSecret)
public class EnclavePackageTest extends AbstractTest {

private static String connectionStringEnclave = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

@RunWith(JUnitPlatform.class)
@Tag(Constants.fedAuth)
@Tag(Constants.requireSecret)
public class ConcurrentLoginTest extends FedauthCommon {

final AtomicReference<Throwable> throwableRef = new AtomicReference<Throwable>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

@RunWith(JUnitPlatform.class)
@Tag(Constants.fedAuth)
@Tag(Constants.requireSecret)
public class ConnectionEncryptionTest extends FedauthCommon {

static String charTable = TestUtils.escapeSingleQuotes(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
@RunWith(JUnitPlatform.class)
@Tag("slow")
@Tag(Constants.fedAuth)
@Tag(Constants.requireSecret)
public class ConnectionSuspensionTest extends FedauthCommon {

static String charTable = TestUtils.escapeSingleQuotes(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

@RunWith(JUnitPlatform.class)
@Tag(Constants.fedAuth)
@Tag(Constants.requireSecret)
public class ErrorMessageTest extends FedauthCommon {

String badUserName = "abc" + azureUserName;
Expand Down
Loading

0 comments on commit b1d9b3e

Please sign in to comment.