Refactor the multi-host salt install page.
[arvados.git] / services / crunch-dispatch-slurm / script_test.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 package dispatchslurm
6
7 import (
8         . "gopkg.in/check.v1"
9 )
10
11 var _ = Suite(&ScriptSuite{})
12
13 type ScriptSuite struct{}
14
15 func (s *ScriptSuite) TestExecScript(c *C) {
16         for _, test := range []struct {
17                 args   []string
18                 script string
19         }{
20                 {nil, `exec`},
21                 {[]string{`foo`}, `exec 'foo'`},
22                 {[]string{`foo`, `bar baz`}, `exec 'foo' 'bar baz'`},
23                 {[]string{`foo"`, "'waz 'qux\n"}, `exec 'foo"' ''\''waz '\''qux` + "\n" + `'`},
24         } {
25                 c.Logf("%+v -> %+v", test.args, test.script)
26                 c.Check(execScript(test.args), Equals, "#!/bin/sh\n"+test.script+"\n")
27         }
28 }