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

Set TableName from config to get most of the AzureTableJournalSpec te… #43

Merged
merged 2 commits into from
Sep 6, 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
13 changes: 7 additions & 6 deletions src/Akka.Persistence.Azure.Tests/AzureTableJournalSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
using Akka.Configuration;
using Akka.Persistence.Azure.TestHelpers;
using Akka.Persistence.TCK.Journal;
using Akka.Util.Internal;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
using Xunit;
using Xunit.Abstractions;
using static Akka.Persistence.Azure.Tests.AzureStorageConfigHelper;
Expand All @@ -33,10 +30,14 @@ public AzureTableJournalSpec(ITestOutputHelper output) : base(Config(), nameof(A

public static Config Config()
{
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("AZURE_CONNECTION_STR")))
return AzureConfig(Environment.GetEnvironmentVariable("AZURE_CONNECTION_STR"));
var config =
!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("AZURE_CONNECTION_STR"))
? AzureConfig(Environment.GetEnvironmentVariable("AZURE_CONNECTION_STR"))
: AzureConfig(WindowsAzureStorageEmulatorFixture.GenerateConnStr());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


return AzureConfig(WindowsAzureStorageEmulatorFixture.GenerateConnStr());
TableName = config.GetString("akka.persistence.journal.azure-table.table-name");

return config;
}

protected override void Dispose(bool disposing)
Expand Down
15 changes: 14 additions & 1 deletion src/Akka.Persistence.Azure.Tests/SerializerHelperSpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;
using Akka.Configuration;
using Akka.Persistence.Azure.TestHelpers;
using FluentAssertions;
using Xunit;
using Xunit.Abstractions;
Expand All @@ -11,13 +13,24 @@ public class SerializerHelperSpecs : Akka.TestKit.Xunit2.TestKit
{
private readonly SerializationHelper _helper;

public SerializerHelperSpecs(ITestOutputHelper helper) : base(output: helper)
public SerializerHelperSpecs(ITestOutputHelper helper)
: base(Config(), nameof(SerializerHelperSpecs), output: helper)
{
// force Akka.Persistence serializers to be loaded
AzurePersistence.Get(Sys);
_helper = new SerializationHelper(Sys);
}

public static Config Config()
{
var azureConfig =
!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("AZURE_CONNECTION_STR"))
? AzureStorageConfigHelper.AzureConfig(Environment.GetEnvironmentVariable("AZURE_CONNECTION_STR"))
: AzureStorageConfigHelper.AzureConfig(WindowsAzureStorageEmulatorFixture.GenerateConnStr());

return azureConfig;
}

[Fact]
public void ShouldSerializeAndDeserializePersistentRepresentation()
{
Expand Down