Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #61 from Surreal-Net/tests_on_windows_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ProphetLamb authored Sep 26, 2022
2 parents 2a1ed22 + 9fd0a67 commit 5a6892e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/Shared/SurrealInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace SurrealDB.Shared.Tests;
public static class SurrealInstance {
public static Process Create() {
// Wait until port is closed
TcpHelper.SpinUntilClosed($"0.0.0.0:{TestHelper.Port}");
TcpHelper.SpinUntilClosed($"{TestHelper.Loopback}:{TestHelper.Port}");
// We have a race condition between when the SurrealDB socket opens (or closes), and when it accepts connections.
// 50ms should be enough to run the tests on most devices.
// Thread.Sleep(50);
Expand All @@ -14,17 +14,20 @@ public static Process Create() {
// Start new instances
var p = Instantiate(path!);
Debug.Assert(p is not null);
TcpHelper.SpinUntilListening($"0.0.0.0:{TestHelper.Port}");
TcpHelper.SpinUntilListening($"{TestHelper.Loopback}:{TestHelper.Port}");
// Thread.Sleep(50);
Debug.Assert(!p.HasExited);
return p;
}

private static Process? Instantiate(string path) {
ProcessStartInfo pi = new() {
// These two settings can make the tests run twice as fast, but makes it harder to kill rouge DB instances
//CreateNoWindow = true,
//UseShellExecute = false,
UseShellExecute = true,
FileName = path,
Arguments = $"start memory -b 0.0.0.0:{TestHelper.Port} -u {TestHelper.User} -p {TestHelper.Pass} --log debug",
Arguments = $"start memory -b {TestHelper.Loopback}:{TestHelper.Port} -u {TestHelper.User} -p {TestHelper.Pass} --log debug",
WorkingDirectory = Environment.CurrentDirectory
};
return Process.Start(pi);
Expand Down

0 comments on commit 5a6892e

Please sign in to comment.