Skip to content

Commit

Permalink
Set TableName from config to get most of the AzureTableJournalSpec te… (
Browse files Browse the repository at this point in the history
#43)

* Set TableName from config to get most of the AzureTableJournalSpec tests to pass, went from 13 Passed/22 Failed to 26 Passed/9 Failed

* Added config to get the SerializerHelperSpecs tests to pass
  • Loading branch information
kaleho authored and Aaronontheweb committed Sep 6, 2019
1 parent 30432c0 commit 1bb369b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
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());

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

0 comments on commit 1bb369b

Please sign in to comment.