Skip to content

Commit b7a117b

Browse files
committed
Fix fuzz integration tests
Fuzz integration tests on Github Action panics because it cannot find the containerd PATH. ``` failed to start daemon: failed to start daemon: exec: "containerd": executable file not found in $PATH: panic: fatal [recovered] panic: fatal ``` It's because in Action the `OUT` env var (/github/workspace/build-out) is different compared to oss-fuzz. Signed-off-by: Jin Dong <[email protected]>
1 parent 202f2a1 commit b7a117b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

integration/client/container_fuzz_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,21 @@ func updatePathEnv() error {
223223

224224
oldPathEnv := os.Getenv("PATH")
225225
newPathEnv := oldPathEnv + ":" + fuzzBinDir
226+
227+
if ghWorkspace := os.Getenv("GITHUB_WORKSPACE"); ghWorkspace != "" {
228+
// In `oss_fuzz_build.sh`, we build and install containerd binaries to
229+
// `$OUT/containerd-binaries`, where `OUT=/out` in oss-fuzz environment.
230+
// However in GitHub Actions, oss-fuzz maps `OUT` to `$GITHUB_WORKSPACE/build-out`.
231+
// So here we add this to `$PATH` at the end of `PATH` so the fuzz works on
232+
// both environments.
233+
newPathEnv = newPathEnv + ":" + filepath.Join(ghWorkspace, "build-out", "containerd-binaries")
234+
}
235+
226236
err = os.Setenv("PATH", newPathEnv)
227237
if err != nil {
228238
return err
229239
}
240+
230241
haveChangedOSSFuzzPATH = true
231242
return nil
232243
}

0 commit comments

Comments
 (0)