(t *testing.T)
| 187 | } |
| 188 | |
| 189 | func 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. |
| 208 | func procEnv(t *testing.T, pid int) []string { |