MCPcopy Index your code
hub / github.com/coder/envbox / TestSetOOMScore

Function TestSetOOMScore

xunix/proc_test.go:15–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestSetOOMScore(t *testing.T) {
16 t.Parallel()
17
18 t.Run("OK", func(t *testing.T) {
19 t.Parallel()
20
21 var (
22 fs = &xunixfake.MemFS{MemMapFs: &afero.MemMapFs{}}
23 ctx = xunix.WithFS(context.Background(), fs)
24 )
25
26 const (
27 pid = "123"
28 score = "-1000"
29 )
30
31 err := xunix.SetOOMScore(ctx, pid, score)
32 require.NoError(t, err)
33
34 actualScore, err := afero.ReadFile(fs, fmt.Sprintf("/proc/%s/oom_score_adj", pid))
35 require.NoError(t, err)
36 require.Equal(t, score, string(actualScore))
37 })
38}

Callers

nothing calls this directly

Calls 3

WithFSFunction · 0.92
SetOOMScoreFunction · 0.92
RunMethod · 0.45

Tested by

no test coverage detected