Commit d86195d2 authored by Marc Gravell's avatar Marc Gravell

Migrate.Basic should detect redis-64

parent 2a850d55
using System.Linq;
using System;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
......@@ -12,11 +13,14 @@ public class Migrate : TestBase
[Fact]
public async Task Basic()
{
var fromConfig = new ConfigurationOptions { EndPoints = { { TestConfig.Current.SecureServer, TestConfig.Current.SecurePort } }, Password = TestConfig.Current.SecurePassword };
var toConfig = new ConfigurationOptions { EndPoints = { { TestConfig.Current.MasterServer, TestConfig.Current.MasterPort } } };
var fromConfig = new ConfigurationOptions { EndPoints = { { TestConfig.Current.SecureServer, TestConfig.Current.SecurePort } }, Password = TestConfig.Current.SecurePassword, AllowAdmin = true };
var toConfig = new ConfigurationOptions { EndPoints = { { TestConfig.Current.MasterServer, TestConfig.Current.MasterPort } }, AllowAdmin = true };
using (var from = ConnectionMultiplexer.Connect(fromConfig))
using (var to = ConnectionMultiplexer.Connect(toConfig))
{
if (await IsWindows(from) || await IsWindows(to))
Skip.Inconclusive("'migrate' is unreliable on redis-64");
RedisKey key = Me();
var fromDb = from.GetDatabase();
var toDb = to.GetDatabase();
......@@ -35,5 +39,15 @@ public async Task Basic()
Assert.Equal("foo", s);
}
}
private async Task<bool> IsWindows(ConnectionMultiplexer conn)
{
var server = conn.GetServer(conn.GetEndPoints().First());
var section = (await server.InfoAsync("server")).Single();
var os = section.FirstOrDefault(
x => string.Equals("os", x.Key, StringComparison.OrdinalIgnoreCase));
// note: WSL returns things like "os:Linux 4.4.0-17134-Microsoft x86_64"
return string.Equals("windows", os.Value, StringComparison.OrdinalIgnoreCase);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment