feat: add DockerRuntimeOrchestrator with docker-java
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package net.siegeln.cameleer.saas.runtime;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class DockerRuntimeOrchestratorTest {
|
||||
|
||||
@Test
|
||||
void runtimeConfig_parseMemoryLimitBytes_megabytes() {
|
||||
assertEquals(512 * 1024 * 1024L, parseMemoryLimit("512m"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runtimeConfig_parseMemoryLimitBytes_gigabytes() {
|
||||
assertEquals(1024L * 1024 * 1024, parseMemoryLimit("1g"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runtimeConfig_parseMemoryLimitBytes_bytes() {
|
||||
assertEquals(536870912L, parseMemoryLimit("536870912"));
|
||||
}
|
||||
|
||||
private long parseMemoryLimit(String limit) {
|
||||
var l = limit.trim().toLowerCase();
|
||||
if (l.endsWith("g")) {
|
||||
return Long.parseLong(l.substring(0, l.length() - 1)) * 1024 * 1024 * 1024;
|
||||
} else if (l.endsWith("m")) {
|
||||
return Long.parseLong(l.substring(0, l.length() - 1)) * 1024 * 1024;
|
||||
}
|
||||
return Long.parseLong(l);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user