forked from cloudfoundry-attic/bosh-init
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_server.go
48 lines (39 loc) · 929 Bytes
/
fake_server.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
44
45
46
47
48
package fakes
type FakeServer struct {
StartInput StartInput
readyChErr error
startErr error
stopErr error
ReceivedActions []string
}
type StartInput struct {
Username string
Password string
Host string
Port int
}
func NewFakeServer() *FakeServer {
return &FakeServer{
ReceivedActions: []string{},
StartInput: StartInput{},
}
}
func (s *FakeServer) Start(username string, password string, host string, port int, readyErrCh chan error) error {
s.StartInput = StartInput{
Username: username,
Password: password,
Host: host,
Port: port,
}
s.ReceivedActions = append(s.ReceivedActions, "Start")
readyErrCh <- s.readyChErr
return s.startErr
}
func (s *FakeServer) Stop() error {
s.ReceivedActions = append(s.ReceivedActions, "Stop")
return s.stopErr
}
func (s *FakeServer) SetStartBehavior(readyChErr, startErr error) {
s.readyChErr = readyChErr
s.startErr = startErr
}