(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func 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 | } |
nothing calls this directly
no test coverage detected