mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-06 21:11:50 +08:00
fix: cap ARTEX container and tool resource use
This commit is contained in:
1 parent
253a8eeac3
commit
ea4377ef9a
36 files changed
+1869
-64
No files matched your search
@@ -8,6 +8,9 @@ import (
|
||||
)
|
||||
|
||||
func TestSystemMetricsReturnsContainerAndDiskValues(t *testing.T) {
|
||||
t.Setenv("ARTEX_TOOL_MEMORY_LIMIT_MB", "96")
|
||||
t.Setenv("ARTEX_TOOL_TIMEOUT_S", "72")
|
||||
t.Setenv("ARTEX_TOOL_PIDS_LIMIT", "48")
|
||||
s := &Server{dataDir: t.TempDir()}
|
||||
r := httptest.NewRequest("GET", "/api/system/metrics", nil)
|
||||
w := httptest.NewRecorder()
|
||||
@@ -22,6 +25,9 @@ func TestSystemMetricsReturnsContainerAndDiskValues(t *testing.T) {
|
||||
if got.Scope == "" || got.Timestamp.IsZero() {
|
||||
t.Fatalf("unexpected response metadata: %+v", got)
|
||||
}
|
||||
if got.Limits.ToolMemoryLimitMB != 96 || got.Limits.ToolTimeoutSeconds != 72 || got.Limits.ToolPidsLimit != 48 {
|
||||
t.Fatalf("configured tool limits missing: %+v", got.Limits)
|
||||
}
|
||||
if runtime.GOOS != "linux" {
|
||||
if got.Supported || got.Scope != "unsupported" {
|
||||
t.Fatalf("unsupported platform returned metrics: %+v", got)
|
||||
|
||||
Reference in new issue
Block a user