@@ -100,24 +100,56 @@ describe("withNodeSelector", () => {
100100} ) ;
101101
102102describe ( "withRunnerSeccompProfile" , ( ) => {
103- it ( "applies the profile for every runtime, preserving pod security defaults" , ( ) => {
104- const podSpec = withRunnerSeccompProfile ( basePodSpec , "profiles/example.json" ) ;
103+ const base = {
104+ profilePath : "profiles/example.json" ,
105+ runtimes : "node-24-plus" as const ,
106+ runtime : "node-24" ,
107+ checkpointsEnabled : true ,
108+ } ;
109+
110+ const withProfile = {
111+ ...basePodSpec ,
112+ securityContext : {
113+ ...basePodSpec . securityContext ,
114+ seccompProfile : { type : "Localhost" , localhostProfile : "profiles/example.json" } ,
115+ } ,
116+ } ;
117+
118+ it ( "applies the profile to node-24 and above under the default scope" , ( ) => {
119+ for ( const runtime of [ "node-24" , "node-26" , "node-30" , "experimental-node-24" ] ) {
120+ expect ( withRunnerSeccompProfile ( basePodSpec , { ...base , runtime } ) ) . toMatchObject (
121+ withProfile
122+ ) ;
123+ }
124+ } ) ;
105125
106- expect ( podSpec ) . toMatchObject ( {
107- ...basePodSpec ,
108- securityContext : {
109- ...basePodSpec . securityContext ,
110- seccompProfile : {
111- type : "Localhost" ,
112- localhostProfile : "profiles/example.json" ,
113- } ,
114- } ,
115- } ) ;
126+ it ( "skips older runtimes under the default scope" , ( ) => {
127+ for ( const runtime of [ "node" , "node-22" , "bun" , undefined , null , "" ] ) {
128+ expect ( withRunnerSeccompProfile ( basePodSpec , { ...base , runtime } ) ) . toBe ( basePodSpec ) ;
129+ }
130+ } ) ;
131+
132+ it ( "applies the profile to every runtime under the all scope" , ( ) => {
133+ for ( const runtime of [ "node" , "node-22" , "bun" , "node-24" , undefined ] ) {
134+ expect (
135+ withRunnerSeccompProfile ( basePodSpec , { ...base , runtimes : "all" , runtime } )
136+ ) . toMatchObject ( withProfile ) ;
137+ }
138+ } ) ;
139+
140+ it ( "applies nothing under the none scope, whatever the runtime" , ( ) => {
141+ for ( const runtime of [ "node-24" , "bun" , "node-22" ] ) {
142+ expect ( withRunnerSeccompProfile ( basePodSpec , { ...base , runtimes : "none" , runtime } ) ) . toBe (
143+ basePodSpec
144+ ) ;
145+ }
116146 } ) ;
117147
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 ) ;
148+ it ( "applies nothing when checkpoints are disabled" , ( ) => {
149+ for ( const runtimes of [ "none" , "node-24-plus" , "all" ] as const ) {
150+ expect (
151+ withRunnerSeccompProfile ( basePodSpec , { ...base , runtimes, checkpointsEnabled : false } )
152+ ) . toBe ( basePodSpec ) ;
121153 }
122154 } ) ;
123155} ) ;
0 commit comments