Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Check for EnvVar CI_REDIS for localhost tests #218

Merged
merged 1 commit into from
Nov 1, 2015
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
4 changes: 2 additions & 2 deletions tests/ServiceStack.Redis.Tests/ConfigTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private static void AssertClient(RedisClient redis, RedisEndpoint expected)
[Test]
public void Does_set_Client_name_on_Connection()
{
using (var redis = new RedisClient("localhost?Client=nunit"))
using (var redis = new RedisClient(TestConfig.SingleHost + "?Client=nunit"))
{
var clientName = redis.GetClient();

Expand All @@ -127,7 +127,7 @@ public void Does_set_Client_name_on_Connection()
[Test]
public void Does_set_Client_on_Pooled_Connection()
{
using (var redisManager = new PooledRedisClientManager("localhost?Client=nunit"))
using (var redisManager = new PooledRedisClientManager(TestConfig.SingleHost + "?Client=nunit"))
using (var redis = redisManager.GetClient())
{
var clientName = redis.GetClient();
Expand Down
2 changes: 1 addition & 1 deletion tests/ServiceStack.Redis.Tests/Examples/SimpleLocks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void AcquireLock_using_Tasks()
{
Console.WriteLine("About to process " + clientNo);
//var redisClient = new RedisClient("xxxx.redis.cache.windows.net", 6379, "xxxx");
var redisClient = new RedisClient("localhost", 6379);
var redisClient = new RedisClient(TestConfig.SingleHost, 6379);

using (redisClient.AcquireLock("testlock1", TimeSpan.FromMinutes(3)))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public void RedisManagerPool_WhenUsingADatabaseOnARedisConnectionString_CorrectD

private void TestForDatabaseOnConnectionString(Func<string, IRedisClientsManager> factory)
{
_db1ClientManager = factory("localhost?db=1");
_db2ClientManager = factory("localhost?db=2");
_db1ClientManager = factory(TestConfig.SingleHost + "?db=1");
_db2ClientManager = factory(TestConfig.SingleHost + "?db=2");

using (var cacheClient = _db1ClientManager.GetCacheClient())
{
Expand All @@ -59,8 +59,8 @@ private void TestForDatabaseOnConnectionString(Func<string, IRedisClientsManager
[Test]
public void WhenUsingAnInitialDatabase_CorrectDatabaseIsUsed()
{
_db1ClientManager = new BasicRedisClientManager(1, "localhost");
_db2ClientManager = new BasicRedisClientManager(2, "localhost");
_db1ClientManager = new BasicRedisClientManager(1, TestConfig.SingleHost);
_db2ClientManager = new BasicRedisClientManager(2, TestConfig.SingleHost);

using (var cacheClient = _db1ClientManager.GetCacheClient())
{
Expand Down
6 changes: 5 additions & 1 deletion tests/ServiceStack.Redis.Tests/TestConfig.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using ServiceStack.Logging;
using ServiceStack.Support;

Expand All @@ -12,7 +13,10 @@ static TestConfig()

public const bool IgnoreLongTests = true;

public const string SingleHost = "localhost";
public static string SingleHost
{
get { return Environment.GetEnvironmentVariable("CI_REDIS") ?? "localhost"; }
}
public static readonly string[] MasterHosts = new[] { "localhost" };
public static readonly string[] SlaveHosts = new[] { "localhost" };

Expand Down