Skip to content

Commit

Permalink
feat(testcontainers#421) Added AzuriteTestcontainer - added switches …
Browse files Browse the repository at this point in the history
…for:

- DebugLog,
- DisableProductStyleUrl,
- SkipApiVersionCheck,
- LooseMode,
- SilentMode
  • Loading branch information
vlaskal committed Aug 7, 2022
1 parent 087ac7a commit b03659d
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace DotNet.Testcontainers.Builders
{
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using DotNet.Testcontainers.Configurations.Modules.Databases;
using DotNet.Testcontainers.Containers;
using JetBrains.Annotations;
Expand Down Expand Up @@ -49,11 +50,42 @@ public static ITestcontainersBuilder<AzuriteTestcontainer> WithAzurite(this ITes
builder = builder
.WithCommand(GetMainCommand(configuration))
.WithCommand(GetServiceEndpointArgs(configuration))
.WithCommand(GetWorkspaceLocation());
.WithCommand(GetWorkspaceLocation())
.WithCommand(GetSilentMode(configuration))
.WithCommand(GetLooseMode(configuration))
.WithCommand(GetSkipApiVersionCheck(configuration))
.WithCommand(GetDisableProductStyleUrl(configuration))
.WithCommand(GetDebugLog(configuration));

return builder;
}

private static string[] GetDebugLog(AzuriteTestcontainerConfiguration configuration)
{
var debugLogFilePath = Path.Combine(AzuriteTestcontainerConfiguration.DefaultLocation, "debug.log");
return configuration.DisableProductStyleUrl ? new[] { "--debug", debugLogFilePath } : null;
}

private static string GetDisableProductStyleUrl(AzuriteTestcontainerConfiguration configuration)
{
return configuration.DisableProductStyleUrl ? "--disableProductStyleUrl" : null;
}

private static string GetSkipApiVersionCheck(AzuriteTestcontainerConfiguration configuration)
{
return configuration.SkipApiVersionCheck ? "--skipApiVersionCheck" : null;
}

private static string GetLooseMode(AzuriteTestcontainerConfiguration configuration)
{
return configuration.LooseMode ? "--loose" : null;
}

private static string GetSilentMode(AzuriteTestcontainerConfiguration configuration)
{
return configuration.Silent ? "--silent" : null;
}

private static string[] GetWorkspaceLocation()
{
return new[] { "--location", AzuriteTestcontainerConfiguration.DefaultLocation };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ namespace DotNet.Testcontainers.Configurations.Modules.Databases

public class AzuriteTestcontainerConfiguration : IDisposable
{
// TODO: Add support for these options based on request
// azurite.cert Path to a PEM or PFX cert file.Required by HTTPS mode.
// azurite.key Path to a PEM key file. Required when azurite.cert points to a PEM file.
// azurite.pwd PFX cert password. Required when azurite.cert points to a PFX file.
// azurite.oauth OAuth authentication level. Candidate level values: basic.
// AZURITE_ACCOUNTS environment variable to set account names and keys.

/// <summary>
/// Default Blob service listening port. Default is 10000.
/// </summary>
Expand Down Expand Up @@ -180,6 +187,40 @@ public string Location
}
}

/// <summary>
/// Gets or sets a value indicating whether disable access log in console. By default false.
/// </summary>
[PublicAPI]
public bool Silent { get; set; }

/// <summary>
/// Gets or sets a value indicating whether loose mode should be enabled.
/// Enable loose mode which ignores unsupported headers and parameters.
/// By default false.
/// </summary>
[PublicAPI]
public bool LooseMode { get; set; }

/// <summary>
/// Gets or sets a value indicating whether skip the request API version check. By default false.
/// </summary>
[PublicAPI]
public bool SkipApiVersionCheck { get; set; }

/// <summary>
/// Gets or sets a value indicating whether force parsing storage account name from request Uri path, instead of from request Uri host. By default false.
/// </summary>
[PublicAPI]
public bool DisableProductStyleUrl { get; set; }

/// <summary>
/// Gets or sets a value indicating whether debug log should be enabled.
/// Logs are stored in debug.log file in workspace location, by default /data/debug.log.
/// By default false.
/// </summary>
[PublicAPI]
public bool Debug { get; set; }

/// <summary>
/// Gets the environment configuration.
/// </summary>
Expand Down

0 comments on commit b03659d

Please sign in to comment.