public void ParsePythonApi() { var json = loadJsonFile("pythonApi.json"); var simData = json.ToObject <SimulationData>(); SimulationConfigUtils.ProcessKnownTemplates(ref simData); Assert.That(simData.Template != null, Is.True); Assert.That(simData.Template.Alias, Is.EqualTo("pythonApi")); Assert.That(simData.Template.Parameters.Length, Is.EqualTo(3)); Assert.That(simData.ApiOnly, Is.True); var s = Newtonsoft.Json.JsonConvert.SerializeObject(simData, JsonSettings.camelCase); Debug.Log($"Simulation data: {s}"); Assert.That(simData.Map == null, Is.True); Assert.That(simData.Vehicles == null, Is.True); var environment = new Dictionary <string, string>(); SimulationConfigUtils.UpdateTestCaseEnvironment(simData.Template, environment); Assert.That(environment["SIMULATOR_API_ONLY"], Is.EqualTo("1")); Assert.That(environment["SIMULATOR_TC_FILENAME"], Is.EqualTo("scenario.py")); }
public async Task <TestCaseFinishedArgs> StartProcess(TemplateData template, string workingDirectory) { var environment = new Dictionary <string, string>(); SimulationConfigUtils.UpdateTestCaseEnvironment(template, environment); var runArgs = new List <string> { "run" }; if (environment.ContainsKey("SIMULATOR_TC_FILENAME")) { runArgs.Add(environment["SIMULATOR_TC_FILENAME"]); } Debug.Log($"Start TC process from image {template.Runner.Docker.Image}"); // path/image // path/image:tag // host/path/image // host/path/image:tag // host:port/path/image // host:port/path/image:tag string dockerRepository = template.Runner.Docker.Image; string dockerTag = "latest"; int colonPos = dockerRepository.LastIndexOf(":"); if (colonPos > 0 && dockerRepository.IndexOf('/', colonPos) < 0) { dockerTag = dockerRepository.Substring(colonPos + 1); dockerRepository = dockerRepository.Substring(0, colonPos); } Debug.Log($"Docker repository:{dockerRepository} tag:{dockerTag}"); var authConfig = AuthConfigFromTemplate(template); var id = await RunContainer(authConfig, dockerRepository, dockerTag, runArgs, environment, workingDirectory); return(await GetContainerResult(id)); }