(t *testing.T, path string)
| 24 | ) |
| 25 | |
| 26 | func SetupDefaultConfig(t *testing.T, path string) { |
| 27 | c, err := apptainerconf.Parse("") |
| 28 | if err != nil { |
| 29 | t.Fatalf("while generating apptainer configuration: %s", err) |
| 30 | } |
| 31 | apptainerconf.SetCurrentConfig(c) |
| 32 | apptainerconf.SetBinaryPath(buildcfg.LIBEXECDIR, true) |
| 33 | |
| 34 | c.AllowSetuidMountExtfs = true |
| 35 | |
| 36 | Privileged(func(t *testing.T) { |
| 37 | f, err := os.Create(path) |
| 38 | if err != nil { |
| 39 | t.Fatalf("while creating apptainer configuration: %s", err) |
| 40 | } |
| 41 | |
| 42 | if err := apptainerconf.Generate(f, "", c); err != nil { |
| 43 | t.Fatalf("while generating apptainer configuration: %s", err) |
| 44 | } |
| 45 | |
| 46 | f.Close() |
| 47 | |
| 48 | if err := unix.Mount(path, buildcfg.APPTAINER_CONF_FILE, "", unix.MS_BIND, ""); err != nil { |
| 49 | t.Fatalf("while mounting %s to %s: %s", path, buildcfg.APPTAINER_CONF_FILE, err) |
| 50 | } |
| 51 | })(t) |
| 52 | } |
| 53 | |
| 54 | func SetDirective(t *testing.T, env TestEnv, directive, value string) { |
| 55 | env.RunApptainer( |
no test coverage detected