diff --git a/INSTALLATION.md b/INSTALLATION.md index fecafaa..6de8fec 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -269,7 +269,11 @@ namespace to be available for use and configured. Before running any of the test scenarios, the environment variable `AZBRIDGE_TEST_CXNSTRING` must be set to the Relay namespace connection string (enclosed in quotes) on the build platform. The given Relay namespace must be preconfigured with hybrid connections named -"a1", "a2", and "a3". +"a1.win", "a2.win", and "a3.win", and an HTTP connection named "http.win" for +the Windows tests, and with hybrid connections named "a1.linux", "a2.linux", and +"a3.linux", and an HTTP connection named "http.linux" for the Linux tests, and +with hybrid connections named "a1.osx", "a2.osx", and "a3.osx", and an HTTP +connection named "http.osx" for the macOS tests. An [Azure Resource Manager template](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-deploy-cli) diff --git a/Microsoft.Azure.Relay.Bridge.sln b/Microsoft.Azure.Relay.Bridge.sln index ae1ad0c..20c3bd0 100644 --- a/Microsoft.Azure.Relay.Bridge.sln +++ b/Microsoft.Azure.Relay.Bridge.sln @@ -20,9 +20,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Directory.Build.props = Directory.Build.props Directory.Build.targets = Directory.Build.targets global.json = global.json + INSTALLATION.md = INSTALLATION.md LICENSE.txt = LICENSE.txt NuGetPackageVerifier.json = NuGetPackageVerifier.json - OVERVIEW.md = OVERVIEW.md package-all.cmd = package-all.cmd package.cmd = package.cmd package.sh = package.sh diff --git a/build/repo.props b/build/repo.props index f7137d5..f97bc38 100644 --- a/build/repo.props +++ b/build/repo.props @@ -13,9 +13,11 @@ _SYSTEMD + _LINUX _LAUNCHD + _OSX diff --git a/test/unit/Microsoft.Azure.Relay.Bridge.Tests/BridgeTest.cs b/test/unit/Microsoft.Azure.Relay.Bridge.Tests/BridgeTest.cs index db1e7e2..654633a 100644 --- a/test/unit/Microsoft.Azure.Relay.Bridge.Tests/BridgeTest.cs +++ b/test/unit/Microsoft.Azure.Relay.Bridge.Tests/BridgeTest.cs @@ -14,8 +14,23 @@ namespace Microsoft.Azure.Relay.Bridge.Test using Microsoft.Azure.Relay.Bridge.Tests; using Xunit; + public class BridgeTest : IClassFixture { +#if _WINDOWS + private const string relayA1 = "a1.win"; + private const string relayA2 = "a2.win"; + private const string relayHttp = "http.win"; +#elif _LINUX + private const string relayA1 = "a1.linux"; + private const string relayA2 = "a2.linux"; + private const string relayHttp = "http.linux"; +#elif _OSX + private const string relayA1 = "a1.osx"; + private const string relayA2 = "a2.osx"; + private const string relayHttp = "http.osx"; +#endif + readonly LaunchSettingsFixture launchSettingsFixture; public BridgeTest(LaunchSettingsFixture launchSettingsFixture) @@ -36,14 +51,14 @@ public void TcpBridge() BindAddress = "127.0.97.1", BindPort = 29876, PortName = "test", - RelayName = "a1" + RelayName = relayA1 }); cfg.RemoteForward.Add(new RemoteForward { Host = "127.0.97.2", HostPort = 29877, PortName = "test", - RelayName = "a1" + RelayName = relayA1 }); Host host = new Host(cfg); host.Start(); @@ -104,14 +119,14 @@ public void UdpBridge() BindAddress = "127.0.97.1", BindPort = -29876, PortName = "testu", - RelayName = "a2" + RelayName = relayA2 }); cfg.RemoteForward.Add(new RemoteForward { Host = "127.0.97.2", HostPort = -29877, PortName = "testu", - RelayName = "a2" + RelayName = relayA2 }); Host host = new Host(cfg); host.Start(); @@ -174,7 +189,7 @@ public void UdpBridge() } } -#if !_WINDOWS +#if _SYSTEMD [Fact(Skip="Unreliable")] public void SocketBridge() { @@ -191,13 +206,13 @@ public void SocketBridge() var lf = new LocalForward { BindLocalSocket = Path.Combine(Path.GetTempPath(),Path.GetRandomFileName()), - RelayName = "a2", + RelayName = relayA2, PortName = "test" }; var rf = new RemoteForward { LocalSocket = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()), - RelayName = "a2", + RelayName = relayA2, PortName = "test" }; cfg.LocalForward.Add(lf); @@ -267,13 +282,13 @@ public void TcpBridgeBadListener() { BindAddress = "127.0.97.1", BindPort = 29876, - RelayName = "a1" + RelayName = relayA1 }); cfg.RemoteForward.Add(new RemoteForward { Host = "127.0.97.2", HostPort = 29877, - RelayName = "a1" + RelayName = relayA1 }); Host host = new Host(cfg); host.Start(); @@ -327,7 +342,7 @@ public async Task HttpBridge() Host = "127.0.97.2", HostPort = 29877, PortName = "http", - RelayName = "http", + RelayName = relayHttp, Http = true }); Host host = new Host(cfg); @@ -336,7 +351,7 @@ public async Task HttpBridge() try { RelayConnectionStringBuilder csb = new RelayConnectionStringBuilder(Utilities.GetConnectionString()); - var httpEndpoint = new UriBuilder(csb.Endpoint) { Scheme = "https", Port = 443, Path="http" }.Uri; + var httpEndpoint = new UriBuilder(csb.Endpoint) { Scheme = "https", Port = 443, Path=relayHttp }.Uri; var httpSasToken = (await TokenProvider.CreateSharedAccessSignatureTokenProvider(csb.SharedAccessKeyName, csb.SharedAccessKey).GetTokenAsync(httpEndpoint.AbsoluteUri, TimeSpan.FromHours(1))).TokenString; using (var l = new HttpListener())