mirror of
https://github.com/henrygd/beszel.git
synced 2025-12-17 02:36:17 +01:00
expand container monitoring functionality (#928)
- Add new /containers route with virtualized table showing all containers across systems - Implement container stats collection (CPU, memory, network usage) with health status tracking - Add container logs and info API endpoints with syntax highlighting using Shiki - Create detailed container views with fullscreen logs/info dialogs and refresh functionality - Add container table to individual system pages with lazy loading - Implement container record storage with automatic cleanup and historical averaging - Update navbar with container navigation icon - Extract reusable ActiveAlerts component from home page - Add FooterRepoLink component for consistent GitHub/version display - Enhance filtering and search capabilities across container tables
This commit is contained in:
@@ -858,6 +858,54 @@ func TestDeltaTrackerCacheTimeIsolation(t *testing.T) {
|
||||
assert.Equal(t, uint64(200000), recvTracker2.Delta(ctr.IdShort))
|
||||
}
|
||||
|
||||
func TestParseDockerStatus(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
input string
|
||||
expectedStatus string
|
||||
expectedHealth container.DockerHealth
|
||||
}{
|
||||
{
|
||||
name: "status with About an removed",
|
||||
input: "Up About an hour (healthy)",
|
||||
expectedStatus: "Up an hour",
|
||||
expectedHealth: container.DockerHealthHealthy,
|
||||
},
|
||||
{
|
||||
name: "status without About an unchanged",
|
||||
input: "Up 2 hours (healthy)",
|
||||
expectedStatus: "Up 2 hours",
|
||||
expectedHealth: container.DockerHealthHealthy,
|
||||
},
|
||||
{
|
||||
name: "status with About and no parentheses",
|
||||
input: "Up About an hour",
|
||||
expectedStatus: "Up an hour",
|
||||
expectedHealth: container.DockerHealthNone,
|
||||
},
|
||||
{
|
||||
name: "status without parentheses",
|
||||
input: "Created",
|
||||
expectedStatus: "Created",
|
||||
expectedHealth: container.DockerHealthNone,
|
||||
},
|
||||
{
|
||||
name: "empty status",
|
||||
input: "",
|
||||
expectedStatus: "",
|
||||
expectedHealth: container.DockerHealthNone,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
status, health := parseDockerStatus(tt.input)
|
||||
assert.Equal(t, tt.expectedStatus, status)
|
||||
assert.Equal(t, tt.expectedHealth, health)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestConstantsAndUtilityFunctions(t *testing.T) {
|
||||
// Test constants are properly defined
|
||||
assert.Equal(t, uint16(60000), defaultCacheTimeMs)
|
||||
|
||||
Reference in New Issue
Block a user