Skip to content

Commit

Permalink
split test runs across different hycos to avoid parallel build steppi…
Browse files Browse the repository at this point in the history
…ng on eachother
  • Loading branch information
clemensv committed Aug 29, 2024
1 parent 35cb25a commit 2449b28
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 13 deletions.
6 changes: 5 additions & 1 deletion INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Microsoft.Azure.Relay.Bridge.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions build/repo.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
</PropertyGroup>
<PropertyGroup Condition="$(RuntimeIdentifier.StartsWith('linux'))">
<DefineConstants>_SYSTEMD</DefineConstants>
<DefineConstants>_LINUX</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(RuntimeIdentifier.StartsWith('osx'))">
<DefineConstants>_LAUNCHD</DefineConstants>
<DefineConstants>_OSX</DefineConstants>
</PropertyGroup>
<ItemGroup>
<DotNetCoreRuntime Include="$(MicrosoftNETCoreAppPackageVersion)" />
Expand Down
37 changes: 26 additions & 11 deletions test/unit/Microsoft.Azure.Relay.Bridge.Tests/BridgeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,23 @@ namespace Microsoft.Azure.Relay.Bridge.Test
using Microsoft.Azure.Relay.Bridge.Tests;
using Xunit;


public class BridgeTest : IClassFixture<LaunchSettingsFixture>
{
#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)
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -174,7 +189,7 @@ public void UdpBridge()
}
}

#if !_WINDOWS
#if _SYSTEMD
[Fact(Skip="Unreliable")]
public void SocketBridge()
{
Expand All @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand All @@ -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())
Expand Down

0 comments on commit 2449b28

Please sign in to comment.