|
1 | 1 | import { describe, expect, it } from "vitest"; |
2 | 2 | import { |
3 | | - BLOCK_IO_URING_SECCOMP_PROFILE, |
4 | 3 | nodetypeNodeSelector, |
5 | 4 | runPodTolerations, |
6 | | - withBlockIoUringSeccompProfile, |
| 5 | + withRunnerSeccompProfile, |
7 | 6 | withNodeSelector, |
8 | 7 | } from "./kubernetesPodSpec.js"; |
9 | 8 |
|
@@ -100,27 +99,25 @@ describe("withNodeSelector", () => { |
100 | 99 | }); |
101 | 100 | }); |
102 | 101 |
|
103 | | -describe("withBlockIoUringSeccompProfile", () => { |
104 | | - it("adds the Localhost io_uring profile for node-24 and above, preserving pod security defaults", () => { |
105 | | - for (const runtime of ["node-24", "node-26", "node-30", "experimental-node-24"]) { |
106 | | - const podSpec = withBlockIoUringSeccompProfile(basePodSpec, runtime); |
107 | | - |
108 | | - expect(podSpec).toMatchObject({ |
109 | | - ...basePodSpec, |
110 | | - securityContext: { |
111 | | - ...basePodSpec.securityContext, |
112 | | - seccompProfile: { |
113 | | - type: "Localhost", |
114 | | - localhostProfile: BLOCK_IO_URING_SECCOMP_PROFILE, |
115 | | - }, |
| 102 | +describe("withRunnerSeccompProfile", () => { |
| 103 | + it("applies the profile for every runtime, preserving pod security defaults", () => { |
| 104 | + const podSpec = withRunnerSeccompProfile(basePodSpec, "profiles/example.json"); |
| 105 | + |
| 106 | + expect(podSpec).toMatchObject({ |
| 107 | + ...basePodSpec, |
| 108 | + securityContext: { |
| 109 | + ...basePodSpec.securityContext, |
| 110 | + seccompProfile: { |
| 111 | + type: "Localhost", |
| 112 | + localhostProfile: "profiles/example.json", |
116 | 113 | }, |
117 | | - }); |
118 | | - } |
| 114 | + }, |
| 115 | + }); |
119 | 116 | }); |
120 | 117 |
|
121 | | - it("leaves the pod spec unchanged for runtimes that do not create io_uring fds", () => { |
122 | | - for (const runtime of ["node", "node-22", "bun", undefined, null, ""]) { |
123 | | - expect(withBlockIoUringSeccompProfile(basePodSpec, runtime)).toEqual(basePodSpec); |
| 118 | + it("leaves the pod spec untouched when no profile is configured", () => { |
| 119 | + for (const profilePath of [undefined, ""]) { |
| 120 | + expect(withRunnerSeccompProfile(basePodSpec, profilePath)).toBe(basePodSpec); |
124 | 121 | } |
125 | 122 | }); |
126 | 123 | }); |
0 commit comments