/
runner.go
43 lines (38 loc) · 1.15 KB
/
runner.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package testrunner
import (
"os/exec"
"strconv"
"time"
ginkgomon "github.com/tedsuo/ifrit/ginkgomon_v2"
)
type Args struct {
Address string
HostKey string
AuthorizedKey string
AllowedCiphers string
AllowedMACs string
AllowedKeyExchanges string
AllowUnauthenticatedClients bool
InheritDaemonEnv bool
}
func (args Args) ArgSlice() []string {
return []string{
"-address=" + args.Address,
"-hostKey=" + args.HostKey,
"-authorizedKey=" + args.AuthorizedKey,
"-allowedCiphers=" + args.AllowedCiphers,
"-allowedMACs=" + args.AllowedMACs,
"-allowedKeyExchanges=" + args.AllowedKeyExchanges,
"-allowUnauthenticatedClients=" + strconv.FormatBool(args.AllowUnauthenticatedClients),
"-inheritDaemonEnv=" + strconv.FormatBool(args.InheritDaemonEnv),
}
}
func New(binPath string, args Args) *ginkgomon.Runner {
return ginkgomon.New(ginkgomon.Config{
Name: "sshd",
AnsiColorCode: "1;96m",
StartCheck: "sshd.started",
StartCheckTimeout: 10 * time.Second,
Command: exec.Command(binPath, args.ArgSlice()...),
})
}