Skip to content

Commit 4dece57

Browse files
author
Anatoly Popov
committed
tests: should fix tests
1 parent 7492569 commit 4dece57

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

tests/progaudi.tarantool.tests/ConnectionStringFactory.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,30 @@ internal class ConnectionStringFactory
99
{
1010
public static string GetReplicationSource_1_7(string userName = null)
1111
{
12-
return GetReplicationSource(userName, "localhost:3301", "TARANTOOL_1_7_REPLICATION_SOURCE");
12+
return GetReplicationSource(userName, $"{ResolveHostname("localhost")}:3301", "TARANTOOL_1_7_REPLICATION_SOURCE");
1313
}
1414

1515
public static string GetReplicationSource_1_8(string userName = null)
1616
{
17-
return GetReplicationSource(userName, "localhost:3302", "TARANTOOL_1_8_REPLICATION_SOURCE");
17+
return GetReplicationSource(userName, $"{ResolveHostname("localhost")}:3302", "TARANTOOL_1_8_REPLICATION_SOURCE");
1818
}
1919

2020
public static async Task<string> GetRedisConnectionString()
2121
{
2222
var redisUrl = Environment.GetEnvironmentVariable("REDIS_HOST");
2323

24-
var host = "127.0.0.1";
25-
if (!string.IsNullOrWhiteSpace(redisUrl))
24+
return $"{await ResolveHostname(redisUrl)}:6379";
25+
}
26+
27+
private static async Task<string> ResolveHostname(string host)
28+
{
29+
if (!string.IsNullOrWhiteSpace(host))
2630
{
27-
var resolved = await Dns.GetHostAddressesAsync(redisUrl);
28-
host = resolved.First().ToString();
31+
var resolved = await Dns.GetHostAddressesAsync(host);
32+
return resolved.First().ToString();
2933
}
3034

31-
return $"{host}:6379";
35+
return "127.0.0.1";
3236
}
3337

3438
private static string GetReplicationSource(string userName, string defaultString, string envName)

0 commit comments

Comments
 (0)