Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d010ea9ad | ||
| 55af8257a7 | |||
| e385d6b52e |
@@ -2,7 +2,7 @@ name: Build and Push Docker Images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ roman ]
|
||||
branches: [ master ]
|
||||
|
||||
env:
|
||||
REGISTRY: git.nullptr.top
|
||||
@@ -17,10 +17,10 @@ jobs:
|
||||
include:
|
||||
- service: gateway
|
||||
dockerfile: src/LiquidCode.Tester.Gateway/Dockerfile
|
||||
image: git.nullptr.top/liquidcode/liquidcode-tester-gateway-roman
|
||||
image: git.nullptr.top/liquidcode/liquidcode-tester-gateway
|
||||
- service: worker
|
||||
dockerfile: src/LiquidCode.Tester.Worker/Dockerfile
|
||||
image: git.nullptr.top/liquidcode/liquidcode-tester-worker-roman
|
||||
image: git.nullptr.top/liquidcode/liquidcode-tester-worker
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -7,7 +7,5 @@ public record SubmitForTesterModel(
|
||||
string LanguageVersion,
|
||||
string SourceCode,
|
||||
string PackageUrl,
|
||||
string CallbackUrl,
|
||||
int? TimeLimitMs = null,
|
||||
int? MemoryLimitMb = null
|
||||
string CallbackUrl
|
||||
);
|
||||
|
||||
@@ -82,9 +82,7 @@ public class TesterController : ControllerBase
|
||||
LanguageVersion: request.LanguageVersion,
|
||||
SourceCode: request.SourceCode,
|
||||
PackageUrl: packagePath, // Use local path instead of URL
|
||||
CallbackUrl: request.CallbackUrl,
|
||||
TimeLimitMs: request.TimeLimitMs,
|
||||
MemoryLimitMb: request.MemoryLimitMb
|
||||
CallbackUrl: request.CallbackUrl
|
||||
);
|
||||
|
||||
// Send to appropriate worker based on language
|
||||
|
||||
@@ -9,14 +9,4 @@ public class LocalSubmitModel
|
||||
public string SourceCode { get; set; } = string.Empty;
|
||||
public string CallbackUrl { get; set; } = string.Empty;
|
||||
public IFormFile? Package { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional time limit override in milliseconds (for testing purposes)
|
||||
/// </summary>
|
||||
public int? TimeLimitMs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional memory limit override in megabytes (for testing purposes)
|
||||
/// </summary>
|
||||
public int? MemoryLimitMb { get; set; }
|
||||
}
|
||||
|
||||
@@ -38,16 +38,6 @@ public class WorkerClientService : IWorkerClientService
|
||||
form.Add(new StringContent(submit.SourceCode), "SourceCode");
|
||||
form.Add(new StringContent(submit.CallbackUrl), "CallbackUrl");
|
||||
|
||||
// Add optional limit overrides (for testing purposes)
|
||||
if (submit.TimeLimitMs.HasValue)
|
||||
{
|
||||
form.Add(new StringContent(submit.TimeLimitMs.Value.ToString()), "TimeLimitMs");
|
||||
}
|
||||
if (submit.MemoryLimitMb.HasValue)
|
||||
{
|
||||
form.Add(new StringContent(submit.MemoryLimitMb.Value.ToString()), "MemoryLimitMb");
|
||||
}
|
||||
|
||||
// Add package file
|
||||
var fileStream = File.OpenRead(packagePath);
|
||||
var fileContent = new StreamContent(fileStream);
|
||||
@@ -88,10 +78,10 @@ public class WorkerClientService : IWorkerClientService
|
||||
{
|
||||
var workerUrl = language.ToLowerInvariant() switch
|
||||
{
|
||||
"c++" => _configuration["Workers:Cpp"],
|
||||
"c++" or "cpp" => _configuration["Workers:Cpp"],
|
||||
"java" => _configuration["Workers:Java"],
|
||||
"kotlin" => _configuration["Workers:Kotlin"],
|
||||
"c#" => _configuration["Workers:CSharp"],
|
||||
"c#" or "csharp" => _configuration["Workers:CSharp"],
|
||||
"python" => _configuration["Workers:Python"],
|
||||
_ => throw new NotSupportedException($"Language {language} is not supported")
|
||||
};
|
||||
|
||||
@@ -51,9 +51,7 @@ public class TestController : ControllerBase
|
||||
SourceCode = request.SourceCode,
|
||||
CallbackUrl = request.CallbackUrl,
|
||||
Package = null, // Will use file path instead
|
||||
PackageFilePath = packageFilePath,
|
||||
TimeLimitMs = request.TimeLimitMs,
|
||||
MemoryLimitMb = request.MemoryLimitMb
|
||||
PackageFilePath = packageFilePath
|
||||
};
|
||||
|
||||
// Start testing in background
|
||||
@@ -111,14 +109,4 @@ public class TestRequest
|
||||
public string CallbackUrl { get; set; } = string.Empty;
|
||||
public IFormFile? Package { get; set; }
|
||||
public string? PackageFilePath { get; set; } // Internal use - path to saved package file
|
||||
|
||||
/// <summary>
|
||||
/// Optional time limit override in milliseconds (for testing purposes)
|
||||
/// </summary>
|
||||
public int? TimeLimitMs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional memory limit override in megabytes (for testing purposes)
|
||||
/// </summary>
|
||||
public int? MemoryLimitMb { get; set; }
|
||||
}
|
||||
|
||||
@@ -88,17 +88,6 @@ public class TestingService : ITestingService
|
||||
|
||||
_logger.LogInformation("Compilation successful");
|
||||
|
||||
// Check for limit overrides (for testing purposes)
|
||||
var timeLimitOverride = request.TimeLimitMs;
|
||||
var memoryLimitOverride = request.MemoryLimitMb;
|
||||
|
||||
if (timeLimitOverride.HasValue || memoryLimitOverride.HasValue)
|
||||
{
|
||||
_logger.LogInformation("Using limit overrides - TimeLimit: {TimeLimit}ms, MemoryLimit: {MemoryLimit}MB",
|
||||
timeLimitOverride?.ToString() ?? "default",
|
||||
memoryLimitOverride?.ToString() ?? "default");
|
||||
}
|
||||
|
||||
// Send testing status
|
||||
await SendStatusAsync(request, State.Testing, ErrorCode.None, "Running tests", 0, package.TestCases.Count);
|
||||
|
||||
@@ -111,16 +100,12 @@ public class TestingService : ITestingService
|
||||
await SendStatusAsync(request, State.Testing, ErrorCode.None,
|
||||
$"Running test {testCase.Number}", testCase.Number, package.TestCases.Count);
|
||||
|
||||
// Use override limits if provided, otherwise use test case limits
|
||||
var timeLimit = timeLimitOverride ?? testCase.TimeLimit;
|
||||
var memoryLimit = memoryLimitOverride ?? testCase.MemoryLimit;
|
||||
|
||||
// Execute solution
|
||||
var executionResult = await executionService.ExecuteAsync(
|
||||
compilationResult.ExecutablePath!,
|
||||
testCase.InputFilePath,
|
||||
timeLimit,
|
||||
memoryLimit);
|
||||
testCase.TimeLimit,
|
||||
testCase.MemoryLimit);
|
||||
|
||||
// Check for execution errors
|
||||
if (executionResult.TimeLimitExceeded)
|
||||
|
||||
Reference in New Issue
Block a user