MCPcopy
hub / github.com/apptainer/apptainer / SetupDefaultConfig

Function SetupDefaultConfig

e2e/internal/e2e/config.go:26–52  ·  view source on GitHub ↗
(t *testing.T, path string)

Source from the content-addressed store, hash-verified

24)
25
26func 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
54func SetDirective(t *testing.T, env TestEnv, directive, value string) {
55 env.RunApptainer(

Callers 1

RunFunction · 0.92

Calls 8

ParseFunction · 0.92
SetCurrentConfigFunction · 0.92
SetBinaryPathFunction · 0.92
GenerateFunction · 0.92
PrivilegedFunction · 0.85
CreateMethod · 0.65
MountMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected