MCPcopy Index your code
hub / github.com/coder/coder / expectedOOMScore

Function expectedOOMScore

agent/agentexec/cli_linux_test.go:189–205  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

187}
188
189func expectedOOMScore(t *testing.T) int {
190 t.Helper()
191
192 score, err := os.ReadFile(fmt.Sprintf("/proc/%d/oom_score_adj", os.Getpid()))
193 require.NoError(t, err)
194
195 scoreInt, err := strconv.Atoi(strings.TrimSpace(string(score)))
196 require.NoError(t, err)
197
198 if scoreInt < 0 {
199 return 0
200 }
201 if scoreInt >= 998 {
202 return 1000
203 }
204 return 998
205}
206
207// procEnv returns the environment variables for a given process.
208func procEnv(t *testing.T, pid int) []string {

Callers 1

TestCLIFunction · 0.85

Calls 2

HelperMethod · 0.65
ReadFileMethod · 0.65

Tested by

no test coverage detected