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

added TCK SerializationSpecs #58

Merged
merged 2 commits into from
Oct 9, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// -----------------------------------------------------------------------
// <copyright file="AzureBlobSnapshotStoreSerializationSpec.cs" company="Petabridge, LLC">
// Copyright (C) 2015 - 2019 Petabridge, LLC <https://petabridge.com>
// </copyright>
// -----------------------------------------------------------------------

using System;
using Akka.Configuration;
using Akka.Persistence.Azure.TestHelpers;
using Akka.Persistence.Azure.Tests.Helper;
using Akka.Persistence.TCK.Serialization;
using Xunit;
using Xunit.Abstractions;

namespace Akka.Persistence.Azure.Tests
{
[Collection("AzureSnapshot")]
public class AzureBlobSnapshotStoreSerializationSpec : SnapshotStoreSerializationSpec
{
public AzureBlobSnapshotStoreSerializationSpec(ITestOutputHelper output) : base(Config(),
nameof(AzureTableJournalSpec), output)
{
AzurePersistence.Get(Sys);
}

public static Config Config()
{
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("AZURE_CONNECTION_STR")))
return AzureStorageConfigHelper.AzureConfig(Environment.GetEnvironmentVariable("AZURE_CONNECTION_STR"));

return AzureStorageConfigHelper.AzureConfig(WindowsAzureStorageEmulatorFixture.GenerateConnStr());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// -----------------------------------------------------------------------
// <copyright file="AzureTableJournalSerializationSpec.cs" company="Petabridge, LLC">
// Copyright (C) 2015 - 2019 Petabridge, LLC <https://petabridge.com>
// </copyright>
// -----------------------------------------------------------------------

using System;
using Akka.Configuration;
using Akka.Persistence.Azure.TestHelpers;
using Akka.Persistence.Azure.Tests.Helper;
using Akka.Persistence.TCK.Serialization;
using Xunit;
using Xunit.Abstractions;

namespace Akka.Persistence.Azure.Tests
{
[Collection("AzureJournal")]
public class AzureTableJournalSerializationSpec : JournalSerializationSpec
{
public AzureTableJournalSerializationSpec(ITestOutputHelper output)
: base(Config(), nameof(AzureTableJournalSerializationSpec), output)
{
AzurePersistence.Get(Sys);
output.WriteLine("Current table: {0}", TableName);
}

[Fact(Skip= "https://github.com/akkadotnet/akka.net/issues/3965")]
public override void Journal_should_serialize_Persistent_with_EventAdapter_manifest()
{

}

public static string TableName { get; private set; }

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

TableName = azureConfig.GetString("akka.persistence.journal.azure-table.table-name");

return azureConfig;
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (DbUtils.CleanupCloudTable(AzurePersistence.Get(Sys).TableSettings.ConnectionString, TableName).Wait(TimeSpan.FromSeconds(3)))
{
Log.Info("Successfully deleted table [{0}] after test run.", TableName);
}
else
{
Log.Error("Unable to delete table [{0}] after test run.", TableName);
}
}
}
}