@@ -58,6 +58,10 @@ var sidecarEnvTests = [...]string{
5858 "sidecar_env/volumes_from" ,
5959}
6060
61+ var taskPidModeTests = [... ]string {
62+ "task_pid_mode/command" ,
63+ }
64+
6165const defaultConfig = `
6266build {
6367 entry_point: ["/kilt/run", "--", ${?original.metadata.captured_tag}]
@@ -112,6 +116,25 @@ build {
112116}
113117`
114118
119+ const taskPidModeConfig = `
120+ build {
121+ entry_point: ["/kilt/run", "--", ${?original.metadata.captured_tag}]
122+ command: [] ${?original.entry_point} ${?original.command}
123+ mount: [
124+ {
125+ name: "KiltImage"
126+ image: "KILT:latest"
127+ volumes: ["/kilt"]
128+ entry_point: ["/kilt/wait"]
129+ }
130+ ]
131+ capabilities: ["SYS_PTRACE"]
132+ }
133+ task {
134+ pid_mode: "task"
135+ }
136+ `
137+
115138func runTest (t * testing.T , name string , context context.Context , config Configuration ) {
116139 fragment , err := ioutil .ReadFile ("fixtures/" + name + ".json" )
117140 if err != nil {
@@ -197,6 +220,22 @@ func TestPatchingSidecarEnv(t *testing.T) {
197220 }
198221}
199222
223+ func TestPatchingTask (t * testing.T ) {
224+ l := log .Output (zerolog.ConsoleWriter {Out : os .Stderr }).With ().Caller ().Logger ()
225+
226+ for _ , testName := range taskPidModeTests {
227+ t .Run (testName , func (t * testing.T ) {
228+ runTest (t , testName , l .WithContext (context .Background ()),
229+ Configuration {
230+ Kilt : taskPidModeConfig ,
231+ OptIn : false ,
232+ RecipeConfig : "{}" ,
233+ UseRepositoryHints : false ,
234+ })
235+ })
236+ }
237+ }
238+
200239func TestPatchingForParameterizingEnvars (t * testing.T ) {
201240 l := log .Output (zerolog.ConsoleWriter {Out : os .Stderr }).With ().Caller ().Logger ()
202241
0 commit comments