mirror of
https://github.com/bitwarden/server.git
synced 2024-11-24 12:35:25 +01:00
61a0efbdfc
* Add Pipeline * Fix Lint * Added a Change * Update Pipeline * Add Multi-Version Support * Use Profile Switch for each profile * Fix MySql * Debug MySql * Use Proper Seperator * Add Allow User Variables=true * Pipeline Work * Expand Config for Postgres * Change Config Key * Add Debug Step * Fix Debug Step * Fix Tests * Add Sleep * Fix Tests * Fix SQL Server Tests * Add Sqlite * Use Context Property * Fix Tests * Fix Test Logger * Update AccountRevisionDate Check * Fix Postgres Time Issues * Formatting and Pipeline Update * Remove Unneeded SqlServer Setting * Update .github/workflows/infrastructure-tests.yml Co-authored-by: mimartin12 <77340197+mimartin12@users.noreply.github.com> --------- Co-authored-by: mimartin12 <77340197+mimartin12@users.noreply.github.com>
33 lines
874 B
C#
33 lines
874 B
C#
using Microsoft.Extensions.Configuration;
|
|
using Xunit;
|
|
|
|
namespace Bit.Infrastructure.IntegrationTest;
|
|
|
|
public class DatabaseTheoryAttribute : TheoryAttribute
|
|
{
|
|
private static IConfiguration? _cachedConfiguration;
|
|
|
|
public DatabaseTheoryAttribute()
|
|
{
|
|
if (!HasAnyDatabaseSetup())
|
|
{
|
|
Skip = "No databases setup.";
|
|
}
|
|
}
|
|
|
|
private static bool HasAnyDatabaseSetup()
|
|
{
|
|
var config = GetConfiguration();
|
|
return config.GetDatabases().Length > 0;
|
|
}
|
|
|
|
public static IConfiguration GetConfiguration()
|
|
{
|
|
return _cachedConfiguration ??= new ConfigurationBuilder()
|
|
.AddUserSecrets<DatabaseDataAttribute>(optional: true, reloadOnChange: false)
|
|
.AddEnvironmentVariables("BW_TEST_")
|
|
.AddCommandLine(Environment.GetCommandLineArgs())
|
|
.Build();
|
|
}
|
|
}
|