re-enable data integration test (does not yet add new migrations)

ref #1173
This commit is contained in:
Collin M. Barrett 2020-02-10 07:41:21 -06:00
parent d4db6cf11f
commit 54a5dee7c8
2 changed files with 26 additions and 31 deletions

View file

@ -51,21 +51,18 @@ steps:
inputs:
command: "volume"
arguments: "create test-data-results"
enabled: false
- task: DockerCompose@0
displayName: "up test-data db"
inputs:
dockerComposeFile: "docker-compose.data.tests.yml"
dockerComposeCommand: "up -d mariadb"
enabled: false
- task: DockerCompose@0
displayName: "run test-data"
inputs:
dockerComposeFile: "docker-compose.data.tests.yml"
dockerComposeCommand: "run api"
enabled: false
- task: Docker@2
displayName: "create volume test-services-results"
@ -85,7 +82,6 @@ steps:
command: "container"
arguments: "create --name test-data-results -v test-data-results:/results hello-world"
condition: "succeededOrFailed()"
enabled: false
- task: Docker@2
displayName: "copy out test-data results"
@ -93,7 +89,6 @@ steps:
command: "cp"
arguments: "test-data-results:/results $(System.DefaultWorkingDirectory)"
condition: "succeededOrFailed()"
enabled: false
- task: Docker@2
displayName: "create container test-services-results"

View file

@ -1,28 +1,28 @@
//using System.Threading;
//using FilterLists.Data.Seed.Extensions;
//using Microsoft.EntityFrameworkCore;
//using Xunit;
using System.Threading;
using Microsoft.EntityFrameworkCore;
using Xunit;
//namespace FilterLists.Data.Tests
//{
// public class SeedFilterListsDbContextTests
// {
// [Fact]
// public async void SeedOrUpdateAsync_DoesNotThrowException()
// {
// //TODO: replace with Polly or similar to optimize time waste
// // allow time for db to init
// Thread.Sleep(20000);
namespace FilterLists.Data.Tests
{
public class SeedFilterListsDbContextTests
{
[Fact]
public void Migrate_DoesNotThrowException()
{
// TODO: replace with Polly or similar to optimize time waste
// allow time for db to init
Thread.Sleep(20000);
// const string connString = "Server=mariadb;Database=filterlists;Uid=filterlists;Pwd=filterlists;";
// var options = new DbContextOptionsBuilder<FilterListsDbContext>()
// .UseMySql(connString, m => m.MigrationsAssembly("FilterLists.Api"))
// .Options;
// using (var context = new FilterListsDbContext(options))
// {
// await context.Database.EnsureCreatedAsync();
// await SeedFilterListsDbContext.SeedOrUpdateAsync(context, "../../../data");
// }
// }
// }
//}
const string connString = "Server=mariadb;Database=filterlists;Uid=filterlists;Pwd=filterlists;";
var options = new DbContextOptionsBuilder<FilterListsDbContext>()
.UseMySql(connString, m => m.MigrationsAssembly("FilterLists.Data")
.ServerVersion(Constants.ServerVersion))
.Options;
using (var context = new FilterListsDbContext(options))
{
context.Database.Migrate();
}
}
}
}