forked from travis-ci/worker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
step_open_log_writer_test.go
51 lines (42 loc) · 974 Bytes
/
step_open_log_writer_test.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
49
50
51
package worker
import (
"testing"
gocontext "context"
"github.com/mitchellh/multistep"
"github.com/stretchr/testify/assert"
)
func setupStepOpenLogWriter() (*stepOpenLogWriter, multistep.StateBag) {
s := &stepOpenLogWriter{}
ctx := gocontext.TODO()
job := &fakeJob{
payload: &JobPayload{
Type: "job:test",
Job: JobJobPayload{
ID: 2,
Number: "3.1",
},
Build: BuildPayload{
ID: 1,
Number: "3",
},
Repository: RepositoryPayload{
ID: 4,
Slug: "green-eggs/ham",
},
UUID: "foo-bar",
Config: map[string]interface{}{},
Timeouts: TimeoutsPayload{},
},
}
state := &multistep.BasicStateBag{}
state.Put("ctx", ctx)
state.Put("procCtx", ctx)
state.Put("buildJob", job)
return s, state
}
func TestStepOpenLogWriter_Run(t *testing.T) {
s, state := setupStepOpenLogWriter()
action := s.Run(state)
assert.Equal(t, multistep.ActionContinue, action)
assert.NotNil(t, state.Get("logWriter"))
}