@@ -3,7 +3,6 @@ package shell
33import (
44 "context"
55 "os"
6− "runtime"
76 "testing"
87 "time"
98
@@ -32,34 +31,6 @@ func TestShellPerformanceComparison(t *testing.T) {
3231 t.Logf("Quick command took: %v", duration)
3332}
3433
35−func TestShellCPUUsageComparison(t *testing.T) {
36− tmpDir, err := os.MkdirTemp("", "shell-test")
37− require.NoError(t, err)
38− defer os.RemoveAll(tmpDir)
39−
40− shell := GetPersistentShell(tmpDir)
41− defer shell.Close()
42−
43− // Measure CPU and memory usage during a longer command
44− var m1, m2 runtime.MemStats
45− runtime.GC()
46− runtime.ReadMemStats(&m1)
47−
48− start := time.Now()
49− _, stderr, exitCode, _, err := shell.Exec(context.Background(), "sleep 0.1", 1000)
50− duration := time.Since(start)
51−
52− runtime.ReadMemStats(&m2)
53−
54− require.NoError(t, err)
55− assert.Equal(t, 0, exitCode)
56− assert.Empty(t, stderr)
57−
58− memGrowth := m2.Alloc - m1.Alloc
59− t.Logf("Sleep 0.1s command took: %v", duration)
60− t.Logf("Memory growth during polling: %d bytes", memGrowth)
61− t.Logf("GC cycles during test: %d", m2.NumGC-m1.NumGC)
62−}
6334
6435// Benchmark CPU usage during polling
6536func BenchmarkShellPolling(b *testing.B) {