langfun 0.1.2.dev202510270805__py3-none-any.whl → 0.1.2.dev202510290805__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of langfun might be problematic. Click here for more details.
- langfun/core/__init__.py +1 -0
- langfun/core/data/conversion/anthropic.py +2 -0
- langfun/core/mcp/client_test.py +8 -35
- langfun/core/mcp/session.py +4 -19
- langfun/core/mcp/session_test.py +54 -0
- langfun/core/mcp/tool.py +81 -10
- langfun/core/mcp/tool_test.py +197 -0
- langfun/core/message.py +7 -0
- langfun/env/base_environment.py +247 -105
- langfun/env/base_feature.py +15 -0
- langfun/env/base_sandbox.py +6 -1
- langfun/env/base_test.py +807 -587
- langfun/env/event_handlers/event_logger_test.py +2 -2
- langfun/env/event_handlers/metric_writer.py +49 -0
- langfun/env/event_handlers/metric_writer_test.py +19 -2
- langfun/env/interface.py +85 -9
- langfun/env/interface_test.py +3 -2
- langfun/env/load_balancers_test.py +2 -0
- langfun/env/test_utils.py +4 -1
- {langfun-0.1.2.dev202510270805.dist-info → langfun-0.1.2.dev202510290805.dist-info}/METADATA +1 -1
- {langfun-0.1.2.dev202510270805.dist-info → langfun-0.1.2.dev202510290805.dist-info}/RECORD +24 -22
- {langfun-0.1.2.dev202510270805.dist-info → langfun-0.1.2.dev202510290805.dist-info}/WHEEL +0 -0
- {langfun-0.1.2.dev202510270805.dist-info → langfun-0.1.2.dev202510290805.dist-info}/licenses/LICENSE +0 -0
- {langfun-0.1.2.dev202510270805.dist-info → langfun-0.1.2.dev202510290805.dist-info}/top_level.txt +0 -0
langfun/env/base_test.py
CHANGED
|
@@ -31,6 +31,7 @@ class EnvironmentTests(unittest.TestCase):
|
|
|
31
31
|
|
|
32
32
|
def test_basics(self):
|
|
33
33
|
env = TestingEnvironment(
|
|
34
|
+
image_ids=['test_image'],
|
|
34
35
|
root_dir='/tmp',
|
|
35
36
|
pool_size=0,
|
|
36
37
|
features={'test_feature': TestingFeature()},
|
|
@@ -38,11 +39,13 @@ class EnvironmentTests(unittest.TestCase):
|
|
|
38
39
|
outage_retry_interval=0,
|
|
39
40
|
)
|
|
40
41
|
self.assertIsNone(interface.Environment.current())
|
|
42
|
+
self.assertEqual(env.image_ids, ['test_image'])
|
|
43
|
+
self.assertFalse(env.supports_dynamic_image_loading)
|
|
41
44
|
self.assertEqual(env.status, interface.Environment.Status.CREATED)
|
|
42
45
|
self.assertFalse(env.is_online)
|
|
43
|
-
self.assertEqual(env.min_pool_size, 0)
|
|
44
|
-
self.assertEqual(env.max_pool_size, 0)
|
|
45
|
-
self.assertEqual(env.sandbox_pool,
|
|
46
|
+
self.assertEqual(env.min_pool_size('test_image'), 0)
|
|
47
|
+
self.assertEqual(env.max_pool_size('test_image'), 0)
|
|
48
|
+
self.assertEqual(env.sandbox_pool, {})
|
|
46
49
|
self.assertEqual(env.id, interface.Environment.Id('testing-env'))
|
|
47
50
|
self.assertEqual(env.outage_grace_period, 1)
|
|
48
51
|
self.assertEqual(env.features['test_feature'].name, 'test_feature')
|
|
@@ -55,29 +58,211 @@ class EnvironmentTests(unittest.TestCase):
|
|
|
55
58
|
self.assertTrue(env.is_online)
|
|
56
59
|
self.assertIsNotNone(env.start_time)
|
|
57
60
|
self.assertEqual(env.offline_duration, 0.0)
|
|
58
|
-
self.assertEqual(env.sandbox_pool,
|
|
61
|
+
self.assertEqual(env.sandbox_pool, {})
|
|
59
62
|
self.assertEqual(env.working_dir, '/tmp/testing-env')
|
|
60
63
|
|
|
61
|
-
with env.sandbox('session1') as sb:
|
|
64
|
+
with env.sandbox(session_id='session1') as sb:
|
|
62
65
|
self.assertEqual(
|
|
63
|
-
sb.id, interface.Sandbox.Id(
|
|
66
|
+
sb.id, interface.Sandbox.Id(
|
|
67
|
+
environment_id=env.id,
|
|
68
|
+
image_id=sb.image_id,
|
|
69
|
+
sandbox_id='0')
|
|
64
70
|
)
|
|
65
71
|
self.assertEqual(sb.session_id, 'session1')
|
|
66
|
-
self.assertEqual(sb.working_dir, '/tmp/testing-env/0')
|
|
72
|
+
self.assertEqual(sb.working_dir, '/tmp/testing-env/test_image/0')
|
|
67
73
|
self.assertTrue(sb.is_online)
|
|
68
74
|
self.assertIs(sb.test_feature, sb.features['test_feature'])
|
|
69
75
|
self.assertEqual(
|
|
70
76
|
sb.test_feature.working_dir,
|
|
71
|
-
'/tmp/testing-env/0/test_feature'
|
|
77
|
+
'/tmp/testing-env/test_image/0/test_feature'
|
|
72
78
|
)
|
|
73
79
|
with self.assertRaises(AttributeError):
|
|
74
80
|
_ = sb.test_feature2
|
|
75
81
|
self.assertFalse(sb.is_online)
|
|
76
82
|
|
|
77
|
-
self.
|
|
83
|
+
with self.assertRaisesRegex(
|
|
84
|
+
ValueError, 'Environment .* does not serve image ID .*'
|
|
85
|
+
):
|
|
86
|
+
env.sandbox('test_image2')
|
|
87
|
+
|
|
88
|
+
with env.test_feature() as feature:
|
|
89
|
+
self.assertIsInstance(feature, TestingFeature)
|
|
90
|
+
self.assertEqual(
|
|
91
|
+
feature.sandbox.status, interface.Sandbox.Status.IN_SESSION
|
|
92
|
+
)
|
|
93
|
+
self.assertTrue(
|
|
94
|
+
feature.sandbox.session_id.startswith('test_feature-session')
|
|
95
|
+
)
|
|
96
|
+
|
|
78
97
|
with self.assertRaises(AttributeError):
|
|
79
98
|
_ = env.test_feature2
|
|
80
99
|
|
|
100
|
+
def test_dynamic_image_loading(self):
|
|
101
|
+
env = TestingEnvironment(
|
|
102
|
+
image_ids=[],
|
|
103
|
+
supports_dynamic_image_loading=True,
|
|
104
|
+
pool_size=0,
|
|
105
|
+
features={'test_feature': TestingFeature()},
|
|
106
|
+
outage_grace_period=1,
|
|
107
|
+
outage_retry_interval=0,
|
|
108
|
+
)
|
|
109
|
+
with env:
|
|
110
|
+
with env.sandbox(image_id='test_image2') as sb:
|
|
111
|
+
self.assertEqual(sb.image_id, 'test_image2')
|
|
112
|
+
|
|
113
|
+
with self.assertRaisesRegex(
|
|
114
|
+
ValueError, 'Environment .* does not have a default image ID.'
|
|
115
|
+
):
|
|
116
|
+
env.sandbox()
|
|
117
|
+
|
|
118
|
+
def test_dynamic_image_loading_with_pooling(self):
|
|
119
|
+
env = TestingEnvironment(
|
|
120
|
+
image_ids=[],
|
|
121
|
+
supports_dynamic_image_loading=True,
|
|
122
|
+
pool_size=2,
|
|
123
|
+
features={'test_feature': TestingFeature()},
|
|
124
|
+
outage_grace_period=1,
|
|
125
|
+
outage_retry_interval=0,
|
|
126
|
+
)
|
|
127
|
+
with env:
|
|
128
|
+
with env.sandbox(image_id='test_image'):
|
|
129
|
+
self.assertEqual(len(env.sandbox_pool['test_image']), 1)
|
|
130
|
+
|
|
131
|
+
with env.sandbox(image_id='test_image'):
|
|
132
|
+
self.assertEqual(len(env.sandbox_pool['test_image']), 2)
|
|
133
|
+
|
|
134
|
+
with self.assertRaises(interface.EnvironmentOverloadError):
|
|
135
|
+
with env.sandbox(image_id='test_image'):
|
|
136
|
+
pass
|
|
137
|
+
self.assertEqual(len(env.sandbox_pool['test_image']), 2)
|
|
138
|
+
|
|
139
|
+
with env.sandbox(image_id='test_image'):
|
|
140
|
+
self.assertEqual(len(env.sandbox_pool['test_image']), 2)
|
|
141
|
+
|
|
142
|
+
def test_image_feature_mappings(self):
|
|
143
|
+
env = TestingEnvironment(
|
|
144
|
+
image_ids=[
|
|
145
|
+
'test_image1',
|
|
146
|
+
'test_image2',
|
|
147
|
+
],
|
|
148
|
+
features={
|
|
149
|
+
'test_feature': TestingFeature(
|
|
150
|
+
applicable_images=['test_image1.*']
|
|
151
|
+
),
|
|
152
|
+
'test_feature2': TestingFeature(
|
|
153
|
+
applicable_images=['test_image2.*']
|
|
154
|
+
),
|
|
155
|
+
'test_feature3': TestingFeature(
|
|
156
|
+
applicable_images=['test_image.*']
|
|
157
|
+
),
|
|
158
|
+
},
|
|
159
|
+
pool_size=0,
|
|
160
|
+
outage_grace_period=1,
|
|
161
|
+
outage_retry_interval=0,
|
|
162
|
+
sandbox_keepalive_interval=0,
|
|
163
|
+
)
|
|
164
|
+
with env:
|
|
165
|
+
with env.sandbox(image_id='test_image1') as sb:
|
|
166
|
+
self.assertIn('test_feature', sb.features)
|
|
167
|
+
self.assertNotIn('test_feature2', sb.features)
|
|
168
|
+
self.assertIn('test_feature3', sb.features)
|
|
169
|
+
|
|
170
|
+
with env.sandbox(image_id='test_image2') as sb:
|
|
171
|
+
self.assertNotIn('test_feature', sb.features)
|
|
172
|
+
self.assertIn('test_feature2', sb.features)
|
|
173
|
+
self.assertIn('test_feature3', sb.features)
|
|
174
|
+
|
|
175
|
+
with env.test_feature() as feature:
|
|
176
|
+
self.assertEqual(feature.sandbox.image_id, 'test_image1')
|
|
177
|
+
|
|
178
|
+
with self.assertRaisesRegex(
|
|
179
|
+
ValueError, 'Feature .* is not applicable to .*'
|
|
180
|
+
):
|
|
181
|
+
with env.test_feature('test_image2'):
|
|
182
|
+
pass
|
|
183
|
+
|
|
184
|
+
with env.test_feature2() as feature:
|
|
185
|
+
self.assertEqual(feature.sandbox.image_id, 'test_image2')
|
|
186
|
+
|
|
187
|
+
with env.test_feature3() as feature:
|
|
188
|
+
self.assertEqual(feature.sandbox.image_id, 'test_image1')
|
|
189
|
+
|
|
190
|
+
with env.test_feature3('test_image2') as feature:
|
|
191
|
+
self.assertEqual(feature.sandbox.image_id, 'test_image2')
|
|
192
|
+
|
|
193
|
+
def test_feature_applicability_check(self):
|
|
194
|
+
with self.assertRaisesRegex(
|
|
195
|
+
ValueError, 'Feature .* is not applicable to .*'
|
|
196
|
+
):
|
|
197
|
+
TestingEnvironment(
|
|
198
|
+
image_ids=[
|
|
199
|
+
'test_image1',
|
|
200
|
+
],
|
|
201
|
+
features={
|
|
202
|
+
'test_feature2': TestingFeature(
|
|
203
|
+
applicable_images=['test_image2.*']
|
|
204
|
+
),
|
|
205
|
+
},
|
|
206
|
+
)
|
|
207
|
+
env = TestingEnvironment(
|
|
208
|
+
image_ids=[],
|
|
209
|
+
supports_dynamic_image_loading=True,
|
|
210
|
+
features={
|
|
211
|
+
'test_feature2': TestingFeature(
|
|
212
|
+
applicable_images=['test_image2.*']
|
|
213
|
+
),
|
|
214
|
+
},
|
|
215
|
+
pool_size=0
|
|
216
|
+
)
|
|
217
|
+
with env:
|
|
218
|
+
with self.assertRaisesRegex(
|
|
219
|
+
ValueError, 'No image ID found for feature .*'
|
|
220
|
+
):
|
|
221
|
+
with env.test_feature2():
|
|
222
|
+
pass
|
|
223
|
+
|
|
224
|
+
# Dynamically loaded IDs.
|
|
225
|
+
with env.test_feature2('test_image2') as feature:
|
|
226
|
+
self.assertEqual(feature.sandbox.image_id, 'test_image2')
|
|
227
|
+
|
|
228
|
+
def test_pool_size(self):
|
|
229
|
+
env = TestingEnvironment(
|
|
230
|
+
image_ids=['test_image'],
|
|
231
|
+
pool_size=1,
|
|
232
|
+
outage_grace_period=1,
|
|
233
|
+
outage_retry_interval=0,
|
|
234
|
+
)
|
|
235
|
+
self.assertEqual(env.min_pool_size('test_image'), 1)
|
|
236
|
+
self.assertEqual(env.max_pool_size('test_image'), 1)
|
|
237
|
+
|
|
238
|
+
env = TestingEnvironment(
|
|
239
|
+
image_ids=['test_image'],
|
|
240
|
+
pool_size=(0, 256),
|
|
241
|
+
outage_grace_period=1,
|
|
242
|
+
outage_retry_interval=0,
|
|
243
|
+
)
|
|
244
|
+
self.assertEqual(env.min_pool_size('test_image'), 0)
|
|
245
|
+
self.assertEqual(env.max_pool_size('test_image'), 256)
|
|
246
|
+
|
|
247
|
+
env = TestingEnvironment(
|
|
248
|
+
image_ids=['test_image'],
|
|
249
|
+
pool_size={
|
|
250
|
+
'test_.*': (0, 128),
|
|
251
|
+
'my.*': (5, 64),
|
|
252
|
+
'exact_image_name': 10,
|
|
253
|
+
},
|
|
254
|
+
outage_grace_period=1,
|
|
255
|
+
outage_retry_interval=0,
|
|
256
|
+
)
|
|
257
|
+
self.assertEqual(env.min_pool_size('test_image'), 0)
|
|
258
|
+
self.assertEqual(env.max_pool_size('test_image'), 128)
|
|
259
|
+
self.assertEqual(env.min_pool_size('my_image'), 5)
|
|
260
|
+
self.assertEqual(env.max_pool_size('my_image'), 64)
|
|
261
|
+
self.assertEqual(env.min_pool_size('exact_image_name'), 10)
|
|
262
|
+
self.assertEqual(env.max_pool_size('exact_image_name'), 10)
|
|
263
|
+
self.assertEqual(env.min_pool_size('some_image'), 0) # default
|
|
264
|
+
self.assertEqual(env.max_pool_size('some_image'), 256) # default
|
|
265
|
+
|
|
81
266
|
def test_del(self):
|
|
82
267
|
env = TestingEnvironment(
|
|
83
268
|
features={'test_feature': TestingFeature()},
|
|
@@ -168,19 +353,21 @@ class EnvironmentTests(unittest.TestCase):
|
|
|
168
353
|
sandbox_keepalive_interval=0,
|
|
169
354
|
)
|
|
170
355
|
with env:
|
|
171
|
-
self.assertEqual(len(env.sandbox_pool), 1)
|
|
356
|
+
self.assertEqual(len(env.sandbox_pool['test_image']), 1)
|
|
172
357
|
self.assertEqual(
|
|
173
358
|
env.stats(),
|
|
174
359
|
{
|
|
175
360
|
'sandbox': {
|
|
176
|
-
'
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
361
|
+
'test_image': {
|
|
362
|
+
'created': 0,
|
|
363
|
+
'setting_up': 0,
|
|
364
|
+
'ready': 1,
|
|
365
|
+
'acquired': 0,
|
|
366
|
+
'in_session': 0,
|
|
367
|
+
'exiting_session': 0,
|
|
368
|
+
'shutting_down': 0,
|
|
369
|
+
'offline': 0,
|
|
370
|
+
}
|
|
184
371
|
}
|
|
185
372
|
}
|
|
186
373
|
)
|
|
@@ -190,49 +377,44 @@ class EnvironmentTests(unittest.TestCase):
|
|
|
190
377
|
env.stats(),
|
|
191
378
|
{
|
|
192
379
|
'sandbox': {
|
|
193
|
-
'
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
380
|
+
'test_image': {
|
|
381
|
+
'created': 0,
|
|
382
|
+
'setting_up': 0,
|
|
383
|
+
'ready': 0,
|
|
384
|
+
'acquired': 1,
|
|
385
|
+
'in_session': 0,
|
|
386
|
+
'exiting_session': 0,
|
|
387
|
+
'shutting_down': 0,
|
|
388
|
+
'offline': 0,
|
|
389
|
+
}
|
|
201
390
|
}
|
|
202
391
|
}
|
|
203
392
|
)
|
|
204
|
-
self.assertEqual(len(env.sandbox_pool), 1)
|
|
393
|
+
self.assertEqual(len(env.sandbox_pool['test_image']), 1)
|
|
205
394
|
sb2 = env.acquire()
|
|
206
395
|
self.assertEqual(sb2.status, interface.Sandbox.Status.ACQUIRED)
|
|
207
|
-
self.assertEqual(len(env.sandbox_pool), 2)
|
|
396
|
+
self.assertEqual(len(env.sandbox_pool['test_image']), 2)
|
|
208
397
|
self.assertEqual(
|
|
209
398
|
env.stats(),
|
|
210
399
|
{
|
|
211
400
|
'sandbox': {
|
|
212
|
-
'
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
401
|
+
'test_image': {
|
|
402
|
+
'created': 0,
|
|
403
|
+
'setting_up': 0,
|
|
404
|
+
'ready': 0,
|
|
405
|
+
'acquired': 2,
|
|
406
|
+
'in_session': 0,
|
|
407
|
+
'exiting_session': 0,
|
|
408
|
+
'shutting_down': 0,
|
|
409
|
+
'offline': 0,
|
|
410
|
+
}
|
|
220
411
|
}
|
|
221
412
|
}
|
|
222
413
|
)
|
|
223
414
|
self.assertEqual(
|
|
224
415
|
env.stats(),
|
|
225
416
|
{
|
|
226
|
-
'sandbox': {
|
|
227
|
-
'created': 0,
|
|
228
|
-
'setting_up': 0,
|
|
229
|
-
'ready': 0,
|
|
230
|
-
'acquired': 0,
|
|
231
|
-
'in_session': 0,
|
|
232
|
-
'exiting_session': 0,
|
|
233
|
-
'shutting_down': 0,
|
|
234
|
-
'offline': 0,
|
|
235
|
-
}
|
|
417
|
+
'sandbox': {}
|
|
236
418
|
}
|
|
237
419
|
)
|
|
238
420
|
|
|
@@ -268,8 +450,10 @@ class EnvironmentTests(unittest.TestCase):
|
|
|
268
450
|
)
|
|
269
451
|
with env:
|
|
270
452
|
self.assertEqual(len(env.sandbox_pool), 1)
|
|
453
|
+
self.assertIn('test_image', env.sandbox_pool)
|
|
271
454
|
self.assertEqual(
|
|
272
|
-
env.sandbox_pool[0].status,
|
|
455
|
+
env.sandbox_pool['test_image'][0].status,
|
|
456
|
+
interface.Sandbox.Status.READY
|
|
273
457
|
)
|
|
274
458
|
# Make future sandbox setup to fail.
|
|
275
459
|
env.features.test_feature.rebind(
|
|
@@ -322,43 +506,45 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
322
506
|
'feature2': TestingFeature(),
|
|
323
507
|
},
|
|
324
508
|
)
|
|
325
|
-
self.assertFalse(env.enable_pooling)
|
|
509
|
+
self.assertFalse(env.enable_pooling('test_image'))
|
|
326
510
|
with env:
|
|
327
|
-
with env.sandbox('session1') as sb:
|
|
511
|
+
with env.sandbox(session_id='session1') as sb:
|
|
328
512
|
sb.shell('echo "hello"')
|
|
329
513
|
self.assertEqual(
|
|
330
514
|
self.event_handler.logs,
|
|
331
515
|
[
|
|
516
|
+
# pylint: disable=line-too-long
|
|
332
517
|
'[testing-env] environment started',
|
|
333
|
-
'[testing-env/0] shell: "feature1" setup',
|
|
334
|
-
'[testing-env/0/feature1] feature setup',
|
|
335
|
-
'[testing-env/0] shell: "feature2" setup',
|
|
336
|
-
'[testing-env/0/feature2] feature setup',
|
|
337
|
-
'[testing-env/0] created -> ready',
|
|
338
|
-
'[testing-env/0] sandbox started',
|
|
339
|
-
'[testing-env/0] ready -> acquired',
|
|
340
|
-
'[testing-env/0] acquired -> setting_up',
|
|
341
|
-
'[testing-env/0/session1] shell: "feature1" setup session',
|
|
342
|
-
'[testing-env/0/feature1] feature setup session',
|
|
343
|
-
'[testing-env/0/session1] shell: "feature2" setup session',
|
|
344
|
-
'[testing-env/0/feature2] feature setup session',
|
|
345
|
-
'[testing-env/0] setting_up -> in_session',
|
|
346
|
-
"[testing-env/0] session 'session1' started",
|
|
347
|
-
'[testing-env/0/session1] shell: echo "hello"',
|
|
348
|
-
'[testing-env/0] in_session -> exiting_session',
|
|
349
|
-
'[testing-env/0/session1] shell: "feature1" teardown session',
|
|
350
|
-
'[testing-env/0/feature1] feature teardown session',
|
|
351
|
-
'[testing-env/0/session1] shell: "feature2" teardown session',
|
|
352
|
-
'[testing-env/0/feature2] feature teardown session',
|
|
353
|
-
"[testing-env/0] session 'session1' ended",
|
|
354
|
-
'[testing-env/0] exiting_session -> acquired',
|
|
355
|
-
'[testing-env/0] acquired -> shutting_down',
|
|
356
|
-
'[testing-env/0] shell: "feature1" teardown',
|
|
357
|
-
'[testing-env/0/feature1] feature teardown',
|
|
358
|
-
'[testing-env/0] shell: "feature2" teardown',
|
|
359
|
-
'[testing-env/0/feature2] feature teardown',
|
|
360
|
-
'[testing-env/0] shutting_down -> offline',
|
|
361
|
-
'[testing-env/0] sandbox shutdown'
|
|
518
|
+
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
519
|
+
'[testing-env/test_image:0/feature1] feature setup',
|
|
520
|
+
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
521
|
+
'[testing-env/test_image:0/feature2] feature setup',
|
|
522
|
+
'[testing-env/test_image:0] created -> ready',
|
|
523
|
+
'[testing-env/test_image:0] sandbox started',
|
|
524
|
+
'[testing-env/test_image:0] ready -> acquired',
|
|
525
|
+
'[testing-env/test_image:0] acquired -> setting_up',
|
|
526
|
+
'[testing-env/test_image:0/session1] shell: "feature1" setup session',
|
|
527
|
+
'[testing-env/test_image:0/feature1] feature setup session',
|
|
528
|
+
'[testing-env/test_image:0/session1] shell: "feature2" setup session',
|
|
529
|
+
'[testing-env/test_image:0/feature2] feature setup session',
|
|
530
|
+
'[testing-env/test_image:0] setting_up -> in_session',
|
|
531
|
+
"[testing-env/test_image:0] session 'session1' started",
|
|
532
|
+
'[testing-env/test_image:0/session1] shell: echo "hello"',
|
|
533
|
+
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
534
|
+
'[testing-env/test_image:0/session1] shell: "feature1" teardown session',
|
|
535
|
+
'[testing-env/test_image:0/feature1] feature teardown session',
|
|
536
|
+
'[testing-env/test_image:0/session1] shell: "feature2" teardown session',
|
|
537
|
+
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
538
|
+
"[testing-env/test_image:0] session 'session1' ended",
|
|
539
|
+
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
540
|
+
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
541
|
+
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
542
|
+
'[testing-env/test_image:0/feature1] feature teardown',
|
|
543
|
+
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
544
|
+
'[testing-env/test_image:0/feature2] feature teardown',
|
|
545
|
+
'[testing-env/test_image:0] shutting_down -> offline',
|
|
546
|
+
'[testing-env/test_image:0] sandbox shutdown'
|
|
547
|
+
# pylint: enable=line-too-long
|
|
362
548
|
]
|
|
363
549
|
)
|
|
364
550
|
|
|
@@ -371,9 +557,9 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
371
557
|
pool_size=1,
|
|
372
558
|
proactive_session_setup=True,
|
|
373
559
|
)
|
|
374
|
-
self.assertTrue(env.enable_pooling)
|
|
560
|
+
self.assertTrue(env.enable_pooling('test_image'))
|
|
375
561
|
with env:
|
|
376
|
-
with env.sandbox('session1') as sb:
|
|
562
|
+
with env.sandbox(session_id='session1') as sb:
|
|
377
563
|
sb.shell('echo "hello"')
|
|
378
564
|
sb.wait_until_not(
|
|
379
565
|
(
|
|
@@ -385,34 +571,36 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
385
571
|
self.assertEqual(
|
|
386
572
|
self.event_handler.logs,
|
|
387
573
|
[
|
|
388
|
-
|
|
389
|
-
'[testing-env/0:0
|
|
390
|
-
'[testing-env/0:0]
|
|
391
|
-
'[testing-env/0:0
|
|
392
|
-
'[testing-env/0:0]
|
|
393
|
-
'[testing-env/0:0
|
|
394
|
-
'[testing-env/0:0]
|
|
395
|
-
'[testing-env/0:0
|
|
396
|
-
'[testing-env/0:0]
|
|
397
|
-
'[testing-env/0:0]
|
|
574
|
+
# pylint: disable=line-too-long
|
|
575
|
+
'[testing-env/test_image:0:0] shell: "feature1" setup',
|
|
576
|
+
'[testing-env/test_image:0:0/feature1] feature setup',
|
|
577
|
+
'[testing-env/test_image:0:0] shell: "feature2" setup',
|
|
578
|
+
'[testing-env/test_image:0:0/feature2] feature setup',
|
|
579
|
+
'[testing-env/test_image:0:0] shell: "feature1" setup session',
|
|
580
|
+
'[testing-env/test_image:0:0/feature1] feature setup session',
|
|
581
|
+
'[testing-env/test_image:0:0] shell: "feature2" setup session',
|
|
582
|
+
'[testing-env/test_image:0:0/feature2] feature setup session',
|
|
583
|
+
'[testing-env/test_image:0:0] created -> ready',
|
|
584
|
+
'[testing-env/test_image:0:0] sandbox started',
|
|
398
585
|
'[testing-env] environment started',
|
|
399
|
-
'[testing-env/0:0] ready -> acquired',
|
|
400
|
-
'[testing-env/0:0] acquired -> setting_up',
|
|
401
|
-
'[testing-env/0:0] setting_up -> in_session',
|
|
402
|
-
"[testing-env/0:0] session 'session1' started",
|
|
403
|
-
'[testing-env/0:0/session1] shell: echo "hello"',
|
|
404
|
-
'[testing-env/0:0] in_session -> exiting_session',
|
|
405
|
-
'[testing-env/0:0/session1] shell: "feature1" teardown session',
|
|
406
|
-
'[testing-env/0:0/feature1] feature teardown session',
|
|
407
|
-
'[testing-env/0:0/session1] shell: "feature2" teardown session',
|
|
408
|
-
'[testing-env/0:0/feature2] feature teardown session',
|
|
409
|
-
"[testing-env/0:0] session 'session1' ended",
|
|
410
|
-
'[testing-env/0:0] exiting_session -> setting_up',
|
|
411
|
-
'[testing-env/0:0] shell: "feature1" setup session',
|
|
412
|
-
'[testing-env/0:0/feature1] feature setup session',
|
|
413
|
-
'[testing-env/0:0] shell: "feature2" setup session',
|
|
414
|
-
'[testing-env/0:0/feature2] feature setup session',
|
|
415
|
-
'[testing-env/0:0] setting_up -> ready'
|
|
586
|
+
'[testing-env/test_image:0:0] ready -> acquired',
|
|
587
|
+
'[testing-env/test_image:0:0] acquired -> setting_up',
|
|
588
|
+
'[testing-env/test_image:0:0] setting_up -> in_session',
|
|
589
|
+
"[testing-env/test_image:0:0] session 'session1' started",
|
|
590
|
+
'[testing-env/test_image:0:0/session1] shell: echo "hello"',
|
|
591
|
+
'[testing-env/test_image:0:0] in_session -> exiting_session',
|
|
592
|
+
'[testing-env/test_image:0:0/session1] shell: "feature1" teardown session',
|
|
593
|
+
'[testing-env/test_image:0:0/feature1] feature teardown session',
|
|
594
|
+
'[testing-env/test_image:0:0/session1] shell: "feature2" teardown session',
|
|
595
|
+
'[testing-env/test_image:0:0/feature2] feature teardown session',
|
|
596
|
+
"[testing-env/test_image:0:0] session 'session1' ended",
|
|
597
|
+
'[testing-env/test_image:0:0] exiting_session -> setting_up',
|
|
598
|
+
'[testing-env/test_image:0:0] shell: "feature1" setup session',
|
|
599
|
+
'[testing-env/test_image:0:0/feature1] feature setup session',
|
|
600
|
+
'[testing-env/test_image:0:0] shell: "feature2" setup session',
|
|
601
|
+
'[testing-env/test_image:0:0/feature2] feature setup session',
|
|
602
|
+
'[testing-env/test_image:0:0] setting_up -> ready'
|
|
603
|
+
# pylint: enable=line-too-long
|
|
416
604
|
]
|
|
417
605
|
)
|
|
418
606
|
|
|
@@ -427,7 +615,7 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
427
615
|
log_session_setup=True,
|
|
428
616
|
)
|
|
429
617
|
with env:
|
|
430
|
-
with env.sandbox('session1') as sb:
|
|
618
|
+
with env.sandbox(session_id='session1') as sb:
|
|
431
619
|
sb.add_event_handler(event_handler)
|
|
432
620
|
sb.test_feature.rebind(
|
|
433
621
|
simulate_setup_session_error=interface.SandboxStateError,
|
|
@@ -445,17 +633,17 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
445
633
|
event_handler.logs,
|
|
446
634
|
[
|
|
447
635
|
# pylint: disable=line-too-long
|
|
448
|
-
'[testing-env/0:0] in_session -> exiting_session',
|
|
449
|
-
'[testing-env/0:0/session1] shell: "test_feature" teardown session',
|
|
450
|
-
'[testing-env/0:0/test_feature] feature teardown session',
|
|
451
|
-
"[testing-env/0:0] session 'session1' ended",
|
|
452
|
-
'[testing-env/0:0] exiting_session -> setting_up',
|
|
453
|
-
'[testing-env/0:0/test_feature] feature setup session with SandboxStateError', # pylint: disable=line-too-long
|
|
454
|
-
'[testing-env/0:0] setting_up -> shutting_down',
|
|
455
|
-
'[testing-env/0:0] shell: "test_feature" teardown',
|
|
456
|
-
'[testing-env/0:0/test_feature] feature teardown',
|
|
457
|
-
'[testing-env/0:0] shutting_down -> offline',
|
|
458
|
-
'[testing-env/0:0] sandbox shutdown'
|
|
636
|
+
'[testing-env/test_image:0:0] in_session -> exiting_session',
|
|
637
|
+
'[testing-env/test_image:0:0/session1] shell: "test_feature" teardown session',
|
|
638
|
+
'[testing-env/test_image:0:0/test_feature] feature teardown session',
|
|
639
|
+
"[testing-env/test_image:0:0] session 'session1' ended",
|
|
640
|
+
'[testing-env/test_image:0:0] exiting_session -> setting_up',
|
|
641
|
+
'[testing-env/test_image:0:0/test_feature] feature setup session with SandboxStateError', # pylint: disable=line-too-long
|
|
642
|
+
'[testing-env/test_image:0:0] setting_up -> shutting_down',
|
|
643
|
+
'[testing-env/test_image:0:0] shell: "test_feature" teardown',
|
|
644
|
+
'[testing-env/test_image:0:0/test_feature] feature teardown',
|
|
645
|
+
'[testing-env/test_image:0:0] shutting_down -> offline',
|
|
646
|
+
'[testing-env/test_image:0:0] sandbox shutdown'
|
|
459
647
|
# pylint: enable=line-too-long
|
|
460
648
|
]
|
|
461
649
|
)
|
|
@@ -470,17 +658,17 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
470
658
|
)
|
|
471
659
|
with env:
|
|
472
660
|
with self.assertRaises(ValueError):
|
|
473
|
-
with env.sandbox('session1'):
|
|
661
|
+
with env.sandbox(session_id='session1'):
|
|
474
662
|
pass
|
|
475
663
|
self.assertTrue(env.is_online)
|
|
476
664
|
self.assertEqual(
|
|
477
665
|
self.event_handler.logs,
|
|
478
666
|
[
|
|
479
667
|
'[testing-env] environment started',
|
|
480
|
-
'[testing-env/0] sandbox started with ValueError',
|
|
481
|
-
'[testing-env/0] created -> shutting_down',
|
|
482
|
-
'[testing-env/0] shutting_down -> offline',
|
|
483
|
-
'[testing-env/0] sandbox shutdown'
|
|
668
|
+
'[testing-env/test_image:0] sandbox started with ValueError',
|
|
669
|
+
'[testing-env/test_image:0] created -> shutting_down',
|
|
670
|
+
'[testing-env/test_image:0] shutting_down -> offline',
|
|
671
|
+
'[testing-env/test_image:0] sandbox shutdown'
|
|
484
672
|
]
|
|
485
673
|
)
|
|
486
674
|
|
|
@@ -499,12 +687,14 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
499
687
|
self.assertEqual(
|
|
500
688
|
self.event_handler.logs,
|
|
501
689
|
[
|
|
502
|
-
|
|
503
|
-
'[testing-env/0:0]
|
|
504
|
-
'[testing-env/0:0]
|
|
505
|
-
'[testing-env/0:0]
|
|
690
|
+
# pylint: disable=line-too-long
|
|
691
|
+
'[testing-env/test_image:0:0] sandbox started with SandboxStateError',
|
|
692
|
+
'[testing-env/test_image:0:0] created -> shutting_down',
|
|
693
|
+
'[testing-env/test_image:0:0] shutting_down -> offline',
|
|
694
|
+
'[testing-env/test_image:0:0] sandbox shutdown',
|
|
506
695
|
'[testing-env] environment started with EnvironmentOutageError',
|
|
507
696
|
'[testing-env] environment shutdown'
|
|
697
|
+
# pylint: enable=line-too-long
|
|
508
698
|
]
|
|
509
699
|
)
|
|
510
700
|
|
|
@@ -518,44 +708,46 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
518
708
|
)
|
|
519
709
|
with env:
|
|
520
710
|
with self.assertRaises(ValueError):
|
|
521
|
-
with env.sandbox('session1') as sb:
|
|
711
|
+
with env.sandbox(session_id='session1') as sb:
|
|
522
712
|
sb.shell('echo "hello"')
|
|
523
713
|
self.assertEqual(len(sb.state_errors), 0)
|
|
524
714
|
|
|
525
715
|
self.assertEqual(
|
|
526
716
|
self.event_handler.logs,
|
|
527
717
|
[
|
|
718
|
+
# pylint: disable=line-too-long
|
|
528
719
|
'[testing-env] environment started',
|
|
529
|
-
'[testing-env/0] shell: "feature1" setup',
|
|
530
|
-
'[testing-env/0/feature1] feature setup',
|
|
531
|
-
'[testing-env/0] shell: "feature2" setup',
|
|
532
|
-
'[testing-env/0/feature2] feature setup',
|
|
533
|
-
'[testing-env/0] created -> ready',
|
|
534
|
-
'[testing-env/0] sandbox started',
|
|
535
|
-
'[testing-env/0] ready -> acquired',
|
|
536
|
-
'[testing-env/0] acquired -> setting_up',
|
|
537
|
-
'[testing-env/0/session1] shell: "feature1" setup session',
|
|
538
|
-
'[testing-env/0/feature1] feature setup session',
|
|
539
|
-
'[testing-env/0/session1] shell: "feature2" setup session',
|
|
540
|
-
'[testing-env/0/feature2] feature setup session',
|
|
541
|
-
'[testing-env/0] setting_up -> in_session',
|
|
542
|
-
"[testing-env/0] session 'session1' started",
|
|
543
|
-
'[testing-env/0/session1] shell: echo "hello"',
|
|
544
|
-
'[testing-env/0] in_session -> exiting_session',
|
|
545
|
-
'[testing-env/0/session1] shell: "feature1" teardown session',
|
|
546
|
-
'[testing-env/0/feature1] feature teardown session',
|
|
547
|
-
'[testing-env/0/session1] shell: "feature2" teardown session',
|
|
548
|
-
'[testing-env/0/feature2] feature teardown session',
|
|
549
|
-
"[testing-env/0] session 'session1' ended",
|
|
550
|
-
'[testing-env/0] exiting_session -> acquired',
|
|
551
|
-
'[testing-env/0] acquired -> shutting_down',
|
|
552
|
-
'[testing-env/0] shell: "feature1" teardown',
|
|
553
|
-
'[testing-env/0/feature1] feature teardown',
|
|
554
|
-
'[testing-env/0] shell: "feature2" teardown',
|
|
555
|
-
'[testing-env/0/feature2] feature teardown',
|
|
556
|
-
'[testing-env/0] shutting_down -> offline',
|
|
557
|
-
'[testing-env/0] sandbox shutdown with ValueError',
|
|
720
|
+
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
721
|
+
'[testing-env/test_image:0/feature1] feature setup',
|
|
722
|
+
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
723
|
+
'[testing-env/test_image:0/feature2] feature setup',
|
|
724
|
+
'[testing-env/test_image:0] created -> ready',
|
|
725
|
+
'[testing-env/test_image:0] sandbox started',
|
|
726
|
+
'[testing-env/test_image:0] ready -> acquired',
|
|
727
|
+
'[testing-env/test_image:0] acquired -> setting_up',
|
|
728
|
+
'[testing-env/test_image:0/session1] shell: "feature1" setup session',
|
|
729
|
+
'[testing-env/test_image:0/feature1] feature setup session',
|
|
730
|
+
'[testing-env/test_image:0/session1] shell: "feature2" setup session',
|
|
731
|
+
'[testing-env/test_image:0/feature2] feature setup session',
|
|
732
|
+
'[testing-env/test_image:0] setting_up -> in_session',
|
|
733
|
+
"[testing-env/test_image:0] session 'session1' started",
|
|
734
|
+
'[testing-env/test_image:0/session1] shell: echo "hello"',
|
|
735
|
+
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
736
|
+
'[testing-env/test_image:0/session1] shell: "feature1" teardown session',
|
|
737
|
+
'[testing-env/test_image:0/feature1] feature teardown session',
|
|
738
|
+
'[testing-env/test_image:0/session1] shell: "feature2" teardown session',
|
|
739
|
+
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
740
|
+
"[testing-env/test_image:0] session 'session1' ended",
|
|
741
|
+
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
742
|
+
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
743
|
+
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
744
|
+
'[testing-env/test_image:0/feature1] feature teardown',
|
|
745
|
+
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
746
|
+
'[testing-env/test_image:0/feature2] feature teardown',
|
|
747
|
+
'[testing-env/test_image:0] shutting_down -> offline',
|
|
748
|
+
'[testing-env/test_image:0] sandbox shutdown with ValueError',
|
|
558
749
|
'[testing-env] environment shutdown'
|
|
750
|
+
# pylint: enable=line-too-long
|
|
559
751
|
]
|
|
560
752
|
)
|
|
561
753
|
|
|
@@ -575,25 +767,27 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
575
767
|
self.assertEqual(
|
|
576
768
|
self.event_handler.logs,
|
|
577
769
|
[
|
|
578
|
-
|
|
579
|
-
'[testing-env/0:0
|
|
580
|
-
'[testing-env/0:0]
|
|
581
|
-
'[testing-env/0:0
|
|
582
|
-
'[testing-env/0:0]
|
|
583
|
-
'[testing-env/0:0
|
|
584
|
-
'[testing-env/0:0]
|
|
585
|
-
'[testing-env/0:0
|
|
586
|
-
'[testing-env/0:0]
|
|
587
|
-
'[testing-env/0:0]
|
|
770
|
+
# pylint: disable=line-too-long
|
|
771
|
+
'[testing-env/test_image:0:0] shell: "feature1" setup',
|
|
772
|
+
'[testing-env/test_image:0:0/feature1] feature setup',
|
|
773
|
+
'[testing-env/test_image:0:0] shell: "feature2" setup',
|
|
774
|
+
'[testing-env/test_image:0:0/feature2] feature setup',
|
|
775
|
+
'[testing-env/test_image:0:0] shell: "feature1" setup session',
|
|
776
|
+
'[testing-env/test_image:0:0/feature1] feature setup session',
|
|
777
|
+
'[testing-env/test_image:0:0] shell: "feature2" setup session',
|
|
778
|
+
'[testing-env/test_image:0:0/feature2] feature setup session',
|
|
779
|
+
'[testing-env/test_image:0:0] created -> ready',
|
|
780
|
+
'[testing-env/test_image:0:0] sandbox started',
|
|
588
781
|
'[testing-env] environment started',
|
|
589
|
-
'[testing-env/0:0] ready -> shutting_down',
|
|
590
|
-
'[testing-env/0:0] shell: "feature1" teardown',
|
|
591
|
-
'[testing-env/0:0/feature1] feature teardown',
|
|
592
|
-
'[testing-env/0:0] shell: "feature2" teardown',
|
|
593
|
-
'[testing-env/0:0/feature2] feature teardown',
|
|
594
|
-
'[testing-env/0:0] shutting_down -> offline',
|
|
595
|
-
'[testing-env/0:0] sandbox shutdown with ValueError',
|
|
782
|
+
'[testing-env/test_image:0:0] ready -> shutting_down',
|
|
783
|
+
'[testing-env/test_image:0:0] shell: "feature1" teardown',
|
|
784
|
+
'[testing-env/test_image:0:0/feature1] feature teardown',
|
|
785
|
+
'[testing-env/test_image:0:0] shell: "feature2" teardown',
|
|
786
|
+
'[testing-env/test_image:0:0/feature2] feature teardown',
|
|
787
|
+
'[testing-env/test_image:0:0] shutting_down -> offline',
|
|
788
|
+
'[testing-env/test_image:0:0] sandbox shutdown with ValueError',
|
|
596
789
|
'[testing-env] environment shutdown with ValueError'
|
|
790
|
+
# pylint: enable=line-too-long
|
|
597
791
|
]
|
|
598
792
|
)
|
|
599
793
|
|
|
@@ -606,43 +800,45 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
606
800
|
simulate_shutdown_error=interface.SandboxStateError,
|
|
607
801
|
)
|
|
608
802
|
with env:
|
|
609
|
-
with env.sandbox('session1') as sb:
|
|
803
|
+
with env.sandbox(session_id='session1') as sb:
|
|
610
804
|
sb.shell('echo "hello"')
|
|
611
805
|
self.assertEqual(len(sb.state_errors), 1)
|
|
612
806
|
self.assertEqual(
|
|
613
807
|
self.event_handler.logs,
|
|
614
808
|
[
|
|
809
|
+
# pylint: disable=line-too-long
|
|
615
810
|
'[testing-env] environment started',
|
|
616
|
-
'[testing-env/0] shell: "feature1" setup',
|
|
617
|
-
'[testing-env/0/feature1] feature setup',
|
|
618
|
-
'[testing-env/0] shell: "feature2" setup',
|
|
619
|
-
'[testing-env/0/feature2] feature setup',
|
|
620
|
-
'[testing-env/0] created -> ready',
|
|
621
|
-
'[testing-env/0] sandbox started',
|
|
622
|
-
'[testing-env/0] ready -> acquired',
|
|
623
|
-
'[testing-env/0] acquired -> setting_up',
|
|
624
|
-
'[testing-env/0/session1] shell: "feature1" setup session',
|
|
625
|
-
'[testing-env/0/feature1] feature setup session',
|
|
626
|
-
'[testing-env/0/session1] shell: "feature2" setup session',
|
|
627
|
-
'[testing-env/0/feature2] feature setup session',
|
|
628
|
-
'[testing-env/0] setting_up -> in_session',
|
|
629
|
-
"[testing-env/0] session 'session1' started",
|
|
630
|
-
'[testing-env/0/session1] shell: echo "hello"',
|
|
631
|
-
'[testing-env/0] in_session -> exiting_session',
|
|
632
|
-
'[testing-env/0/session1] shell: "feature1" teardown session',
|
|
633
|
-
'[testing-env/0/feature1] feature teardown session',
|
|
634
|
-
'[testing-env/0/session1] shell: "feature2" teardown session',
|
|
635
|
-
'[testing-env/0/feature2] feature teardown session',
|
|
636
|
-
"[testing-env/0] session 'session1' ended",
|
|
637
|
-
'[testing-env/0] exiting_session -> acquired',
|
|
638
|
-
'[testing-env/0] acquired -> shutting_down',
|
|
639
|
-
'[testing-env/0] shell: "feature1" teardown',
|
|
640
|
-
'[testing-env/0/feature1] feature teardown',
|
|
641
|
-
'[testing-env/0] shell: "feature2" teardown',
|
|
642
|
-
'[testing-env/0/feature2] feature teardown',
|
|
643
|
-
'[testing-env/0] shutting_down -> offline',
|
|
644
|
-
'[testing-env/0] sandbox shutdown with SandboxStateError',
|
|
811
|
+
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
812
|
+
'[testing-env/test_image:0/feature1] feature setup',
|
|
813
|
+
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
814
|
+
'[testing-env/test_image:0/feature2] feature setup',
|
|
815
|
+
'[testing-env/test_image:0] created -> ready',
|
|
816
|
+
'[testing-env/test_image:0] sandbox started',
|
|
817
|
+
'[testing-env/test_image:0] ready -> acquired',
|
|
818
|
+
'[testing-env/test_image:0] acquired -> setting_up',
|
|
819
|
+
'[testing-env/test_image:0/session1] shell: "feature1" setup session',
|
|
820
|
+
'[testing-env/test_image:0/feature1] feature setup session',
|
|
821
|
+
'[testing-env/test_image:0/session1] shell: "feature2" setup session',
|
|
822
|
+
'[testing-env/test_image:0/feature2] feature setup session',
|
|
823
|
+
'[testing-env/test_image:0] setting_up -> in_session',
|
|
824
|
+
"[testing-env/test_image:0] session 'session1' started",
|
|
825
|
+
'[testing-env/test_image:0/session1] shell: echo "hello"',
|
|
826
|
+
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
827
|
+
'[testing-env/test_image:0/session1] shell: "feature1" teardown session',
|
|
828
|
+
'[testing-env/test_image:0/feature1] feature teardown session',
|
|
829
|
+
'[testing-env/test_image:0/session1] shell: "feature2" teardown session',
|
|
830
|
+
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
831
|
+
"[testing-env/test_image:0] session 'session1' ended",
|
|
832
|
+
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
833
|
+
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
834
|
+
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
835
|
+
'[testing-env/test_image:0/feature1] feature teardown',
|
|
836
|
+
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
837
|
+
'[testing-env/test_image:0/feature2] feature teardown',
|
|
838
|
+
'[testing-env/test_image:0] shutting_down -> offline',
|
|
839
|
+
'[testing-env/test_image:0] sandbox shutdown with SandboxStateError',
|
|
645
840
|
'[testing-env] environment shutdown'
|
|
841
|
+
# pylint: enable=line-too-long
|
|
646
842
|
]
|
|
647
843
|
)
|
|
648
844
|
|
|
@@ -657,23 +853,25 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
657
853
|
)
|
|
658
854
|
with env:
|
|
659
855
|
with self.assertRaises(ValueError):
|
|
660
|
-
with env.sandbox('session1'):
|
|
856
|
+
with env.sandbox(session_id='session1'):
|
|
661
857
|
pass
|
|
662
858
|
self.assertEqual(
|
|
663
859
|
self.event_handler.logs,
|
|
664
860
|
[
|
|
861
|
+
# pylint: disable=line-too-long
|
|
665
862
|
'[testing-env] environment started',
|
|
666
|
-
'[testing-env/0] shell: "feature1" setup',
|
|
667
|
-
'[testing-env/0/feature1] feature setup',
|
|
668
|
-
'[testing-env/0/feature2] feature setup with ValueError',
|
|
669
|
-
'[testing-env/0] sandbox started with ValueError',
|
|
670
|
-
'[testing-env/0] created -> shutting_down',
|
|
671
|
-
'[testing-env/0] shell: "feature1" teardown',
|
|
672
|
-
'[testing-env/0/feature1] feature teardown',
|
|
673
|
-
'[testing-env/0] shell: "feature2" teardown',
|
|
674
|
-
'[testing-env/0/feature2] feature teardown',
|
|
675
|
-
'[testing-env/0] shutting_down -> offline',
|
|
676
|
-
'[testing-env/0] sandbox shutdown'
|
|
863
|
+
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
864
|
+
'[testing-env/test_image:0/feature1] feature setup',
|
|
865
|
+
'[testing-env/test_image:0/feature2] feature setup with ValueError',
|
|
866
|
+
'[testing-env/test_image:0] sandbox started with ValueError',
|
|
867
|
+
'[testing-env/test_image:0] created -> shutting_down',
|
|
868
|
+
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
869
|
+
'[testing-env/test_image:0/feature1] feature teardown',
|
|
870
|
+
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
871
|
+
'[testing-env/test_image:0/feature2] feature teardown',
|
|
872
|
+
'[testing-env/test_image:0] shutting_down -> offline',
|
|
873
|
+
'[testing-env/test_image:0] sandbox shutdown',
|
|
874
|
+
# pylint: enable=line-too-long
|
|
677
875
|
]
|
|
678
876
|
)
|
|
679
877
|
|
|
@@ -688,20 +886,22 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
688
886
|
)
|
|
689
887
|
with env:
|
|
690
888
|
with self.assertRaises(interface.EnvironmentOutageError):
|
|
691
|
-
with env.sandbox('session1'):
|
|
889
|
+
with env.sandbox(session_id='session1'):
|
|
692
890
|
pass
|
|
693
891
|
self.assertEqual(
|
|
694
892
|
self.event_handler.logs,
|
|
695
893
|
[
|
|
894
|
+
# pylint: disable=line-too-long
|
|
696
895
|
'[testing-env] environment started',
|
|
697
|
-
'[testing-env/0/feature1] feature setup with SandboxStateError',
|
|
698
|
-
'[testing-env/0] sandbox started with SandboxStateError',
|
|
699
|
-
'[testing-env/0] created -> shutting_down',
|
|
700
|
-
'[testing-env/0] shell: "feature1" teardown',
|
|
701
|
-
'[testing-env/0/feature1] feature teardown',
|
|
702
|
-
'[testing-env/0] shutting_down -> offline',
|
|
703
|
-
'[testing-env/0] sandbox shutdown',
|
|
704
|
-
'[testing-env] environment shutdown'
|
|
896
|
+
'[testing-env/test_image:0/feature1] feature setup with SandboxStateError',
|
|
897
|
+
'[testing-env/test_image:0] sandbox started with SandboxStateError',
|
|
898
|
+
'[testing-env/test_image:0] created -> shutting_down',
|
|
899
|
+
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
900
|
+
'[testing-env/test_image:0/feature1] feature teardown',
|
|
901
|
+
'[testing-env/test_image:0] shutting_down -> offline',
|
|
902
|
+
'[testing-env/test_image:0] sandbox shutdown',
|
|
903
|
+
'[testing-env] environment shutdown',
|
|
904
|
+
# pylint: enable=line-too-long
|
|
705
905
|
]
|
|
706
906
|
)
|
|
707
907
|
|
|
@@ -716,39 +916,41 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
716
916
|
)
|
|
717
917
|
with env:
|
|
718
918
|
with self.assertRaises(interface.FeatureTeardownError):
|
|
719
|
-
with env.sandbox('session1'):
|
|
919
|
+
with env.sandbox(session_id='session1'):
|
|
720
920
|
pass
|
|
721
921
|
self.assertEqual(
|
|
722
922
|
self.event_handler.logs,
|
|
723
923
|
[
|
|
924
|
+
# pylint: disable=line-too-long
|
|
724
925
|
'[testing-env] environment started',
|
|
725
|
-
'[testing-env/0] shell: "feature1" setup',
|
|
726
|
-
'[testing-env/0/feature1] feature setup',
|
|
727
|
-
'[testing-env/0] shell: "feature2" setup',
|
|
728
|
-
'[testing-env/0/feature2] feature setup',
|
|
729
|
-
'[testing-env/0] created -> ready',
|
|
730
|
-
'[testing-env/0] sandbox started',
|
|
731
|
-
'[testing-env/0] ready -> acquired',
|
|
732
|
-
'[testing-env/0] acquired -> setting_up',
|
|
733
|
-
'[testing-env/0/session1] shell: "feature1" setup session',
|
|
734
|
-
'[testing-env/0/feature1] feature setup session',
|
|
735
|
-
'[testing-env/0/session1] shell: "feature2" setup session',
|
|
736
|
-
'[testing-env/0/feature2] feature setup session',
|
|
737
|
-
'[testing-env/0] setting_up -> in_session',
|
|
738
|
-
"[testing-env/0] session 'session1' started",
|
|
739
|
-
'[testing-env/0] in_session -> exiting_session',
|
|
740
|
-
'[testing-env/0/session1] shell: "feature1" teardown session',
|
|
741
|
-
'[testing-env/0/feature1] feature teardown session',
|
|
742
|
-
'[testing-env/0/session1] shell: "feature2" teardown session',
|
|
743
|
-
'[testing-env/0/feature2] feature teardown session',
|
|
744
|
-
"[testing-env/0] session 'session1' ended",
|
|
745
|
-
'[testing-env/0] exiting_session -> acquired',
|
|
746
|
-
'[testing-env/0] acquired -> shutting_down',
|
|
747
|
-
'[testing-env/0] shell: "feature1" teardown',
|
|
748
|
-
'[testing-env/0/feature1] feature teardown',
|
|
749
|
-
'[testing-env/0/feature2] feature teardown with ValueError',
|
|
750
|
-
'[testing-env/0] shutting_down -> offline',
|
|
751
|
-
'[testing-env/0] sandbox shutdown with FeatureTeardownError',
|
|
926
|
+
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
927
|
+
'[testing-env/test_image:0/feature1] feature setup',
|
|
928
|
+
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
929
|
+
'[testing-env/test_image:0/feature2] feature setup',
|
|
930
|
+
'[testing-env/test_image:0] created -> ready',
|
|
931
|
+
'[testing-env/test_image:0] sandbox started',
|
|
932
|
+
'[testing-env/test_image:0] ready -> acquired',
|
|
933
|
+
'[testing-env/test_image:0] acquired -> setting_up',
|
|
934
|
+
'[testing-env/test_image:0/session1] shell: "feature1" setup session',
|
|
935
|
+
'[testing-env/test_image:0/feature1] feature setup session',
|
|
936
|
+
'[testing-env/test_image:0/session1] shell: "feature2" setup session',
|
|
937
|
+
'[testing-env/test_image:0/feature2] feature setup session',
|
|
938
|
+
'[testing-env/test_image:0] setting_up -> in_session',
|
|
939
|
+
"[testing-env/test_image:0] session 'session1' started",
|
|
940
|
+
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
941
|
+
'[testing-env/test_image:0/session1] shell: "feature1" teardown session',
|
|
942
|
+
'[testing-env/test_image:0/feature1] feature teardown session',
|
|
943
|
+
'[testing-env/test_image:0/session1] shell: "feature2" teardown session',
|
|
944
|
+
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
945
|
+
"[testing-env/test_image:0] session 'session1' ended",
|
|
946
|
+
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
947
|
+
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
948
|
+
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
949
|
+
'[testing-env/test_image:0/feature1] feature teardown',
|
|
950
|
+
'[testing-env/test_image:0/feature2] feature teardown with ValueError',
|
|
951
|
+
'[testing-env/test_image:0] shutting_down -> offline',
|
|
952
|
+
'[testing-env/test_image:0] sandbox shutdown with FeatureTeardownError',
|
|
953
|
+
# pylint: enable=line-too-long
|
|
752
954
|
]
|
|
753
955
|
)
|
|
754
956
|
|
|
@@ -763,40 +965,42 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
763
965
|
},
|
|
764
966
|
)
|
|
765
967
|
with env:
|
|
766
|
-
with env.sandbox('session1') as sb:
|
|
968
|
+
with env.sandbox(session_id='session1') as sb:
|
|
767
969
|
pass
|
|
768
970
|
self.assertEqual(len(sb.state_errors), 1)
|
|
769
971
|
self.assertEqual(
|
|
770
972
|
self.event_handler.logs,
|
|
771
973
|
[
|
|
974
|
+
# pylint: disable=line-too-long
|
|
772
975
|
'[testing-env] environment started',
|
|
773
|
-
'[testing-env/0] shell: "feature1" setup',
|
|
774
|
-
'[testing-env/0/feature1] feature setup',
|
|
775
|
-
'[testing-env/0] shell: "feature2" setup',
|
|
776
|
-
'[testing-env/0/feature2] feature setup',
|
|
777
|
-
'[testing-env/0] created -> ready',
|
|
778
|
-
'[testing-env/0] sandbox started',
|
|
779
|
-
'[testing-env/0] ready -> acquired',
|
|
780
|
-
'[testing-env/0] acquired -> setting_up',
|
|
781
|
-
'[testing-env/0/session1] shell: "feature1" setup session',
|
|
782
|
-
'[testing-env/0/feature1] feature setup session',
|
|
783
|
-
'[testing-env/0/session1] shell: "feature2" setup session',
|
|
784
|
-
'[testing-env/0/feature2] feature setup session',
|
|
785
|
-
'[testing-env/0] setting_up -> in_session',
|
|
786
|
-
"[testing-env/0] session 'session1' started",
|
|
787
|
-
'[testing-env/0] in_session -> exiting_session',
|
|
788
|
-
'[testing-env/0/session1] shell: "feature1" teardown session',
|
|
789
|
-
'[testing-env/0/feature1] feature teardown session',
|
|
790
|
-
'[testing-env/0/session1] shell: "feature2" teardown session',
|
|
791
|
-
'[testing-env/0/feature2] feature teardown session',
|
|
792
|
-
"[testing-env/0] session 'session1' ended",
|
|
793
|
-
'[testing-env/0] exiting_session -> acquired',
|
|
794
|
-
'[testing-env/0] acquired -> shutting_down',
|
|
795
|
-
'[testing-env/0/feature1] feature teardown with SandboxStateError', # pylint: disable=line-too-long
|
|
796
|
-
'[testing-env/0] shell: "feature2" teardown',
|
|
797
|
-
'[testing-env/0/feature2] feature teardown',
|
|
798
|
-
'[testing-env/0] shutting_down -> offline',
|
|
799
|
-
'[testing-env/0] sandbox shutdown with FeatureTeardownError'
|
|
976
|
+
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
977
|
+
'[testing-env/test_image:0/feature1] feature setup',
|
|
978
|
+
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
979
|
+
'[testing-env/test_image:0/feature2] feature setup',
|
|
980
|
+
'[testing-env/test_image:0] created -> ready',
|
|
981
|
+
'[testing-env/test_image:0] sandbox started',
|
|
982
|
+
'[testing-env/test_image:0] ready -> acquired',
|
|
983
|
+
'[testing-env/test_image:0] acquired -> setting_up',
|
|
984
|
+
'[testing-env/test_image:0/session1] shell: "feature1" setup session',
|
|
985
|
+
'[testing-env/test_image:0/feature1] feature setup session',
|
|
986
|
+
'[testing-env/test_image:0/session1] shell: "feature2" setup session',
|
|
987
|
+
'[testing-env/test_image:0/feature2] feature setup session',
|
|
988
|
+
'[testing-env/test_image:0] setting_up -> in_session',
|
|
989
|
+
"[testing-env/test_image:0] session 'session1' started",
|
|
990
|
+
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
991
|
+
'[testing-env/test_image:0/session1] shell: "feature1" teardown session',
|
|
992
|
+
'[testing-env/test_image:0/feature1] feature teardown session',
|
|
993
|
+
'[testing-env/test_image:0/session1] shell: "feature2" teardown session',
|
|
994
|
+
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
995
|
+
"[testing-env/test_image:0] session 'session1' ended",
|
|
996
|
+
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
997
|
+
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
998
|
+
'[testing-env/test_image:0/feature1] feature teardown with SandboxStateError', # pylint: disable=line-too-long
|
|
999
|
+
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
1000
|
+
'[testing-env/test_image:0/feature2] feature teardown',
|
|
1001
|
+
'[testing-env/test_image:0] shutting_down -> offline',
|
|
1002
|
+
'[testing-env/test_image:0] sandbox shutdown with FeatureTeardownError',
|
|
1003
|
+
# pylint: enable=line-too-long
|
|
800
1004
|
]
|
|
801
1005
|
)
|
|
802
1006
|
|
|
@@ -811,31 +1015,33 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
811
1015
|
)
|
|
812
1016
|
with env:
|
|
813
1017
|
with self.assertRaises(ValueError):
|
|
814
|
-
with env.sandbox('session1') as sb:
|
|
1018
|
+
with env.sandbox(session_id='session1') as sb:
|
|
815
1019
|
sb.shell('echo "hello"')
|
|
816
1020
|
self.assertEqual(
|
|
817
1021
|
self.event_handler.logs,
|
|
818
1022
|
[
|
|
1023
|
+
# pylint: disable=line-too-long
|
|
819
1024
|
'[testing-env] environment started',
|
|
820
|
-
'[testing-env/0] shell: "feature1" setup',
|
|
821
|
-
'[testing-env/0/feature1] feature setup',
|
|
822
|
-
'[testing-env/0] shell: "feature2" setup',
|
|
823
|
-
'[testing-env/0/feature2] feature setup',
|
|
824
|
-
'[testing-env/0] created -> ready',
|
|
825
|
-
'[testing-env/0] sandbox started',
|
|
826
|
-
'[testing-env/0] ready -> acquired',
|
|
827
|
-
'[testing-env/0] acquired -> setting_up',
|
|
828
|
-
'[testing-env/0/session1] shell: "feature1" setup session',
|
|
829
|
-
'[testing-env/0/feature1] feature setup session',
|
|
830
|
-
'[testing-env/0/feature2] feature setup session with ValueError',
|
|
831
|
-
"[testing-env/0] session 'session1' started with ValueError",
|
|
832
|
-
'[testing-env/0] setting_up -> shutting_down',
|
|
833
|
-
'[testing-env/0/session1] shell: "feature1" teardown',
|
|
834
|
-
'[testing-env/0/feature1] feature teardown',
|
|
835
|
-
'[testing-env/0/session1] shell: "feature2" teardown',
|
|
836
|
-
'[testing-env/0/feature2] feature teardown',
|
|
837
|
-
'[testing-env/0] shutting_down -> offline',
|
|
838
|
-
'[testing-env/0] sandbox shutdown'
|
|
1025
|
+
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
1026
|
+
'[testing-env/test_image:0/feature1] feature setup',
|
|
1027
|
+
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
1028
|
+
'[testing-env/test_image:0/feature2] feature setup',
|
|
1029
|
+
'[testing-env/test_image:0] created -> ready',
|
|
1030
|
+
'[testing-env/test_image:0] sandbox started',
|
|
1031
|
+
'[testing-env/test_image:0] ready -> acquired',
|
|
1032
|
+
'[testing-env/test_image:0] acquired -> setting_up',
|
|
1033
|
+
'[testing-env/test_image:0/session1] shell: "feature1" setup session',
|
|
1034
|
+
'[testing-env/test_image:0/feature1] feature setup session',
|
|
1035
|
+
'[testing-env/test_image:0/feature2] feature setup session with ValueError',
|
|
1036
|
+
"[testing-env/test_image:0] session 'session1' started with ValueError",
|
|
1037
|
+
'[testing-env/test_image:0] setting_up -> shutting_down',
|
|
1038
|
+
'[testing-env/test_image:0/session1] shell: "feature1" teardown',
|
|
1039
|
+
'[testing-env/test_image:0/feature1] feature teardown',
|
|
1040
|
+
'[testing-env/test_image:0/session1] shell: "feature2" teardown',
|
|
1041
|
+
'[testing-env/test_image:0/feature2] feature teardown',
|
|
1042
|
+
'[testing-env/test_image:0] shutting_down -> offline',
|
|
1043
|
+
'[testing-env/test_image:0] sandbox shutdown',
|
|
1044
|
+
# pylint: enable=line-too-long
|
|
839
1045
|
]
|
|
840
1046
|
)
|
|
841
1047
|
|
|
@@ -850,41 +1056,43 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
850
1056
|
)
|
|
851
1057
|
with env:
|
|
852
1058
|
with self.assertRaises(interface.SessionTeardownError):
|
|
853
|
-
with env.sandbox('session1') as sb:
|
|
1059
|
+
with env.sandbox(session_id='session1') as sb:
|
|
854
1060
|
sb.shell('echo "hello"')
|
|
855
1061
|
self.assertEqual(sb.status, interface.Sandbox.Status.OFFLINE)
|
|
856
1062
|
self.assertEqual(
|
|
857
1063
|
self.event_handler.logs,
|
|
858
1064
|
[
|
|
1065
|
+
# pylint: disable=line-too-long
|
|
859
1066
|
'[testing-env] environment started',
|
|
860
|
-
'[testing-env/0] shell: "feature1" setup',
|
|
861
|
-
'[testing-env/0/feature1] feature setup',
|
|
862
|
-
'[testing-env/0] shell: "feature2" setup',
|
|
863
|
-
'[testing-env/0/feature2] feature setup',
|
|
864
|
-
'[testing-env/0] created -> ready',
|
|
865
|
-
'[testing-env/0] sandbox started',
|
|
866
|
-
'[testing-env/0] ready -> acquired',
|
|
867
|
-
'[testing-env/0] acquired -> setting_up',
|
|
868
|
-
'[testing-env/0/session1] shell: "feature1" setup session',
|
|
869
|
-
'[testing-env/0/feature1] feature setup session',
|
|
870
|
-
'[testing-env/0/session1] shell: "feature2" setup session',
|
|
871
|
-
'[testing-env/0/feature2] feature setup session',
|
|
872
|
-
'[testing-env/0] setting_up -> in_session',
|
|
873
|
-
"[testing-env/0] session 'session1' started",
|
|
874
|
-
'[testing-env/0/session1] shell: echo "hello"',
|
|
875
|
-
'[testing-env/0] in_session -> exiting_session',
|
|
876
|
-
'[testing-env/0/feature1] feature teardown session with ValueError', # pylint: disable=line-too-long
|
|
877
|
-
'[testing-env/0/session1] shell: "feature2" teardown session',
|
|
878
|
-
'[testing-env/0/feature2] feature teardown session',
|
|
879
|
-
"[testing-env/0] session 'session1' ended",
|
|
880
|
-
'[testing-env/0] exiting_session -> acquired',
|
|
881
|
-
'[testing-env/0] acquired -> shutting_down',
|
|
882
|
-
'[testing-env/0] shell: "feature1" teardown',
|
|
883
|
-
'[testing-env/0/feature1] feature teardown',
|
|
884
|
-
'[testing-env/0] shell: "feature2" teardown',
|
|
885
|
-
'[testing-env/0/feature2] feature teardown',
|
|
886
|
-
'[testing-env/0] shutting_down -> offline',
|
|
887
|
-
'[testing-env/0] sandbox shutdown'
|
|
1067
|
+
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
1068
|
+
'[testing-env/test_image:0/feature1] feature setup',
|
|
1069
|
+
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
1070
|
+
'[testing-env/test_image:0/feature2] feature setup',
|
|
1071
|
+
'[testing-env/test_image:0] created -> ready',
|
|
1072
|
+
'[testing-env/test_image:0] sandbox started',
|
|
1073
|
+
'[testing-env/test_image:0] ready -> acquired',
|
|
1074
|
+
'[testing-env/test_image:0] acquired -> setting_up',
|
|
1075
|
+
'[testing-env/test_image:0/session1] shell: "feature1" setup session',
|
|
1076
|
+
'[testing-env/test_image:0/feature1] feature setup session',
|
|
1077
|
+
'[testing-env/test_image:0/session1] shell: "feature2" setup session',
|
|
1078
|
+
'[testing-env/test_image:0/feature2] feature setup session',
|
|
1079
|
+
'[testing-env/test_image:0] setting_up -> in_session',
|
|
1080
|
+
"[testing-env/test_image:0] session 'session1' started",
|
|
1081
|
+
'[testing-env/test_image:0/session1] shell: echo "hello"',
|
|
1082
|
+
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
1083
|
+
'[testing-env/test_image:0/feature1] feature teardown session with ValueError', # pylint: disable=line-too-long
|
|
1084
|
+
'[testing-env/test_image:0/session1] shell: "feature2" teardown session',
|
|
1085
|
+
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
1086
|
+
"[testing-env/test_image:0] session 'session1' ended",
|
|
1087
|
+
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
1088
|
+
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
1089
|
+
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
1090
|
+
'[testing-env/test_image:0/feature1] feature teardown',
|
|
1091
|
+
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
1092
|
+
'[testing-env/test_image:0/feature2] feature teardown',
|
|
1093
|
+
'[testing-env/test_image:0] shutting_down -> offline',
|
|
1094
|
+
'[testing-env/test_image:0] sandbox shutdown'
|
|
1095
|
+
# pylint: enable=line-too-long
|
|
888
1096
|
]
|
|
889
1097
|
)
|
|
890
1098
|
|
|
@@ -898,42 +1106,44 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
898
1106
|
},
|
|
899
1107
|
)
|
|
900
1108
|
with env:
|
|
901
|
-
with env.sandbox('session1') as sb:
|
|
1109
|
+
with env.sandbox(session_id='session1') as sb:
|
|
902
1110
|
sb.shell('echo "hello"')
|
|
903
1111
|
self.assertEqual(len(sb.state_errors), 1)
|
|
904
1112
|
self.assertEqual(sb.status, interface.Sandbox.Status.OFFLINE)
|
|
905
1113
|
self.assertEqual(
|
|
906
1114
|
self.event_handler.logs,
|
|
907
1115
|
[
|
|
1116
|
+
# pylint: disable=line-too-long
|
|
908
1117
|
'[testing-env] environment started',
|
|
909
|
-
'[testing-env/0] shell: "feature1" setup',
|
|
910
|
-
'[testing-env/0/feature1] feature setup',
|
|
911
|
-
'[testing-env/0] shell: "feature2" setup',
|
|
912
|
-
'[testing-env/0/feature2] feature setup',
|
|
913
|
-
'[testing-env/0] created -> ready',
|
|
914
|
-
'[testing-env/0] sandbox started',
|
|
915
|
-
'[testing-env/0] ready -> acquired',
|
|
916
|
-
'[testing-env/0] acquired -> setting_up',
|
|
917
|
-
'[testing-env/0/session1] shell: "feature1" setup session',
|
|
918
|
-
'[testing-env/0/feature1] feature setup session',
|
|
919
|
-
'[testing-env/0/session1] shell: "feature2" setup session',
|
|
920
|
-
'[testing-env/0/feature2] feature setup session',
|
|
921
|
-
'[testing-env/0] setting_up -> in_session',
|
|
922
|
-
"[testing-env/0] session 'session1' started",
|
|
923
|
-
'[testing-env/0/session1] shell: echo "hello"',
|
|
924
|
-
'[testing-env/0] in_session -> exiting_session',
|
|
925
|
-
'[testing-env/0/feature1] feature teardown session with SandboxStateError', # pylint: disable=line-too-long
|
|
926
|
-
'[testing-env/0/session1] shell: "feature2" teardown session',
|
|
927
|
-
'[testing-env/0/feature2] feature teardown session',
|
|
928
|
-
"[testing-env/0] session 'session1' ended with SandboxStateError",
|
|
929
|
-
'[testing-env/0] exiting_session -> acquired',
|
|
930
|
-
'[testing-env/0] acquired -> shutting_down',
|
|
931
|
-
'[testing-env/0] shell: "feature1" teardown',
|
|
932
|
-
'[testing-env/0/feature1] feature teardown',
|
|
933
|
-
'[testing-env/0] shell: "feature2" teardown',
|
|
934
|
-
'[testing-env/0/feature2] feature teardown',
|
|
935
|
-
'[testing-env/0] shutting_down -> offline',
|
|
936
|
-
'[testing-env/0] sandbox shutdown'
|
|
1118
|
+
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
1119
|
+
'[testing-env/test_image:0/feature1] feature setup',
|
|
1120
|
+
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
1121
|
+
'[testing-env/test_image:0/feature2] feature setup',
|
|
1122
|
+
'[testing-env/test_image:0] created -> ready',
|
|
1123
|
+
'[testing-env/test_image:0] sandbox started',
|
|
1124
|
+
'[testing-env/test_image:0] ready -> acquired',
|
|
1125
|
+
'[testing-env/test_image:0] acquired -> setting_up',
|
|
1126
|
+
'[testing-env/test_image:0/session1] shell: "feature1" setup session',
|
|
1127
|
+
'[testing-env/test_image:0/feature1] feature setup session',
|
|
1128
|
+
'[testing-env/test_image:0/session1] shell: "feature2" setup session',
|
|
1129
|
+
'[testing-env/test_image:0/feature2] feature setup session',
|
|
1130
|
+
'[testing-env/test_image:0] setting_up -> in_session',
|
|
1131
|
+
"[testing-env/test_image:0] session 'session1' started",
|
|
1132
|
+
'[testing-env/test_image:0/session1] shell: echo "hello"',
|
|
1133
|
+
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
1134
|
+
'[testing-env/test_image:0/feature1] feature teardown session with SandboxStateError', # pylint: disable=line-too-long
|
|
1135
|
+
'[testing-env/test_image:0/session1] shell: "feature2" teardown session',
|
|
1136
|
+
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
1137
|
+
"[testing-env/test_image:0] session 'session1' ended with SandboxStateError",
|
|
1138
|
+
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
1139
|
+
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
1140
|
+
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
1141
|
+
'[testing-env/test_image:0/feature1] feature teardown',
|
|
1142
|
+
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
1143
|
+
'[testing-env/test_image:0/feature2] feature teardown',
|
|
1144
|
+
'[testing-env/test_image:0] shutting_down -> offline',
|
|
1145
|
+
'[testing-env/test_image:0] sandbox shutdown'
|
|
1146
|
+
# pylint: enable=line-too-long
|
|
937
1147
|
]
|
|
938
1148
|
)
|
|
939
1149
|
|
|
@@ -947,41 +1157,43 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
947
1157
|
},
|
|
948
1158
|
)
|
|
949
1159
|
with env:
|
|
950
|
-
with env.sandbox('session1') as sb:
|
|
1160
|
+
with env.sandbox(session_id='session1') as sb:
|
|
951
1161
|
sb.shell('echo "hello"')
|
|
952
1162
|
self.assertEqual(
|
|
953
1163
|
self.event_handler.logs,
|
|
954
1164
|
[
|
|
1165
|
+
# pylint: disable=line-too-long
|
|
955
1166
|
'[testing-env] environment started',
|
|
956
|
-
'[testing-env/0] shell: "feature1" setup',
|
|
957
|
-
'[testing-env/0/feature1] feature setup',
|
|
958
|
-
'[testing-env/0] shell: "feature2" setup',
|
|
959
|
-
'[testing-env/0/feature2] feature setup',
|
|
960
|
-
'[testing-env/0] created -> ready',
|
|
961
|
-
'[testing-env/0] sandbox started',
|
|
962
|
-
'[testing-env/0] ready -> acquired',
|
|
963
|
-
'[testing-env/0] acquired -> setting_up',
|
|
964
|
-
'[testing-env/0/session1] shell: "feature1" setup session',
|
|
965
|
-
'[testing-env/0/feature1] feature setup session',
|
|
966
|
-
'[testing-env/0/session1] shell: "feature2" setup session',
|
|
967
|
-
'[testing-env/0/feature2] feature setup session',
|
|
968
|
-
'[testing-env/0] setting_up -> in_session',
|
|
969
|
-
"[testing-env/0] session 'session1' started",
|
|
970
|
-
'[testing-env/0/session1] shell: echo "hello"',
|
|
971
|
-
'[testing-env/0] in_session -> exiting_session',
|
|
972
|
-
'[testing-env/0/session1] shell: "feature1" teardown session',
|
|
973
|
-
'[testing-env/0/feature1] feature teardown session',
|
|
974
|
-
'[testing-env/0/session1] shell: "feature2" teardown session',
|
|
975
|
-
'[testing-env/0/feature2] feature teardown session',
|
|
976
|
-
"[testing-env/0] session 'session1' ended",
|
|
977
|
-
'[testing-env/0] exiting_session -> acquired',
|
|
978
|
-
'[testing-env/0] acquired -> shutting_down',
|
|
979
|
-
'[testing-env/0] shell: "feature1" teardown',
|
|
980
|
-
'[testing-env/0/feature1] feature teardown',
|
|
981
|
-
'[testing-env/0] shell: "feature2" teardown',
|
|
982
|
-
'[testing-env/0/feature2] feature teardown',
|
|
983
|
-
'[testing-env/0] shutting_down -> offline',
|
|
984
|
-
'[testing-env/0] sandbox shutdown'
|
|
1167
|
+
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
1168
|
+
'[testing-env/test_image:0/feature1] feature setup',
|
|
1169
|
+
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
1170
|
+
'[testing-env/test_image:0/feature2] feature setup',
|
|
1171
|
+
'[testing-env/test_image:0] created -> ready',
|
|
1172
|
+
'[testing-env/test_image:0] sandbox started',
|
|
1173
|
+
'[testing-env/test_image:0] ready -> acquired',
|
|
1174
|
+
'[testing-env/test_image:0] acquired -> setting_up',
|
|
1175
|
+
'[testing-env/test_image:0/session1] shell: "feature1" setup session',
|
|
1176
|
+
'[testing-env/test_image:0/feature1] feature setup session',
|
|
1177
|
+
'[testing-env/test_image:0/session1] shell: "feature2" setup session',
|
|
1178
|
+
'[testing-env/test_image:0/feature2] feature setup session',
|
|
1179
|
+
'[testing-env/test_image:0] setting_up -> in_session',
|
|
1180
|
+
"[testing-env/test_image:0] session 'session1' started",
|
|
1181
|
+
'[testing-env/test_image:0/session1] shell: echo "hello"',
|
|
1182
|
+
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
1183
|
+
'[testing-env/test_image:0/session1] shell: "feature1" teardown session',
|
|
1184
|
+
'[testing-env/test_image:0/feature1] feature teardown session',
|
|
1185
|
+
'[testing-env/test_image:0/session1] shell: "feature2" teardown session',
|
|
1186
|
+
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
1187
|
+
"[testing-env/test_image:0] session 'session1' ended",
|
|
1188
|
+
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
1189
|
+
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
1190
|
+
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
1191
|
+
'[testing-env/test_image:0/feature1] feature teardown',
|
|
1192
|
+
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
1193
|
+
'[testing-env/test_image:0/feature2] feature teardown',
|
|
1194
|
+
'[testing-env/test_image:0] shutting_down -> offline',
|
|
1195
|
+
'[testing-env/test_image:0] sandbox shutdown'
|
|
1196
|
+
# pylint: enable=line-too-long
|
|
985
1197
|
]
|
|
986
1198
|
)
|
|
987
1199
|
|
|
@@ -993,7 +1205,7 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
993
1205
|
},
|
|
994
1206
|
)
|
|
995
1207
|
with env:
|
|
996
|
-
with env.sandbox('session1') as sb:
|
|
1208
|
+
with env.sandbox(session_id='session1') as sb:
|
|
997
1209
|
with self.assertRaises(ValueError):
|
|
998
1210
|
sb.shell('echo foo', raise_error=ValueError)
|
|
999
1211
|
self.assertEqual(len(sb.state_errors), 0)
|
|
@@ -1004,27 +1216,29 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
1004
1216
|
self.assertEqual(
|
|
1005
1217
|
self.event_handler.logs,
|
|
1006
1218
|
[
|
|
1007
|
-
|
|
1008
|
-
'[testing-env/0:0
|
|
1009
|
-
'[testing-env/0:0]
|
|
1010
|
-
'[testing-env/0:0
|
|
1011
|
-
'[testing-env/0:0]
|
|
1012
|
-
'[testing-env/0:0]
|
|
1219
|
+
# pylint: disable=line-too-long
|
|
1220
|
+
'[testing-env/test_image:0:0] shell: "feature1" setup',
|
|
1221
|
+
'[testing-env/test_image:0:0/feature1] feature setup',
|
|
1222
|
+
'[testing-env/test_image:0:0] shell: "feature1" setup session',
|
|
1223
|
+
'[testing-env/test_image:0:0/feature1] feature setup session',
|
|
1224
|
+
'[testing-env/test_image:0:0] created -> ready',
|
|
1225
|
+
'[testing-env/test_image:0:0] sandbox started',
|
|
1013
1226
|
'[testing-env] environment started',
|
|
1014
|
-
'[testing-env/0:0] ready -> acquired',
|
|
1015
|
-
'[testing-env/0:0] acquired -> setting_up',
|
|
1016
|
-
'[testing-env/0:0] setting_up -> in_session',
|
|
1017
|
-
"[testing-env/0:0] session 'session1' started",
|
|
1018
|
-
'[testing-env/0:0/session1] shell: echo foo with ValueError',
|
|
1019
|
-
'[testing-env/0:0/session1] shell: echo bar',
|
|
1020
|
-
'[testing-env/0:0] in_session -> exiting_session',
|
|
1021
|
-
'[testing-env/0:0/session1] shell: "feature1" teardown session',
|
|
1022
|
-
'[testing-env/0:0/feature1] feature teardown session',
|
|
1023
|
-
"[testing-env/0:0] session 'session1' ended",
|
|
1024
|
-
'[testing-env/0:0] exiting_session -> setting_up',
|
|
1025
|
-
'[testing-env/0:0] shell: "feature1" setup session',
|
|
1026
|
-
'[testing-env/0:0/feature1] feature setup session',
|
|
1027
|
-
'[testing-env/0:0] setting_up -> ready',
|
|
1227
|
+
'[testing-env/test_image:0:0] ready -> acquired',
|
|
1228
|
+
'[testing-env/test_image:0:0] acquired -> setting_up',
|
|
1229
|
+
'[testing-env/test_image:0:0] setting_up -> in_session',
|
|
1230
|
+
"[testing-env/test_image:0:0] session 'session1' started",
|
|
1231
|
+
'[testing-env/test_image:0:0/session1] shell: echo foo with ValueError',
|
|
1232
|
+
'[testing-env/test_image:0:0/session1] shell: echo bar',
|
|
1233
|
+
'[testing-env/test_image:0:0] in_session -> exiting_session',
|
|
1234
|
+
'[testing-env/test_image:0:0/session1] shell: "feature1" teardown session',
|
|
1235
|
+
'[testing-env/test_image:0:0/feature1] feature teardown session',
|
|
1236
|
+
"[testing-env/test_image:0:0] session 'session1' ended",
|
|
1237
|
+
'[testing-env/test_image:0:0] exiting_session -> setting_up',
|
|
1238
|
+
'[testing-env/test_image:0:0] shell: "feature1" setup session',
|
|
1239
|
+
'[testing-env/test_image:0:0/feature1] feature setup session',
|
|
1240
|
+
'[testing-env/test_image:0:0] setting_up -> ready',
|
|
1241
|
+
# pylint: enable=line-too-long
|
|
1028
1242
|
]
|
|
1029
1243
|
)
|
|
1030
1244
|
|
|
@@ -1036,7 +1250,7 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
1036
1250
|
},
|
|
1037
1251
|
)
|
|
1038
1252
|
with env:
|
|
1039
|
-
with env.sandbox('session1') as sb:
|
|
1253
|
+
with env.sandbox(session_id='session1') as sb:
|
|
1040
1254
|
with self.assertRaises(interface.SandboxStateError):
|
|
1041
1255
|
sb.shell('echo foo', raise_error=RuntimeError)
|
|
1042
1256
|
self.assertEqual(len(sb.state_errors), 1)
|
|
@@ -1046,29 +1260,29 @@ class SandboxStatusTests(unittest.TestCase):
|
|
|
1046
1260
|
self.event_handler.logs,
|
|
1047
1261
|
[
|
|
1048
1262
|
# pylint: disable=line-too-long
|
|
1049
|
-
'[testing-env/0:0] shell: "feature1" setup',
|
|
1050
|
-
'[testing-env/0:0/feature1] feature setup',
|
|
1051
|
-
'[testing-env/0:0] shell: "feature1" setup session',
|
|
1052
|
-
'[testing-env/0:0/feature1] feature setup session',
|
|
1053
|
-
'[testing-env/0:0] created -> ready',
|
|
1054
|
-
'[testing-env/0:0] sandbox started',
|
|
1263
|
+
'[testing-env/test_image:0:0] shell: "feature1" setup',
|
|
1264
|
+
'[testing-env/test_image:0:0/feature1] feature setup',
|
|
1265
|
+
'[testing-env/test_image:0:0] shell: "feature1" setup session',
|
|
1266
|
+
'[testing-env/test_image:0:0/feature1] feature setup session',
|
|
1267
|
+
'[testing-env/test_image:0:0] created -> ready',
|
|
1268
|
+
'[testing-env/test_image:0:0] sandbox started',
|
|
1055
1269
|
'[testing-env] environment started',
|
|
1056
|
-
'[testing-env/0:0] ready -> acquired',
|
|
1057
|
-
'[testing-env/0:0] acquired -> setting_up',
|
|
1058
|
-
'[testing-env/0:0] setting_up -> in_session',
|
|
1059
|
-
"[testing-env/0:0] session 'session1' started",
|
|
1060
|
-
'[testing-env/0:0/session1] shell: echo foo with RuntimeError',
|
|
1061
|
-
'[testing-env/0:0] in_session -> exiting_session',
|
|
1062
|
-
'[testing-env/0:0/session1] shell: "feature1" teardown session',
|
|
1063
|
-
'[testing-env/0:0/feature1] feature teardown session',
|
|
1064
|
-
"[testing-env/0:0] session 'session1' ended with SandboxStateError",
|
|
1065
|
-
'[testing-env/0:0] exiting_session -> acquired',
|
|
1066
|
-
'[testing-env/0:0] acquired -> shutting_down',
|
|
1067
|
-
'[testing-env/0:0] shell: "feature1" teardown',
|
|
1068
|
-
'[testing-env/0:0/feature1] feature teardown',
|
|
1069
|
-
'[testing-env/0:0] shutting_down -> offline',
|
|
1070
|
-
'[testing-env/0:0] sandbox shutdown',
|
|
1071
|
-
'[testing-env/0:0] shell: echo bar',
|
|
1270
|
+
'[testing-env/test_image:0:0] ready -> acquired',
|
|
1271
|
+
'[testing-env/test_image:0:0] acquired -> setting_up',
|
|
1272
|
+
'[testing-env/test_image:0:0] setting_up -> in_session',
|
|
1273
|
+
"[testing-env/test_image:0:0] session 'session1' started",
|
|
1274
|
+
'[testing-env/test_image:0:0/session1] shell: echo foo with RuntimeError',
|
|
1275
|
+
'[testing-env/test_image:0:0] in_session -> exiting_session',
|
|
1276
|
+
'[testing-env/test_image:0:0/session1] shell: "feature1" teardown session',
|
|
1277
|
+
'[testing-env/test_image:0:0/feature1] feature teardown session',
|
|
1278
|
+
"[testing-env/test_image:0:0] session 'session1' ended with SandboxStateError",
|
|
1279
|
+
'[testing-env/test_image:0:0] exiting_session -> acquired',
|
|
1280
|
+
'[testing-env/test_image:0:0] acquired -> shutting_down',
|
|
1281
|
+
'[testing-env/test_image:0:0] shell: "feature1" teardown',
|
|
1282
|
+
'[testing-env/test_image:0:0/feature1] feature teardown',
|
|
1283
|
+
'[testing-env/test_image:0:0] shutting_down -> offline',
|
|
1284
|
+
'[testing-env/test_image:0:0] sandbox shutdown',
|
|
1285
|
+
'[testing-env/test_image:0:0] shell: echo bar',
|
|
1072
1286
|
# pylint: enable=line-too-long
|
|
1073
1287
|
]
|
|
1074
1288
|
)
|
|
@@ -1085,14 +1299,12 @@ class SandboxActivityTests(unittest.TestCase):
|
|
|
1085
1299
|
with env.sandbox() as sb:
|
|
1086
1300
|
self.assertRegex(sb.session_id, r'session-[0-9a-f]{7}')
|
|
1087
1301
|
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
r'session-[0-9a-f]{7}'
|
|
1095
|
-
)
|
|
1302
|
+
with env.test_feature() as test_feature:
|
|
1303
|
+
self.assertIsInstance(test_feature, TestingFeature)
|
|
1304
|
+
self.assertRegex(
|
|
1305
|
+
test_feature.session_id,
|
|
1306
|
+
r'test_feature-session-[0-9a-f]{7}'
|
|
1307
|
+
)
|
|
1096
1308
|
|
|
1097
1309
|
with self.assertRaisesRegex(ValueError, '`session_id` should not be used'):
|
|
1098
1310
|
@base_sandbox.sandbox_service()
|
|
@@ -1106,13 +1318,13 @@ class SandboxActivityTests(unittest.TestCase):
|
|
|
1106
1318
|
sandbox_keepalive_interval=0,
|
|
1107
1319
|
)
|
|
1108
1320
|
with env:
|
|
1109
|
-
with env.sandbox('session1') as sb:
|
|
1321
|
+
with env.sandbox(session_id='session1') as sb:
|
|
1110
1322
|
sb.rebind(
|
|
1111
1323
|
simulate_ping_error=interface.SandboxStateError,
|
|
1112
1324
|
skip_notification=True
|
|
1113
1325
|
)
|
|
1114
1326
|
sb.wait_until_next_housekeep()
|
|
1115
|
-
self.
|
|
1327
|
+
self.assertIn(sb.status, (sb.Status.SHUTTING_DOWN, sb.Status.OFFLINE))
|
|
1116
1328
|
|
|
1117
1329
|
def test_housekeep_error(self):
|
|
1118
1330
|
event_handler = TestingEventHandler(log_housekeep=False)
|
|
@@ -1126,7 +1338,7 @@ class SandboxActivityTests(unittest.TestCase):
|
|
|
1126
1338
|
event_handlers=[event_handler],
|
|
1127
1339
|
)
|
|
1128
1340
|
with env:
|
|
1129
|
-
with env.sandbox('session1') as sb:
|
|
1341
|
+
with env.sandbox(session_id='session1') as sb:
|
|
1130
1342
|
self.assertEqual(len(env.sandbox_pool), 1)
|
|
1131
1343
|
self.assertEqual(sb.status, interface.Sandbox.Status.IN_SESSION)
|
|
1132
1344
|
self.assertEqual(sb.session_id, 'session1')
|
|
@@ -1139,30 +1351,33 @@ class SandboxActivityTests(unittest.TestCase):
|
|
|
1139
1351
|
sb.status == interface.Sandbox.Status.IN_SESSION
|
|
1140
1352
|
):
|
|
1141
1353
|
time.sleep(0.01)
|
|
1354
|
+
time.sleep(1.0)
|
|
1142
1355
|
self.assertEqual(sb.status, interface.Sandbox.Status.OFFLINE)
|
|
1143
1356
|
env.wait_for_housekeeping()
|
|
1144
1357
|
self.assertEqual(
|
|
1145
1358
|
event_handler.logs,
|
|
1146
1359
|
[
|
|
1147
|
-
|
|
1148
|
-
'[testing-env/0:0
|
|
1149
|
-
'[testing-env/0:0]
|
|
1150
|
-
'[testing-env/0:0]
|
|
1360
|
+
# pylint: disable=line-too-long
|
|
1361
|
+
'[testing-env/test_image:0:0] shell: "test_feature" setup',
|
|
1362
|
+
'[testing-env/test_image:0:0/test_feature] feature setup',
|
|
1363
|
+
'[testing-env/test_image:0:0] shell: "test_feature" setup session',
|
|
1364
|
+
'[testing-env/test_image:0:0] sandbox started',
|
|
1151
1365
|
'[testing-env] environment started',
|
|
1152
|
-
"[testing-env/0:0] session 'session1' started",
|
|
1153
|
-
'[testing-env/0:0/session1] shell: "test_feature" teardown session',
|
|
1154
|
-
"[testing-env/0:0] session 'session1' ended with SandboxStateError",
|
|
1155
|
-
'[testing-env/0:0] shell: "test_feature" teardown',
|
|
1156
|
-
'[testing-env/0:0/test_feature] feature teardown',
|
|
1157
|
-
'[testing-env/0:0] sandbox shutdown',
|
|
1158
|
-
'[testing-env/0:1] shell: "test_feature" setup',
|
|
1159
|
-
'[testing-env/0:1/test_feature] feature setup',
|
|
1160
|
-
'[testing-env/0:1] shell: "test_feature" setup session',
|
|
1161
|
-
'[testing-env/0:1] sandbox started',
|
|
1162
|
-
'[testing-env/0:1] shell: "test_feature" teardown',
|
|
1163
|
-
'[testing-env/0:1/test_feature] feature teardown',
|
|
1164
|
-
'[testing-env/0:1] sandbox shutdown',
|
|
1366
|
+
"[testing-env/test_image:0:0] session 'session1' started",
|
|
1367
|
+
'[testing-env/test_image:0:0/session1] shell: "test_feature" teardown session',
|
|
1368
|
+
"[testing-env/test_image:0:0] session 'session1' ended with SandboxStateError",
|
|
1369
|
+
'[testing-env/test_image:0:0] shell: "test_feature" teardown',
|
|
1370
|
+
'[testing-env/test_image:0:0/test_feature] feature teardown',
|
|
1371
|
+
'[testing-env/test_image:0:0] sandbox shutdown',
|
|
1372
|
+
'[testing-env/test_image:0:1] shell: "test_feature" setup',
|
|
1373
|
+
'[testing-env/test_image:0:1/test_feature] feature setup',
|
|
1374
|
+
'[testing-env/test_image:0:1] shell: "test_feature" setup session',
|
|
1375
|
+
'[testing-env/test_image:0:1] sandbox started',
|
|
1376
|
+
'[testing-env/test_image:0:1] shell: "test_feature" teardown',
|
|
1377
|
+
'[testing-env/test_image:0:1/test_feature] feature teardown',
|
|
1378
|
+
'[testing-env/test_image:0:1] sandbox shutdown',
|
|
1165
1379
|
'[testing-env] environment shutdown'
|
|
1380
|
+
# pylint: enable=line-too-long
|
|
1166
1381
|
]
|
|
1167
1382
|
)
|
|
1168
1383
|
|
|
@@ -1176,14 +1391,14 @@ class SandboxActivityTests(unittest.TestCase):
|
|
|
1176
1391
|
)
|
|
1177
1392
|
event_handler = TestingEventHandler()
|
|
1178
1393
|
with env:
|
|
1179
|
-
with env.sandbox('session1') as sb:
|
|
1394
|
+
with env.sandbox(session_id='session1') as sb:
|
|
1180
1395
|
sb.add_event_handler(event_handler)
|
|
1181
1396
|
sb.shell('test_feature')
|
|
1182
1397
|
sb.remove_event_handler(event_handler)
|
|
1183
1398
|
events = list(event_handler.logs)
|
|
1184
1399
|
sb.wait_until_not(interface.Sandbox.Status.SETTING_UP)
|
|
1185
1400
|
self.assertGreater(len(events), 0)
|
|
1186
|
-
with env.sandbox('session2') as sb:
|
|
1401
|
+
with env.sandbox(session_id='session2') as sb:
|
|
1187
1402
|
sb.shell('test_feature')
|
|
1188
1403
|
self.assertEqual(len(events), len(event_handler.logs))
|
|
1189
1404
|
|
|
@@ -1230,9 +1445,8 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1230
1445
|
event_handlers=[event_handler],
|
|
1231
1446
|
)
|
|
1232
1447
|
with env:
|
|
1233
|
-
env.test_feature
|
|
1234
|
-
|
|
1235
|
-
)
|
|
1448
|
+
with env.test_feature(session_id='session1') as test_feature:
|
|
1449
|
+
test_feature.call_with_varargs('sum', 1, 2, debug=True)
|
|
1236
1450
|
self.assertEqual(
|
|
1237
1451
|
event_handler.calls,
|
|
1238
1452
|
[
|
|
@@ -1246,7 +1460,7 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1246
1460
|
|
|
1247
1461
|
def test_service_call_from_feature(self):
|
|
1248
1462
|
with self.env:
|
|
1249
|
-
with self.env.sandbox('session1') as sb:
|
|
1463
|
+
with self.env.sandbox(session_id='session1') as sb:
|
|
1250
1464
|
self.assertEqual(sb.test_feature.num_shell_calls(), 2)
|
|
1251
1465
|
self.assertEqual(sb.test_feature.num_shell_calls(), 2)
|
|
1252
1466
|
self.assertEqual(
|
|
@@ -1254,18 +1468,18 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1254
1468
|
[
|
|
1255
1469
|
# pylint: disable=line-too-long
|
|
1256
1470
|
'[testing-env] environment started',
|
|
1257
|
-
'[testing-env/0] shell: "test_feature" setup',
|
|
1258
|
-
'[testing-env/0/test_feature] feature setup',
|
|
1259
|
-
'[testing-env/0] sandbox started',
|
|
1260
|
-
'[testing-env/0/session1] shell: "test_feature" setup session',
|
|
1261
|
-
"[testing-env/0] session 'session1' started",
|
|
1262
|
-
'[testing-env/0/session1/test_feature] test_feature.num_shell_calls: None',
|
|
1263
|
-
'[testing-env/0/session1/test_feature] test_feature.num_shell_calls: None',
|
|
1264
|
-
'[testing-env/0/session1] shell: "test_feature" teardown session',
|
|
1265
|
-
"[testing-env/0] session 'session1' ended",
|
|
1266
|
-
'[testing-env/0] shell: "test_feature" teardown',
|
|
1267
|
-
'[testing-env/0/test_feature] feature teardown',
|
|
1268
|
-
'[testing-env/0] sandbox shutdown',
|
|
1471
|
+
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1472
|
+
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1473
|
+
'[testing-env/test_image:0] sandbox started',
|
|
1474
|
+
'[testing-env/test_image:0/session1] shell: "test_feature" setup session',
|
|
1475
|
+
"[testing-env/test_image:0] session 'session1' started",
|
|
1476
|
+
'[testing-env/test_image:0/session1/test_feature] test_feature.num_shell_calls: None',
|
|
1477
|
+
'[testing-env/test_image:0/session1/test_feature] test_feature.num_shell_calls: None',
|
|
1478
|
+
'[testing-env/test_image:0/session1] shell: "test_feature" teardown session',
|
|
1479
|
+
"[testing-env/test_image:0] session 'session1' ended",
|
|
1480
|
+
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1481
|
+
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1482
|
+
'[testing-env/test_image:0] sandbox shutdown',
|
|
1269
1483
|
'[testing-env] environment shutdown'
|
|
1270
1484
|
# pylint: enable=line-too-long
|
|
1271
1485
|
]
|
|
@@ -1273,7 +1487,7 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1273
1487
|
|
|
1274
1488
|
def test_service_call_from_feature_with_error(self):
|
|
1275
1489
|
with self.env:
|
|
1276
|
-
with self.env.sandbox('session1') as sb:
|
|
1490
|
+
with self.env.sandbox(session_id='session1') as sb:
|
|
1277
1491
|
with self.assertRaises(interface.SandboxStateError):
|
|
1278
1492
|
sb.test_feature.bad_shell_call()
|
|
1279
1493
|
self.assertEqual(sb.status, interface.Sandbox.Status.OFFLINE)
|
|
@@ -1283,18 +1497,18 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1283
1497
|
[
|
|
1284
1498
|
# pylint: disable=line-too-long
|
|
1285
1499
|
'[testing-env] environment started',
|
|
1286
|
-
'[testing-env/0] shell: "test_feature" setup',
|
|
1287
|
-
'[testing-env/0/test_feature] feature setup',
|
|
1288
|
-
'[testing-env/0] sandbox started',
|
|
1289
|
-
'[testing-env/0/session1] shell: "test_feature" setup session',
|
|
1290
|
-
"[testing-env/0] session 'session1' started",
|
|
1291
|
-
'[testing-env/0/session1] shell: bad command with RuntimeError',
|
|
1292
|
-
'[testing-env/0/session1/test_feature] test_feature.bad_shell_call: None with SandboxStateError',
|
|
1293
|
-
'[testing-env/0/session1] shell: "test_feature" teardown session',
|
|
1294
|
-
"[testing-env/0] session 'session1' ended with SandboxStateError",
|
|
1295
|
-
'[testing-env/0] shell: "test_feature" teardown',
|
|
1296
|
-
'[testing-env/0/test_feature] feature teardown',
|
|
1297
|
-
'[testing-env/0] sandbox shutdown',
|
|
1500
|
+
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1501
|
+
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1502
|
+
'[testing-env/test_image:0] sandbox started',
|
|
1503
|
+
'[testing-env/test_image:0/session1] shell: "test_feature" setup session',
|
|
1504
|
+
"[testing-env/test_image:0] session 'session1' started",
|
|
1505
|
+
'[testing-env/test_image:0/session1] shell: bad command with RuntimeError',
|
|
1506
|
+
'[testing-env/test_image:0/session1/test_feature] test_feature.bad_shell_call: None with SandboxStateError',
|
|
1507
|
+
'[testing-env/test_image:0/session1] shell: "test_feature" teardown session',
|
|
1508
|
+
"[testing-env/test_image:0] session 'session1' ended with SandboxStateError",
|
|
1509
|
+
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1510
|
+
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1511
|
+
'[testing-env/test_image:0] sandbox shutdown',
|
|
1298
1512
|
'[testing-env] environment shutdown'
|
|
1299
1513
|
# pylint: enable=line-too-long
|
|
1300
1514
|
]
|
|
@@ -1302,23 +1516,24 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1302
1516
|
|
|
1303
1517
|
def test_service_call_from_environment(self):
|
|
1304
1518
|
with self.env:
|
|
1305
|
-
self.
|
|
1519
|
+
with self.env.test_feature() as test_feature:
|
|
1520
|
+
self.assertEqual(test_feature.num_shell_calls(), 2)
|
|
1306
1521
|
self.assertEqual(
|
|
1307
1522
|
self.event_handler.logs,
|
|
1308
1523
|
[
|
|
1309
1524
|
# pylint: disable=line-too-long
|
|
1310
1525
|
'[testing-env] environment started',
|
|
1311
|
-
'[testing-env/0] shell: "test_feature" setup',
|
|
1312
|
-
'[testing-env/0/test_feature] feature setup',
|
|
1313
|
-
'[testing-env/0] sandbox started',
|
|
1314
|
-
'[testing-env/0/session-2291d8c] shell: "test_feature" setup session',
|
|
1315
|
-
"[testing-env/0] session 'session-2291d8c' started",
|
|
1316
|
-
'[testing-env/0/session-2291d8c/test_feature] test_feature.num_shell_calls: None',
|
|
1317
|
-
'[testing-env/0/session-2291d8c] shell: "test_feature" teardown session',
|
|
1318
|
-
"[testing-env/0] session 'session-2291d8c' ended",
|
|
1319
|
-
'[testing-env/0] shell: "test_feature" teardown',
|
|
1320
|
-
'[testing-env/0/test_feature] feature teardown',
|
|
1321
|
-
'[testing-env/0] sandbox shutdown',
|
|
1526
|
+
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1527
|
+
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1528
|
+
'[testing-env/test_image:0] sandbox started',
|
|
1529
|
+
'[testing-env/test_image:0/test_feature-session-2291d8c] shell: "test_feature" setup session',
|
|
1530
|
+
"[testing-env/test_image:0] session 'test_feature-session-2291d8c' started",
|
|
1531
|
+
'[testing-env/test_image:0/test_feature-session-2291d8c/test_feature] test_feature.num_shell_calls: None',
|
|
1532
|
+
'[testing-env/test_image:0/test_feature-session-2291d8c] shell: "test_feature" teardown session',
|
|
1533
|
+
"[testing-env/test_image:0] session 'test_feature-session-2291d8c' ended",
|
|
1534
|
+
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1535
|
+
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1536
|
+
'[testing-env/test_image:0] sandbox shutdown',
|
|
1322
1537
|
'[testing-env] environment shutdown'
|
|
1323
1538
|
# pylint: enable=line-too-long
|
|
1324
1539
|
]
|
|
@@ -1327,24 +1542,25 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1327
1542
|
def test_service_call_from_environment_with_error(self):
|
|
1328
1543
|
with self.env:
|
|
1329
1544
|
with self.assertRaises(interface.SandboxStateError):
|
|
1330
|
-
self.env.test_feature
|
|
1545
|
+
with self.env.test_feature(session_id='session1') as test_feature:
|
|
1546
|
+
test_feature.bad_shell_call()
|
|
1331
1547
|
self.assertEqual(
|
|
1332
1548
|
self.event_handler.logs,
|
|
1333
1549
|
[
|
|
1334
1550
|
# pylint: disable=line-too-long
|
|
1335
1551
|
'[testing-env] environment started',
|
|
1336
|
-
'[testing-env/0] shell: "test_feature" setup',
|
|
1337
|
-
'[testing-env/0/test_feature] feature setup',
|
|
1338
|
-
'[testing-env/0] sandbox started',
|
|
1339
|
-
'[testing-env/0/session1] shell: "test_feature" setup session',
|
|
1340
|
-
"[testing-env/0] session 'session1' started",
|
|
1341
|
-
'[testing-env/0/session1] shell: bad command with RuntimeError',
|
|
1342
|
-
'[testing-env/0/session1/test_feature] test_feature.bad_shell_call: None with SandboxStateError',
|
|
1343
|
-
'[testing-env/0/session1] shell: "test_feature" teardown session',
|
|
1344
|
-
"[testing-env/0] session 'session1' ended with SandboxStateError",
|
|
1345
|
-
'[testing-env/0] shell: "test_feature" teardown',
|
|
1346
|
-
'[testing-env/0/test_feature] feature teardown',
|
|
1347
|
-
'[testing-env/0] sandbox shutdown',
|
|
1552
|
+
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1553
|
+
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1554
|
+
'[testing-env/test_image:0] sandbox started',
|
|
1555
|
+
'[testing-env/test_image:0/session1] shell: "test_feature" setup session',
|
|
1556
|
+
"[testing-env/test_image:0] session 'session1' started",
|
|
1557
|
+
'[testing-env/test_image:0/session1] shell: bad command with RuntimeError',
|
|
1558
|
+
'[testing-env/test_image:0/session1/test_feature] test_feature.bad_shell_call: None with SandboxStateError',
|
|
1559
|
+
'[testing-env/test_image:0/session1] shell: "test_feature" teardown session',
|
|
1560
|
+
"[testing-env/test_image:0] session 'session1' ended with SandboxStateError",
|
|
1561
|
+
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1562
|
+
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1563
|
+
'[testing-env/test_image:0] sandbox shutdown',
|
|
1348
1564
|
'[testing-env] environment shutdown'
|
|
1349
1565
|
# pylint: enable=line-too-long
|
|
1350
1566
|
]
|
|
@@ -1352,7 +1568,7 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1352
1568
|
|
|
1353
1569
|
def test_service_context_manager_from_feature(self):
|
|
1354
1570
|
with self.env:
|
|
1355
|
-
with self.env.sandbox('session1') as sb:
|
|
1571
|
+
with self.env.sandbox(session_id='session1') as sb:
|
|
1356
1572
|
with sb.test_feature.my_service() as service:
|
|
1357
1573
|
service.do('hello')
|
|
1358
1574
|
sb.shell('foo')
|
|
@@ -1362,19 +1578,19 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1362
1578
|
[
|
|
1363
1579
|
# pylint: disable=line-too-long
|
|
1364
1580
|
'[testing-env] environment started',
|
|
1365
|
-
'[testing-env/0] shell: "test_feature" setup',
|
|
1366
|
-
'[testing-env/0/test_feature] feature setup',
|
|
1367
|
-
'[testing-env/0] sandbox started',
|
|
1368
|
-
'[testing-env/0/session1] shell: "test_feature" setup session',
|
|
1369
|
-
"[testing-env/0] session 'session1' started",
|
|
1370
|
-
'[testing-env/0/session1] shell: hello',
|
|
1371
|
-
'[testing-env/0/session1/test_feature] test_feature.my_service: None',
|
|
1372
|
-
'[testing-env/0/session1] shell: foo',
|
|
1373
|
-
'[testing-env/0/session1] shell: "test_feature" teardown session',
|
|
1374
|
-
"[testing-env/0] session 'session1' ended",
|
|
1375
|
-
'[testing-env/0] shell: "test_feature" teardown',
|
|
1376
|
-
'[testing-env/0/test_feature] feature teardown',
|
|
1377
|
-
'[testing-env/0] sandbox shutdown',
|
|
1581
|
+
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1582
|
+
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1583
|
+
'[testing-env/test_image:0] sandbox started',
|
|
1584
|
+
'[testing-env/test_image:0/session1] shell: "test_feature" setup session',
|
|
1585
|
+
"[testing-env/test_image:0] session 'session1' started",
|
|
1586
|
+
'[testing-env/test_image:0/session1] shell: hello',
|
|
1587
|
+
'[testing-env/test_image:0/session1/test_feature] test_feature.my_service: None',
|
|
1588
|
+
'[testing-env/test_image:0/session1] shell: foo',
|
|
1589
|
+
'[testing-env/test_image:0/session1] shell: "test_feature" teardown session',
|
|
1590
|
+
"[testing-env/test_image:0] session 'session1' ended",
|
|
1591
|
+
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1592
|
+
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1593
|
+
'[testing-env/test_image:0] sandbox shutdown',
|
|
1378
1594
|
'[testing-env] environment shutdown'
|
|
1379
1595
|
# pylint: enable=line-too-long
|
|
1380
1596
|
]
|
|
@@ -1382,7 +1598,7 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1382
1598
|
|
|
1383
1599
|
def test_service_context_manager_from_feature_with_error(self):
|
|
1384
1600
|
with self.env:
|
|
1385
|
-
with self.env.sandbox('session1') as sb:
|
|
1601
|
+
with self.env.sandbox(session_id='session1') as sb:
|
|
1386
1602
|
with self.assertRaises(interface.SandboxStateError):
|
|
1387
1603
|
with sb.test_feature.my_service() as service:
|
|
1388
1604
|
service.do('hello', raise_error=interface.SandboxStateError)
|
|
@@ -1392,18 +1608,18 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1392
1608
|
[
|
|
1393
1609
|
# pylint: disable=line-too-long
|
|
1394
1610
|
'[testing-env] environment started',
|
|
1395
|
-
'[testing-env/0] shell: "test_feature" setup',
|
|
1396
|
-
'[testing-env/0/test_feature] feature setup',
|
|
1397
|
-
'[testing-env/0] sandbox started',
|
|
1398
|
-
'[testing-env/0/session1] shell: "test_feature" setup session',
|
|
1399
|
-
"[testing-env/0] session 'session1' started",
|
|
1400
|
-
'[testing-env/0/session1] shell: hello with SandboxStateError',
|
|
1401
|
-
'[testing-env/0/session1/test_feature] test_feature.my_service: None with SandboxStateError',
|
|
1402
|
-
'[testing-env/0/session1] shell: "test_feature" teardown session',
|
|
1403
|
-
"[testing-env/0] session 'session1' ended with SandboxStateError",
|
|
1404
|
-
'[testing-env/0] shell: "test_feature" teardown',
|
|
1405
|
-
'[testing-env/0/test_feature] feature teardown',
|
|
1406
|
-
'[testing-env/0] sandbox shutdown',
|
|
1611
|
+
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1612
|
+
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1613
|
+
'[testing-env/test_image:0] sandbox started',
|
|
1614
|
+
'[testing-env/test_image:0/session1] shell: "test_feature" setup session',
|
|
1615
|
+
"[testing-env/test_image:0] session 'session1' started",
|
|
1616
|
+
'[testing-env/test_image:0/session1] shell: hello with SandboxStateError',
|
|
1617
|
+
'[testing-env/test_image:0/session1/test_feature] test_feature.my_service: None with SandboxStateError',
|
|
1618
|
+
'[testing-env/test_image:0/session1] shell: "test_feature" teardown session',
|
|
1619
|
+
"[testing-env/test_image:0] session 'session1' ended with SandboxStateError",
|
|
1620
|
+
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1621
|
+
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1622
|
+
'[testing-env/test_image:0] sandbox shutdown',
|
|
1407
1623
|
'[testing-env] environment shutdown'
|
|
1408
1624
|
# pylint: enable=line-too-long
|
|
1409
1625
|
]
|
|
@@ -1411,39 +1627,42 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1411
1627
|
|
|
1412
1628
|
def test_service_context_manager_from_environment(self):
|
|
1413
1629
|
with self.env:
|
|
1414
|
-
with self.env.test_feature
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1630
|
+
with self.env.test_feature(session_id='session1') as test_feature:
|
|
1631
|
+
with test_feature.my_service() as service:
|
|
1632
|
+
service.do('foo')
|
|
1633
|
+
|
|
1634
|
+
with self.env.test_feature() as test_feature:
|
|
1635
|
+
with test_feature.my_service() as service:
|
|
1636
|
+
service.do('bar')
|
|
1418
1637
|
self.assertEqual(
|
|
1419
1638
|
self.event_handler.logs,
|
|
1420
1639
|
[
|
|
1421
1640
|
# pylint: disable=line-too-long
|
|
1422
1641
|
'[testing-env] environment started',
|
|
1423
|
-
'[testing-env/0] shell: "test_feature" setup',
|
|
1424
|
-
'[testing-env/0/test_feature] feature setup',
|
|
1425
|
-
'[testing-env/0] sandbox started',
|
|
1426
|
-
'[testing-env/0/session1] shell: "test_feature" setup session',
|
|
1427
|
-
"[testing-env/0] session 'session1' started",
|
|
1428
|
-
'[testing-env/0/session1] shell: foo',
|
|
1429
|
-
'[testing-env/0/session1/test_feature] test_feature.my_service: None',
|
|
1430
|
-
'[testing-env/0/session1] shell: "test_feature" teardown session',
|
|
1431
|
-
"[testing-env/0] session 'session1' ended",
|
|
1432
|
-
'[testing-env/0] shell: "test_feature" teardown',
|
|
1433
|
-
'[testing-env/0/test_feature] feature teardown',
|
|
1434
|
-
'[testing-env/0] sandbox shutdown',
|
|
1435
|
-
'[testing-env/1] shell: "test_feature" setup',
|
|
1436
|
-
'[testing-env/1/test_feature] feature setup',
|
|
1437
|
-
'[testing-env/1] sandbox started',
|
|
1438
|
-
'[testing-env/1/session-2291d8c] shell: "test_feature" setup session',
|
|
1439
|
-
"[testing-env/1] session 'session-2291d8c' started",
|
|
1440
|
-
'[testing-env/1/session-2291d8c] shell: bar',
|
|
1441
|
-
'[testing-env/1/session-2291d8c/test_feature] test_feature.my_service: None',
|
|
1442
|
-
'[testing-env/1/session-2291d8c] shell: "test_feature" teardown session',
|
|
1443
|
-
"[testing-env/1] session 'session-2291d8c' ended",
|
|
1444
|
-
'[testing-env/1] shell: "test_feature" teardown',
|
|
1445
|
-
'[testing-env/1/test_feature] feature teardown',
|
|
1446
|
-
'[testing-env/1] sandbox shutdown',
|
|
1642
|
+
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1643
|
+
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1644
|
+
'[testing-env/test_image:0] sandbox started',
|
|
1645
|
+
'[testing-env/test_image:0/session1] shell: "test_feature" setup session',
|
|
1646
|
+
"[testing-env/test_image:0] session 'session1' started",
|
|
1647
|
+
'[testing-env/test_image:0/session1] shell: foo',
|
|
1648
|
+
'[testing-env/test_image:0/session1/test_feature] test_feature.my_service: None',
|
|
1649
|
+
'[testing-env/test_image:0/session1] shell: "test_feature" teardown session',
|
|
1650
|
+
"[testing-env/test_image:0] session 'session1' ended",
|
|
1651
|
+
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1652
|
+
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1653
|
+
'[testing-env/test_image:0] sandbox shutdown',
|
|
1654
|
+
'[testing-env/test_image:1] shell: "test_feature" setup',
|
|
1655
|
+
'[testing-env/test_image:1/test_feature] feature setup',
|
|
1656
|
+
'[testing-env/test_image:1] sandbox started',
|
|
1657
|
+
'[testing-env/test_image:1/test_feature-session-2291d8c] shell: "test_feature" setup session',
|
|
1658
|
+
"[testing-env/test_image:1] session 'test_feature-session-2291d8c' started",
|
|
1659
|
+
'[testing-env/test_image:1/test_feature-session-2291d8c] shell: bar',
|
|
1660
|
+
'[testing-env/test_image:1/test_feature-session-2291d8c/test_feature] test_feature.my_service: None',
|
|
1661
|
+
'[testing-env/test_image:1/test_feature-session-2291d8c] shell: "test_feature" teardown session',
|
|
1662
|
+
"[testing-env/test_image:1] session 'test_feature-session-2291d8c' ended",
|
|
1663
|
+
'[testing-env/test_image:1] shell: "test_feature" teardown',
|
|
1664
|
+
'[testing-env/test_image:1/test_feature] feature teardown',
|
|
1665
|
+
'[testing-env/test_image:1] sandbox shutdown',
|
|
1447
1666
|
'[testing-env] environment shutdown'
|
|
1448
1667
|
# pylint: enable=line-too-long
|
|
1449
1668
|
]
|
|
@@ -1452,25 +1671,26 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1452
1671
|
def test_service_context_manager_from_environment_with_error(self):
|
|
1453
1672
|
with self.env:
|
|
1454
1673
|
with self.assertRaises(interface.SandboxStateError):
|
|
1455
|
-
with self.env.test_feature
|
|
1456
|
-
|
|
1674
|
+
with self.env.test_feature() as test_feature:
|
|
1675
|
+
with test_feature.my_service() as service:
|
|
1676
|
+
service.do('hello', raise_error=interface.SandboxStateError)
|
|
1457
1677
|
self.assertEqual(
|
|
1458
1678
|
self.event_handler.logs,
|
|
1459
1679
|
[
|
|
1460
1680
|
# pylint: disable=line-too-long
|
|
1461
1681
|
'[testing-env] environment started',
|
|
1462
|
-
'[testing-env/0] shell: "test_feature" setup',
|
|
1463
|
-
'[testing-env/0/test_feature] feature setup',
|
|
1464
|
-
'[testing-env/0] sandbox started',
|
|
1465
|
-
'[testing-env/0/session-2291d8c] shell: "test_feature" setup session',
|
|
1466
|
-
"[testing-env/0] session 'session-2291d8c' started",
|
|
1467
|
-
'[testing-env/0/session-2291d8c] shell: hello with SandboxStateError',
|
|
1468
|
-
'[testing-env/0/session-2291d8c/test_feature] test_feature.my_service: None with SandboxStateError',
|
|
1469
|
-
'[testing-env/0/session-2291d8c] shell: "test_feature" teardown session',
|
|
1470
|
-
"[testing-env/0] session 'session-2291d8c' ended with SandboxStateError",
|
|
1471
|
-
'[testing-env/0] shell: "test_feature" teardown',
|
|
1472
|
-
'[testing-env/0/test_feature] feature teardown',
|
|
1473
|
-
'[testing-env/0] sandbox shutdown',
|
|
1682
|
+
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1683
|
+
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1684
|
+
'[testing-env/test_image:0] sandbox started',
|
|
1685
|
+
'[testing-env/test_image:0/test_feature-session-2291d8c] shell: "test_feature" setup session',
|
|
1686
|
+
"[testing-env/test_image:0] session 'test_feature-session-2291d8c' started",
|
|
1687
|
+
'[testing-env/test_image:0/test_feature-session-2291d8c] shell: hello with SandboxStateError',
|
|
1688
|
+
'[testing-env/test_image:0/test_feature-session-2291d8c/test_feature] test_feature.my_service: None with SandboxStateError',
|
|
1689
|
+
'[testing-env/test_image:0/test_feature-session-2291d8c] shell: "test_feature" teardown session',
|
|
1690
|
+
"[testing-env/test_image:0] session 'test_feature-session-2291d8c' ended with SandboxStateError",
|
|
1691
|
+
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1692
|
+
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1693
|
+
'[testing-env/test_image:0] sandbox shutdown',
|
|
1474
1694
|
'[testing-env] environment shutdown'
|
|
1475
1695
|
# pylint: enable=line-too-long
|
|
1476
1696
|
]
|