Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upWrite unit tests for SimpleWorker. #31
Comments
i'm on it |
I did pre-requisite work following https://github.com/dotnet/spark/blob/master/docs/building/ubuntu-instructions.md and then tried to run SimpleWorker but it couldn't be run because of spark/src/csharp/Microsoft.Spark.Worker/Utils/SettingUtils.cs Lines 25 to 29 in 6bdc9be GetEnvironmentVariable("PYTHON_WORKER_FACTORY_PORT") returns null value and it's used for port value so I've changed SimpleWorker.cs from spark/src/csharp/Microsoft.Spark.Worker/SimpleWorker.cs Lines 28 to 29 in 6bdc9be to string secret = Utils.SettingUtils.GetWorkerFactorySecret(_version);
ISocketWrapper clientSocket = SocketFactory.CreateSocket();
var ipEndpoint = (IPEndPoint)clientSocket.LocalEndPoint;
int port = ipEndpoint.Port;
clientSocket.Connect(IPAddress.Loopback, port, secret);
new TaskRunner(0, clientSocket, false, _version).Run(); you can see it KimKiHyuk@a1d1226 and it works properly. test method is here using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using Microsoft.Spark.Network;
using Xunit;
namespace Microsoft.Spark.Worker.UnitTest
{
public class SimpleWorkerTests
{
[Fact]
public void TestsSimpleWorkerTaskRunners()
{
var typedVersion = new Version(Versions.V2_4_0);
var simpleWorker = new SimpleWorker(typedVersion);
Task.Run(() => simpleWorker.Run());
// mock Assert, change condition
Assert.False(false);
}
}
}
do you think master branch code is wrong? or my setting is wrong? actually, I couldn't find what's the purpose of PYTHON_WORKER_FACTORY_PORT and some background tasks about it |
GetWorkerFactoryPort does not work properly, it caused connection refused. please see dotnet#31 (comment)
SimpleWorker unit tests are missing in Spark.Net.Work.UnitTest.