forked from runabol/tork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
task_test.go
39 lines (35 loc) · 827 Bytes
/
task_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
package tork_test
import (
"testing"
"github.com/runabol/tork"
"github.com/stretchr/testify/assert"
)
func TestCloneTask(t *testing.T) {
t1 := &tork.Task{
Env: map[string]string{
"VAR1": "VAL1",
},
Limits: &tork.TaskLimits{
CPUs: "1",
},
Parallel: &tork.ParallelTask{
Tasks: []*tork.Task{
{
Env: map[string]string{
"PVAR1": "PVAL1",
},
},
},
},
}
t2 := t1.Clone()
assert.Equal(t, t1.Env, t2.Env)
assert.Equal(t, t1.Limits.CPUs, t2.Limits.CPUs)
assert.Equal(t, t1.Parallel.Tasks[0].Env, t2.Parallel.Tasks[0].Env)
t2.Env["VAR2"] = "VAL2"
t2.Limits.CPUs = "2"
t2.Parallel.Tasks[0].Env["PVAR2"] = "PVAL2"
assert.NotEqual(t, t1.Env, t2.Env)
assert.NotEqual(t, t1.Limits.CPUs, t2.Limits.CPUs)
assert.NotEqual(t, t1.Parallel.Tasks[0].Env, t2.Parallel.Tasks[0].Env)
}