@@ -35,6 +35,11 @@ def test_list_tasks(self):
35
35
self .assertIn ("no_lifecycle_task" , self .conf .task_names )
36
36
self .assertIn ("resmoke_task" , self .conf .task_names )
37
37
38
+ def test_list_task_groups (self ):
39
+ self .assertEqual (1 , len (self .conf .task_groups ))
40
+ self .assertEqual (1 , len (self .conf .task_group_names ))
41
+ self .assertIn ("tg_1" , self .conf .task_group_names )
42
+
38
43
def test_list_lifecycle_task_names (self ):
39
44
self .assertEqual (5 , len (self .conf .lifecycle_task_names ))
40
45
self .assertIn ("compile" , self .conf .task_names )
@@ -44,11 +49,12 @@ def test_list_lifecycle_task_names(self):
44
49
self .assertIn ("resmoke_task" , self .conf .task_names )
45
50
46
51
def test_list_variants (self ):
47
- self .assertEqual (3 , len (self .conf .variants ))
48
- self .assertEqual (3 , len (self .conf .variant_names ))
52
+ self .assertEqual (4 , len (self .conf .variants ))
53
+ self .assertEqual (4 , len (self .conf .variant_names ))
49
54
self .assertIn ("osx-108" , self .conf .variant_names )
50
55
self .assertIn ("ubuntu" , self .conf .variant_names )
51
56
self .assertIn ("debian" , self .conf .variant_names )
57
+ self .assertIn ("amazon" , self .conf .variant_names )
52
58
53
59
def test_get_variant (self ):
54
60
variant = self .conf .get_variant ("osx-108" )
@@ -57,11 +63,12 @@ def test_get_variant(self):
57
63
self .assertEqual ("osx-108" , variant .name )
58
64
59
65
def test_list_distro_names (self ):
60
- self .assertEqual (4 , len (self .conf .distro_names ))
66
+ self .assertEqual (5 , len (self .conf .distro_names ))
61
67
self .assertIn ("localtestdistro" , self .conf .distro_names )
62
68
self .assertIn ("ubuntu1404-test" , self .conf .distro_names )
63
69
self .assertIn ("pdp-11" , self .conf .distro_names )
64
70
self .assertIn ("debian-stretch" , self .conf .distro_names )
71
+ self .assertIn ("amazon" , self .conf .distro_names )
65
72
66
73
67
74
class TestTask (unittest .TestCase ):
@@ -95,6 +102,34 @@ def test_resmoke_args(self):
95
102
self .assertEqual ("core" , task .resmoke_suite )
96
103
97
104
105
+ class TestTaskGroup (unittest .TestCase ):
106
+ """Unit tests for the TaskGroup class."""
107
+
108
+ def test_from_list (self ):
109
+ task_group_dict = {
110
+ "name" : "my_group" , "max_hosts" : 3 , "tasks" : ["task1" , "task2" ], "setup_task" : [],
111
+ "teardown_task" : [], "setup_group" : [], "teardown_group" : [], "timeout" : []
112
+ }
113
+ task_group = _evergreen .TaskGroup (task_group_dict )
114
+
115
+ self .assertEqual ("my_group" , task_group .name )
116
+ self .assertEqual (2 , len (task_group .tasks ))
117
+ self .assertEqual (task_group_dict , task_group .raw )
118
+
119
+ def test_resmoke_args (self ):
120
+ task_dict = {
121
+ "name" :
122
+ "jsCore" , "commands" : [{
123
+ "func" : "run tests" ,
124
+ "vars" : {"resmoke_args" : "--suites=core --shellWriteMode=commands" }
125
+ }]
126
+ }
127
+ task = _evergreen .Task (task_dict )
128
+
129
+ self .assertEqual ("--suites=core --shellWriteMode=commands" , task .resmoke_args )
130
+ self .assertEqual ("core" , task .resmoke_suite )
131
+
132
+
98
133
class TestVariant (unittest .TestCase ):
99
134
"""Unit tests for the Variant class."""
100
135
@@ -105,13 +140,14 @@ def setUpClass(cls):
105
140
def test_from_dict (self ):
106
141
task = _evergreen .Task ({"name" : "compile" })
107
142
tasks_map = {task .name : task }
143
+ task_groups_map = {}
108
144
variant_dict = {
109
145
"name" : "ubuntu" ,
110
146
"display_name" : "Ubuntu" ,
111
147
"run_on" : ["ubuntu1404-test" ],
112
148
"tasks" : [{"name" : "compile" }],
113
149
}
114
- variant = _evergreen .Variant (variant_dict , tasks_map )
150
+ variant = _evergreen .Variant (variant_dict , tasks_map , task_groups_map )
115
151
116
152
self .assertEqual ("ubuntu" , variant .name )
117
153
self .assertEqual ("Ubuntu" , variant .display_name )
@@ -194,3 +230,8 @@ def test_variant_tasks(self):
194
230
resmoke_task = variant_debian .get_task ("resmoke_task" )
195
231
self .assertEqual ("--suites=somesuite --storageEngine=mmapv1" ,
196
232
resmoke_task .combined_resmoke_args )
233
+
234
+ # Check for tasks included in task_groups
235
+ variant_amazon = self .conf .get_variant ("amazon" )
236
+ self .assertEqual (3 , len (variant_amazon .tasks ))
237
+ self .assertIn ("compile" , variant_amazon .task_names )
0 commit comments