1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
13 var _ = Suite(&singularitySuite{})
15 type singularitySuite struct {
19 func (s *singularitySuite) SetUpSuite(c *C) {
20 _, err := exec.LookPath("singularity")
22 c.Skip("looks like singularity is not installed")
24 s.newExecutor = func(c *C) {
26 s.executor, err = newSingularityExecutor(c.Logf)
31 var _ = Suite(&singularityStubSuite{})
33 // singularityStubSuite tests don't really invoke singularity, so we
34 // can run them even if singularity is not installed.
35 type singularityStubSuite struct{}
37 func (s *singularityStubSuite) TestSingularityExecArgs(c *C) {
38 e, err := newSingularityExecutor(c.Logf)
40 err = e.Create(containerSpec{
41 WorkingDir: "/WorkingDir",
42 Env: map[string]string{"FOO": "bar"},
43 BindMounts: map[string]bindmount{"/mnt": {HostPath: "/hostpath", ReadOnly: true}},
48 e.imageFilename = "/fake/image.sif"
49 cmd := e.execCmd("./singularity")
50 c.Check(cmd.Args, DeepEquals, []string{"./singularity", "exec", "--containall", "--cleanenv", "--pwd", "/WorkingDir", "--net", "--network=none", "--nv", "--bind", "/hostpath:/mnt:ro", "/fake/image.sif"})
51 c.Check(cmd.Env, DeepEquals, []string{"SINGULARITYENV_FOO=bar"})