Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollo3zehn committed Apr 25, 2023
1 parent f341631 commit 6874008
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Nexus.Sources.Remote/RemoteCommunicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public async Task<IJsonRpcServer> ConnectAsync(CancellationToken cancellationTok
{
try
{
cancellationToken.Register(() => _tcpListener.Stop());
cancellationToken.Register(_tcpListener.Stop);

// start process
_logger.LogDebug("Start process.");
Expand Down
14 changes: 11 additions & 3 deletions tests/Nexus.Sources.Remote.Tests/SetupDockerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ Task<ReadOnlyMemory<double>> ReadData(string resourcePath, DateTime begin, DateT
}

var request = new ReadRequest(catalogItem, data, status);
await dataSource.ReadAsync(begin, end, new ReadRequest[] { request }, ReadData, new Progress<double>(), CancellationToken.None);

await dataSource.ReadAsync(
begin,
end,
new ReadRequest[] { request },
ReadData,
new Progress<double>(),
CancellationToken.None);

var doubleData = new CastMemoryManager<byte, double>(data).Memory;

Assert.True(expectedData.SequenceEqual(doubleData.ToArray()));
Expand All @@ -70,7 +78,7 @@ Task<ReadOnlyMemory<double>> ReadData(string resourcePath, DateTime begin, DateT
private static DataSourceContext CreateContext(string satelliteId, string command)
{
return new DataSourceContext(
ResourceLocator: new Uri("https://example.com"),
ResourceLocator: default,
SystemConfiguration: new Dictionary<string, JsonElement>()
{
[typeof(Remote).FullName!] = JsonSerializer.SerializeToElement(new JsonObject()
Expand All @@ -87,7 +95,7 @@ private static DataSourceContext CreateContext(string satelliteId, string comman
["template"] = JsonSerializer.SerializeToElement("docker"),
["command"] = JsonSerializer.SerializeToElement(command),
["git-url"] = JsonSerializer.SerializeToElement($"https://github.com/malstroem-labs/nexus-remoting-template-{satelliteId}"),
["git-tag"] = JsonSerializer.SerializeToElement("v1.0.0")
["git-tag"] = JsonSerializer.SerializeToElement("v2.0.0-beta.1")
},
RequestConfiguration: default
);
Expand Down

0 comments on commit 6874008

Please sign in to comment.