langfun 0.1.2.dev202511010804__py3-none-any.whl → 0.1.2.dev202511030805__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/eval/v2/runners_test.py +3 -0
- langfun/env/__init__.py +1 -1
- langfun/env/base_environment.py +62 -5
- langfun/env/base_environment_test.py +5 -5
- langfun/env/base_feature.py +38 -20
- langfun/env/base_feature_test.py +228 -0
- langfun/env/base_sandbox.py +27 -33
- langfun/env/base_sandbox_test.py +258 -251
- langfun/env/event_handlers/chain.py +58 -80
- langfun/env/event_handlers/chain_test.py +83 -111
- langfun/env/event_handlers/event_logger.py +77 -80
- langfun/env/event_handlers/event_logger_test.py +18 -18
- langfun/env/event_handlers/metric_writer.py +176 -140
- langfun/env/interface.py +493 -199
- langfun/env/interface_test.py +30 -1
- langfun/env/test_utils.py +110 -78
- {langfun-0.1.2.dev202511010804.dist-info → langfun-0.1.2.dev202511030805.dist-info}/METADATA +1 -1
- {langfun-0.1.2.dev202511010804.dist-info → langfun-0.1.2.dev202511030805.dist-info}/RECORD +21 -20
- {langfun-0.1.2.dev202511010804.dist-info → langfun-0.1.2.dev202511030805.dist-info}/WHEEL +0 -0
- {langfun-0.1.2.dev202511010804.dist-info → langfun-0.1.2.dev202511030805.dist-info}/licenses/LICENSE +0 -0
- {langfun-0.1.2.dev202511010804.dist-info → langfun-0.1.2.dev202511030805.dist-info}/top_level.txt +0 -0
langfun/env/base_sandbox_test.py
CHANGED
|
@@ -24,7 +24,7 @@ TestingFeature = test_utils.TestingFeature
|
|
|
24
24
|
TestingEventHandler = test_utils.TestingEventHandler
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
class
|
|
27
|
+
class SandboxStateTests(unittest.TestCase):
|
|
28
28
|
|
|
29
29
|
def setUp(self):
|
|
30
30
|
super().setUp()
|
|
@@ -60,39 +60,39 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
60
60
|
)
|
|
61
61
|
self.assertFalse(env.enable_pooling('test_image'))
|
|
62
62
|
with env:
|
|
63
|
-
with env.sandbox(
|
|
63
|
+
with env.sandbox('session1') as sb:
|
|
64
64
|
sb.shell('echo "hello"')
|
|
65
65
|
self.assertEqual(
|
|
66
66
|
self.event_handler.logs,
|
|
67
67
|
[
|
|
68
68
|
# pylint: disable=line-too-long
|
|
69
69
|
'[testing-env] environment started',
|
|
70
|
-
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
70
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" setup',
|
|
71
71
|
'[testing-env/test_image:0/feature1] feature setup',
|
|
72
|
-
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
72
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" setup',
|
|
73
73
|
'[testing-env/test_image:0/feature2] feature setup',
|
|
74
74
|
'[testing-env/test_image:0] created -> ready',
|
|
75
75
|
'[testing-env/test_image:0] sandbox started',
|
|
76
76
|
'[testing-env/test_image:0] ready -> acquired',
|
|
77
77
|
'[testing-env/test_image:0] acquired -> setting_up',
|
|
78
|
-
'[testing-env/test_image:0
|
|
79
|
-
'[testing-env/test_image:0/feature1] feature setup session',
|
|
80
|
-
'[testing-env/test_image:0
|
|
81
|
-
'[testing-env/test_image:0/feature2] feature setup session',
|
|
78
|
+
'[testing-env/test_image:0@session1] shell: "feature1" setup session',
|
|
79
|
+
'[testing-env/test_image:0/feature1@session1] feature setup session',
|
|
80
|
+
'[testing-env/test_image:0@session1] shell: "feature2" setup session',
|
|
81
|
+
'[testing-env/test_image:0/feature2@session1] feature setup session',
|
|
82
82
|
'[testing-env/test_image:0] setting_up -> in_session',
|
|
83
83
|
"[testing-env/test_image:0] session 'session1' started",
|
|
84
|
-
'[testing-env/test_image:0
|
|
84
|
+
'[testing-env/test_image:0@session1] shell: echo "hello"',
|
|
85
85
|
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
86
|
-
'[testing-env/test_image:0
|
|
87
|
-
'[testing-env/test_image:0/feature1] feature teardown session',
|
|
88
|
-
'[testing-env/test_image:0
|
|
89
|
-
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
86
|
+
'[testing-env/test_image:0@session1] shell: "feature1" teardown session',
|
|
87
|
+
'[testing-env/test_image:0/feature1@session1] feature teardown session',
|
|
88
|
+
'[testing-env/test_image:0@session1] shell: "feature2" teardown session',
|
|
89
|
+
'[testing-env/test_image:0/feature2@session1] feature teardown session',
|
|
90
90
|
"[testing-env/test_image:0] session 'session1' ended",
|
|
91
91
|
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
92
92
|
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
93
|
-
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
93
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" teardown',
|
|
94
94
|
'[testing-env/test_image:0/feature1] feature teardown',
|
|
95
|
-
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
95
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" teardown',
|
|
96
96
|
'[testing-env/test_image:0/feature2] feature teardown',
|
|
97
97
|
'[testing-env/test_image:0] shutting_down -> offline',
|
|
98
98
|
'[testing-env/test_image:0] sandbox shutdown'
|
|
@@ -111,7 +111,7 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
111
111
|
)
|
|
112
112
|
self.assertTrue(env.enable_pooling('test_image'))
|
|
113
113
|
with env:
|
|
114
|
-
with env.sandbox(
|
|
114
|
+
with env.sandbox('session1') as sb:
|
|
115
115
|
sb.shell('echo "hello"')
|
|
116
116
|
sb.wait_until_not(
|
|
117
117
|
(
|
|
@@ -124,14 +124,14 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
124
124
|
self.event_handler.logs,
|
|
125
125
|
[
|
|
126
126
|
# pylint: disable=line-too-long
|
|
127
|
-
'[testing-env/test_image:0:0] shell: "feature1" setup',
|
|
127
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature1" setup',
|
|
128
128
|
'[testing-env/test_image:0:0/feature1] feature setup',
|
|
129
|
-
'[testing-env/test_image:0:0] shell: "feature2" setup',
|
|
129
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature2" setup',
|
|
130
130
|
'[testing-env/test_image:0:0/feature2] feature setup',
|
|
131
|
-
'[testing-env/test_image:0:0] shell: "feature1" setup session',
|
|
132
|
-
'[testing-env/test_image:0:0/feature1] feature setup session',
|
|
133
|
-
'[testing-env/test_image:0:0] shell: "feature2" setup session',
|
|
134
|
-
'[testing-env/test_image:0:0/feature2] feature setup session',
|
|
131
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature1" setup session',
|
|
132
|
+
'[testing-env/test_image:0:0/feature1@<idle>] feature setup session',
|
|
133
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature2" setup session',
|
|
134
|
+
'[testing-env/test_image:0:0/feature2@<idle>] feature setup session',
|
|
135
135
|
'[testing-env/test_image:0:0] created -> ready',
|
|
136
136
|
'[testing-env/test_image:0:0] sandbox started',
|
|
137
137
|
'[testing-env] environment started',
|
|
@@ -139,18 +139,18 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
139
139
|
'[testing-env/test_image:0:0] acquired -> setting_up',
|
|
140
140
|
'[testing-env/test_image:0:0] setting_up -> in_session',
|
|
141
141
|
"[testing-env/test_image:0:0] session 'session1' started",
|
|
142
|
-
'[testing-env/test_image:0:0
|
|
142
|
+
'[testing-env/test_image:0:0@session1] shell: echo "hello"',
|
|
143
143
|
'[testing-env/test_image:0:0] in_session -> exiting_session',
|
|
144
|
-
'[testing-env/test_image:0:0
|
|
145
|
-
'[testing-env/test_image:0:0/feature1] feature teardown session',
|
|
146
|
-
'[testing-env/test_image:0:0
|
|
147
|
-
'[testing-env/test_image:0:0/feature2] feature teardown session',
|
|
144
|
+
'[testing-env/test_image:0:0@session1] shell: "feature1" teardown session',
|
|
145
|
+
'[testing-env/test_image:0:0/feature1@session1] feature teardown session',
|
|
146
|
+
'[testing-env/test_image:0:0@session1] shell: "feature2" teardown session',
|
|
147
|
+
'[testing-env/test_image:0:0/feature2@session1] feature teardown session',
|
|
148
148
|
"[testing-env/test_image:0:0] session 'session1' ended",
|
|
149
149
|
'[testing-env/test_image:0:0] exiting_session -> setting_up',
|
|
150
|
-
'[testing-env/test_image:0:0] shell: "feature1" setup session',
|
|
151
|
-
'[testing-env/test_image:0:0/feature1] feature setup session',
|
|
152
|
-
'[testing-env/test_image:0:0] shell: "feature2" setup session',
|
|
153
|
-
'[testing-env/test_image:0:0/feature2] feature setup session',
|
|
150
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature1" setup session',
|
|
151
|
+
'[testing-env/test_image:0:0/feature1@<idle>] feature setup session',
|
|
152
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature2" setup session',
|
|
153
|
+
'[testing-env/test_image:0:0/feature2@<idle>] feature setup session',
|
|
154
154
|
'[testing-env/test_image:0:0] setting_up -> ready'
|
|
155
155
|
# pylint: enable=line-too-long
|
|
156
156
|
]
|
|
@@ -163,7 +163,7 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
163
163
|
housekeep_interval=10.0,
|
|
164
164
|
)
|
|
165
165
|
with env:
|
|
166
|
-
with env.sandbox(
|
|
166
|
+
with env.sandbox('session1') as sb:
|
|
167
167
|
sb.test_feature.rebind(
|
|
168
168
|
simulate_setup_session_error=interface.SandboxStateError,
|
|
169
169
|
skip_notification=True
|
|
@@ -180,10 +180,10 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
180
180
|
self.event_handler.logs,
|
|
181
181
|
[
|
|
182
182
|
# pylint: disable=line-too-long
|
|
183
|
-
'[testing-env/test_image:0:0] shell: "test_feature" setup',
|
|
183
|
+
'[testing-env/test_image:0:0@<idle>] shell: "test_feature" setup',
|
|
184
184
|
'[testing-env/test_image:0:0/test_feature] feature setup',
|
|
185
|
-
'[testing-env/test_image:0:0] shell: "test_feature" setup session',
|
|
186
|
-
'[testing-env/test_image:0:0/test_feature] feature setup session',
|
|
185
|
+
'[testing-env/test_image:0:0@<idle>] shell: "test_feature" setup session',
|
|
186
|
+
'[testing-env/test_image:0:0/test_feature@<idle>] feature setup session',
|
|
187
187
|
'[testing-env/test_image:0:0] created -> ready',
|
|
188
188
|
'[testing-env/test_image:0:0] sandbox started',
|
|
189
189
|
'[testing-env] environment started',
|
|
@@ -192,13 +192,13 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
192
192
|
'[testing-env/test_image:0:0] setting_up -> in_session',
|
|
193
193
|
"[testing-env/test_image:0:0] session 'session1' started",
|
|
194
194
|
'[testing-env/test_image:0:0] in_session -> exiting_session',
|
|
195
|
-
'[testing-env/test_image:0:0
|
|
196
|
-
'[testing-env/test_image:0:0/test_feature] feature teardown session',
|
|
195
|
+
'[testing-env/test_image:0:0@session1] shell: "test_feature" teardown session',
|
|
196
|
+
'[testing-env/test_image:0:0/test_feature@session1] feature teardown session',
|
|
197
197
|
"[testing-env/test_image:0:0] session 'session1' ended",
|
|
198
198
|
'[testing-env/test_image:0:0] exiting_session -> setting_up',
|
|
199
|
-
'[testing-env/test_image:0:0/test_feature] feature setup session with SandboxStateError',
|
|
199
|
+
'[testing-env/test_image:0:0/test_feature@<idle>] feature setup session with SandboxStateError',
|
|
200
200
|
'[testing-env/test_image:0:0] setting_up -> shutting_down',
|
|
201
|
-
'[testing-env/test_image:0:0] shell: "test_feature" teardown',
|
|
201
|
+
'[testing-env/test_image:0:0@<idle>] shell: "test_feature" teardown',
|
|
202
202
|
'[testing-env/test_image:0:0/test_feature] feature teardown',
|
|
203
203
|
'[testing-env/test_image:0:0] shutting_down -> offline',
|
|
204
204
|
'[testing-env/test_image:0:0] sandbox shutdown'
|
|
@@ -216,7 +216,7 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
216
216
|
)
|
|
217
217
|
with env:
|
|
218
218
|
with self.assertRaises(ValueError):
|
|
219
|
-
with env.sandbox(
|
|
219
|
+
with env.sandbox('session1'):
|
|
220
220
|
pass
|
|
221
221
|
self.assertTrue(env.is_online)
|
|
222
222
|
self.assertEqual(
|
|
@@ -266,45 +266,44 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
266
266
|
)
|
|
267
267
|
with env:
|
|
268
268
|
with self.assertRaises(ValueError):
|
|
269
|
-
with env.sandbox(
|
|
269
|
+
with env.sandbox('session1') as sb:
|
|
270
270
|
sb.shell('echo "hello"')
|
|
271
271
|
self.assertEqual(len(sb.state_errors), 0)
|
|
272
|
-
|
|
273
272
|
self.assertEqual(
|
|
274
273
|
self.event_handler.logs,
|
|
275
274
|
[
|
|
276
275
|
# pylint: disable=line-too-long
|
|
277
276
|
'[testing-env] environment started',
|
|
278
|
-
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
277
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" setup',
|
|
279
278
|
'[testing-env/test_image:0/feature1] feature setup',
|
|
280
|
-
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
279
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" setup',
|
|
281
280
|
'[testing-env/test_image:0/feature2] feature setup',
|
|
282
281
|
'[testing-env/test_image:0] created -> ready',
|
|
283
282
|
'[testing-env/test_image:0] sandbox started',
|
|
284
283
|
'[testing-env/test_image:0] ready -> acquired',
|
|
285
284
|
'[testing-env/test_image:0] acquired -> setting_up',
|
|
286
|
-
'[testing-env/test_image:0
|
|
287
|
-
'[testing-env/test_image:0/feature1] feature setup session',
|
|
288
|
-
'[testing-env/test_image:0
|
|
289
|
-
'[testing-env/test_image:0/feature2] feature setup session',
|
|
285
|
+
'[testing-env/test_image:0@session1] shell: "feature1" setup session',
|
|
286
|
+
'[testing-env/test_image:0/feature1@session1] feature setup session',
|
|
287
|
+
'[testing-env/test_image:0@session1] shell: "feature2" setup session',
|
|
288
|
+
'[testing-env/test_image:0/feature2@session1] feature setup session',
|
|
290
289
|
'[testing-env/test_image:0] setting_up -> in_session',
|
|
291
290
|
"[testing-env/test_image:0] session 'session1' started",
|
|
292
|
-
'[testing-env/test_image:0
|
|
291
|
+
'[testing-env/test_image:0@session1] shell: echo "hello"',
|
|
293
292
|
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
294
|
-
'[testing-env/test_image:0
|
|
295
|
-
'[testing-env/test_image:0/feature1] feature teardown session',
|
|
296
|
-
'[testing-env/test_image:0
|
|
297
|
-
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
293
|
+
'[testing-env/test_image:0@session1] shell: "feature1" teardown session',
|
|
294
|
+
'[testing-env/test_image:0/feature1@session1] feature teardown session',
|
|
295
|
+
'[testing-env/test_image:0@session1] shell: "feature2" teardown session',
|
|
296
|
+
'[testing-env/test_image:0/feature2@session1] feature teardown session',
|
|
298
297
|
"[testing-env/test_image:0] session 'session1' ended",
|
|
299
298
|
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
300
299
|
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
301
|
-
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
300
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" teardown',
|
|
302
301
|
'[testing-env/test_image:0/feature1] feature teardown',
|
|
303
|
-
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
302
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" teardown',
|
|
304
303
|
'[testing-env/test_image:0/feature2] feature teardown',
|
|
305
304
|
'[testing-env/test_image:0] shutting_down -> offline',
|
|
306
305
|
'[testing-env/test_image:0] sandbox shutdown with ValueError',
|
|
307
|
-
'[testing-env] environment shutdown'
|
|
306
|
+
'[testing-env] environment shutdown',
|
|
308
307
|
# pylint: enable=line-too-long
|
|
309
308
|
]
|
|
310
309
|
)
|
|
@@ -326,21 +325,21 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
326
325
|
self.event_handler.logs,
|
|
327
326
|
[
|
|
328
327
|
# pylint: disable=line-too-long
|
|
329
|
-
'[testing-env/test_image:0:0] shell: "feature1" setup',
|
|
328
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature1" setup',
|
|
330
329
|
'[testing-env/test_image:0:0/feature1] feature setup',
|
|
331
|
-
'[testing-env/test_image:0:0] shell: "feature2" setup',
|
|
330
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature2" setup',
|
|
332
331
|
'[testing-env/test_image:0:0/feature2] feature setup',
|
|
333
|
-
'[testing-env/test_image:0:0] shell: "feature1" setup session',
|
|
334
|
-
'[testing-env/test_image:0:0/feature1] feature setup session',
|
|
335
|
-
'[testing-env/test_image:0:0] shell: "feature2" setup session',
|
|
336
|
-
'[testing-env/test_image:0:0/feature2] feature setup session',
|
|
332
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature1" setup session',
|
|
333
|
+
'[testing-env/test_image:0:0/feature1@<idle>] feature setup session',
|
|
334
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature2" setup session',
|
|
335
|
+
'[testing-env/test_image:0:0/feature2@<idle>] feature setup session',
|
|
337
336
|
'[testing-env/test_image:0:0] created -> ready',
|
|
338
337
|
'[testing-env/test_image:0:0] sandbox started',
|
|
339
338
|
'[testing-env] environment started',
|
|
340
339
|
'[testing-env/test_image:0:0] ready -> shutting_down',
|
|
341
|
-
'[testing-env/test_image:0:0] shell: "feature1" teardown',
|
|
340
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature1" teardown',
|
|
342
341
|
'[testing-env/test_image:0:0/feature1] feature teardown',
|
|
343
|
-
'[testing-env/test_image:0:0] shell: "feature2" teardown',
|
|
342
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature2" teardown',
|
|
344
343
|
'[testing-env/test_image:0:0/feature2] feature teardown',
|
|
345
344
|
'[testing-env/test_image:0:0] shutting_down -> offline',
|
|
346
345
|
'[testing-env/test_image:0:0] sandbox shutdown with ValueError',
|
|
@@ -358,44 +357,45 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
358
357
|
simulate_shutdown_error=interface.SandboxStateError,
|
|
359
358
|
)
|
|
360
359
|
with env:
|
|
361
|
-
with env.sandbox(
|
|
360
|
+
with env.sandbox('session1') as sb:
|
|
362
361
|
sb.shell('echo "hello"')
|
|
363
362
|
self.assertEqual(len(sb.state_errors), 1)
|
|
363
|
+
|
|
364
364
|
self.assertEqual(
|
|
365
365
|
self.event_handler.logs,
|
|
366
366
|
[
|
|
367
367
|
# pylint: disable=line-too-long
|
|
368
368
|
'[testing-env] environment started',
|
|
369
|
-
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
369
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" setup',
|
|
370
370
|
'[testing-env/test_image:0/feature1] feature setup',
|
|
371
|
-
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
371
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" setup',
|
|
372
372
|
'[testing-env/test_image:0/feature2] feature setup',
|
|
373
373
|
'[testing-env/test_image:0] created -> ready',
|
|
374
374
|
'[testing-env/test_image:0] sandbox started',
|
|
375
375
|
'[testing-env/test_image:0] ready -> acquired',
|
|
376
376
|
'[testing-env/test_image:0] acquired -> setting_up',
|
|
377
|
-
'[testing-env/test_image:0
|
|
378
|
-
'[testing-env/test_image:0/feature1] feature setup session',
|
|
379
|
-
'[testing-env/test_image:0
|
|
380
|
-
'[testing-env/test_image:0/feature2] feature setup session',
|
|
377
|
+
'[testing-env/test_image:0@session1] shell: "feature1" setup session',
|
|
378
|
+
'[testing-env/test_image:0/feature1@session1] feature setup session',
|
|
379
|
+
'[testing-env/test_image:0@session1] shell: "feature2" setup session',
|
|
380
|
+
'[testing-env/test_image:0/feature2@session1] feature setup session',
|
|
381
381
|
'[testing-env/test_image:0] setting_up -> in_session',
|
|
382
382
|
"[testing-env/test_image:0] session 'session1' started",
|
|
383
|
-
'[testing-env/test_image:0
|
|
383
|
+
'[testing-env/test_image:0@session1] shell: echo "hello"',
|
|
384
384
|
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
385
|
-
'[testing-env/test_image:0
|
|
386
|
-
'[testing-env/test_image:0/feature1] feature teardown session',
|
|
387
|
-
'[testing-env/test_image:0
|
|
388
|
-
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
385
|
+
'[testing-env/test_image:0@session1] shell: "feature1" teardown session',
|
|
386
|
+
'[testing-env/test_image:0/feature1@session1] feature teardown session',
|
|
387
|
+
'[testing-env/test_image:0@session1] shell: "feature2" teardown session',
|
|
388
|
+
'[testing-env/test_image:0/feature2@session1] feature teardown session',
|
|
389
389
|
"[testing-env/test_image:0] session 'session1' ended",
|
|
390
390
|
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
391
391
|
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
392
|
-
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
392
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" teardown',
|
|
393
393
|
'[testing-env/test_image:0/feature1] feature teardown',
|
|
394
|
-
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
394
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" teardown',
|
|
395
395
|
'[testing-env/test_image:0/feature2] feature teardown',
|
|
396
396
|
'[testing-env/test_image:0] shutting_down -> offline',
|
|
397
397
|
'[testing-env/test_image:0] sandbox shutdown with SandboxStateError',
|
|
398
|
-
'[testing-env] environment shutdown'
|
|
398
|
+
'[testing-env] environment shutdown',
|
|
399
399
|
# pylint: enable=line-too-long
|
|
400
400
|
]
|
|
401
401
|
)
|
|
@@ -411,24 +411,24 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
411
411
|
)
|
|
412
412
|
with env:
|
|
413
413
|
with self.assertRaises(ValueError):
|
|
414
|
-
with env.sandbox(
|
|
414
|
+
with env.sandbox('session1'):
|
|
415
415
|
pass
|
|
416
416
|
self.assertEqual(
|
|
417
417
|
self.event_handler.logs,
|
|
418
418
|
[
|
|
419
419
|
# pylint: disable=line-too-long
|
|
420
420
|
'[testing-env] environment started',
|
|
421
|
-
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
421
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" setup',
|
|
422
422
|
'[testing-env/test_image:0/feature1] feature setup',
|
|
423
423
|
'[testing-env/test_image:0/feature2] feature setup with ValueError',
|
|
424
424
|
'[testing-env/test_image:0] sandbox started with ValueError',
|
|
425
425
|
'[testing-env/test_image:0] created -> shutting_down',
|
|
426
|
-
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
426
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" teardown',
|
|
427
427
|
'[testing-env/test_image:0/feature1] feature teardown',
|
|
428
|
-
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
428
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" teardown',
|
|
429
429
|
'[testing-env/test_image:0/feature2] feature teardown',
|
|
430
430
|
'[testing-env/test_image:0] shutting_down -> offline',
|
|
431
|
-
'[testing-env/test_image:0] sandbox shutdown'
|
|
431
|
+
'[testing-env/test_image:0] sandbox shutdown'
|
|
432
432
|
# pylint: enable=line-too-long
|
|
433
433
|
]
|
|
434
434
|
)
|
|
@@ -444,7 +444,7 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
444
444
|
)
|
|
445
445
|
with env:
|
|
446
446
|
with self.assertRaises(interface.EnvironmentOutageError):
|
|
447
|
-
with env.sandbox(
|
|
447
|
+
with env.sandbox('session1'):
|
|
448
448
|
pass
|
|
449
449
|
self.assertEqual(
|
|
450
450
|
self.event_handler.logs,
|
|
@@ -454,7 +454,7 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
454
454
|
'[testing-env/test_image:0/feature1] feature setup with SandboxStateError',
|
|
455
455
|
'[testing-env/test_image:0] sandbox started with SandboxStateError',
|
|
456
456
|
'[testing-env/test_image:0] created -> shutting_down',
|
|
457
|
-
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
457
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" teardown',
|
|
458
458
|
'[testing-env/test_image:0/feature1] feature teardown',
|
|
459
459
|
'[testing-env/test_image:0] shutting_down -> offline',
|
|
460
460
|
'[testing-env/test_image:0] sandbox shutdown',
|
|
@@ -474,36 +474,36 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
474
474
|
)
|
|
475
475
|
with env:
|
|
476
476
|
with self.assertRaises(interface.FeatureTeardownError):
|
|
477
|
-
with env.sandbox(
|
|
477
|
+
with env.sandbox('session1'):
|
|
478
478
|
pass
|
|
479
479
|
self.assertEqual(
|
|
480
480
|
self.event_handler.logs,
|
|
481
481
|
[
|
|
482
482
|
# pylint: disable=line-too-long
|
|
483
483
|
'[testing-env] environment started',
|
|
484
|
-
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
484
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" setup',
|
|
485
485
|
'[testing-env/test_image:0/feature1] feature setup',
|
|
486
|
-
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
486
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" setup',
|
|
487
487
|
'[testing-env/test_image:0/feature2] feature setup',
|
|
488
488
|
'[testing-env/test_image:0] created -> ready',
|
|
489
489
|
'[testing-env/test_image:0] sandbox started',
|
|
490
490
|
'[testing-env/test_image:0] ready -> acquired',
|
|
491
491
|
'[testing-env/test_image:0] acquired -> setting_up',
|
|
492
|
-
'[testing-env/test_image:0
|
|
493
|
-
'[testing-env/test_image:0/feature1] feature setup session',
|
|
494
|
-
'[testing-env/test_image:0
|
|
495
|
-
'[testing-env/test_image:0/feature2] feature setup session',
|
|
492
|
+
'[testing-env/test_image:0@session1] shell: "feature1" setup session',
|
|
493
|
+
'[testing-env/test_image:0/feature1@session1] feature setup session',
|
|
494
|
+
'[testing-env/test_image:0@session1] shell: "feature2" setup session',
|
|
495
|
+
'[testing-env/test_image:0/feature2@session1] feature setup session',
|
|
496
496
|
'[testing-env/test_image:0] setting_up -> in_session',
|
|
497
497
|
"[testing-env/test_image:0] session 'session1' started",
|
|
498
498
|
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
499
|
-
'[testing-env/test_image:0
|
|
500
|
-
'[testing-env/test_image:0/feature1] feature teardown session',
|
|
501
|
-
'[testing-env/test_image:0
|
|
502
|
-
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
499
|
+
'[testing-env/test_image:0@session1] shell: "feature1" teardown session',
|
|
500
|
+
'[testing-env/test_image:0/feature1@session1] feature teardown session',
|
|
501
|
+
'[testing-env/test_image:0@session1] shell: "feature2" teardown session',
|
|
502
|
+
'[testing-env/test_image:0/feature2@session1] feature teardown session',
|
|
503
503
|
"[testing-env/test_image:0] session 'session1' ended",
|
|
504
504
|
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
505
505
|
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
506
|
-
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
506
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" teardown',
|
|
507
507
|
'[testing-env/test_image:0/feature1] feature teardown',
|
|
508
508
|
'[testing-env/test_image:0/feature2] feature teardown with ValueError',
|
|
509
509
|
'[testing-env/test_image:0] shutting_down -> offline',
|
|
@@ -523,7 +523,7 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
523
523
|
},
|
|
524
524
|
)
|
|
525
525
|
with env:
|
|
526
|
-
with env.sandbox(
|
|
526
|
+
with env.sandbox('session1') as sb:
|
|
527
527
|
pass
|
|
528
528
|
self.assertEqual(len(sb.state_errors), 1)
|
|
529
529
|
self.assertEqual(
|
|
@@ -531,30 +531,30 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
531
531
|
[
|
|
532
532
|
# pylint: disable=line-too-long
|
|
533
533
|
'[testing-env] environment started',
|
|
534
|
-
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
534
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" setup',
|
|
535
535
|
'[testing-env/test_image:0/feature1] feature setup',
|
|
536
|
-
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
536
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" setup',
|
|
537
537
|
'[testing-env/test_image:0/feature2] feature setup',
|
|
538
538
|
'[testing-env/test_image:0] created -> ready',
|
|
539
539
|
'[testing-env/test_image:0] sandbox started',
|
|
540
540
|
'[testing-env/test_image:0] ready -> acquired',
|
|
541
541
|
'[testing-env/test_image:0] acquired -> setting_up',
|
|
542
|
-
'[testing-env/test_image:0
|
|
543
|
-
'[testing-env/test_image:0/feature1] feature setup session',
|
|
544
|
-
'[testing-env/test_image:0
|
|
545
|
-
'[testing-env/test_image:0/feature2] feature setup session',
|
|
542
|
+
'[testing-env/test_image:0@session1] shell: "feature1" setup session',
|
|
543
|
+
'[testing-env/test_image:0/feature1@session1] feature setup session',
|
|
544
|
+
'[testing-env/test_image:0@session1] shell: "feature2" setup session',
|
|
545
|
+
'[testing-env/test_image:0/feature2@session1] feature setup session',
|
|
546
546
|
'[testing-env/test_image:0] setting_up -> in_session',
|
|
547
547
|
"[testing-env/test_image:0] session 'session1' started",
|
|
548
548
|
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
549
|
-
'[testing-env/test_image:0
|
|
550
|
-
'[testing-env/test_image:0/feature1] feature teardown session',
|
|
551
|
-
'[testing-env/test_image:0
|
|
552
|
-
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
549
|
+
'[testing-env/test_image:0@session1] shell: "feature1" teardown session',
|
|
550
|
+
'[testing-env/test_image:0/feature1@session1] feature teardown session',
|
|
551
|
+
'[testing-env/test_image:0@session1] shell: "feature2" teardown session',
|
|
552
|
+
'[testing-env/test_image:0/feature2@session1] feature teardown session',
|
|
553
553
|
"[testing-env/test_image:0] session 'session1' ended",
|
|
554
554
|
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
555
555
|
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
556
|
-
'[testing-env/test_image:0/feature1] feature teardown with SandboxStateError',
|
|
557
|
-
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
556
|
+
'[testing-env/test_image:0/feature1] feature teardown with SandboxStateError',
|
|
557
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" teardown',
|
|
558
558
|
'[testing-env/test_image:0/feature2] feature teardown',
|
|
559
559
|
'[testing-env/test_image:0] shutting_down -> offline',
|
|
560
560
|
'[testing-env/test_image:0] sandbox shutdown with FeatureTeardownError',
|
|
@@ -573,32 +573,32 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
573
573
|
)
|
|
574
574
|
with env:
|
|
575
575
|
with self.assertRaises(ValueError):
|
|
576
|
-
with env.sandbox(
|
|
576
|
+
with env.sandbox('session1') as sb:
|
|
577
577
|
sb.shell('echo "hello"')
|
|
578
578
|
self.assertEqual(
|
|
579
579
|
self.event_handler.logs,
|
|
580
580
|
[
|
|
581
581
|
# pylint: disable=line-too-long
|
|
582
582
|
'[testing-env] environment started',
|
|
583
|
-
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
583
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" setup',
|
|
584
584
|
'[testing-env/test_image:0/feature1] feature setup',
|
|
585
|
-
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
585
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" setup',
|
|
586
586
|
'[testing-env/test_image:0/feature2] feature setup',
|
|
587
587
|
'[testing-env/test_image:0] created -> ready',
|
|
588
588
|
'[testing-env/test_image:0] sandbox started',
|
|
589
589
|
'[testing-env/test_image:0] ready -> acquired',
|
|
590
590
|
'[testing-env/test_image:0] acquired -> setting_up',
|
|
591
|
-
'[testing-env/test_image:0
|
|
592
|
-
'[testing-env/test_image:0/feature1] feature setup session',
|
|
593
|
-
'[testing-env/test_image:0/feature2] feature setup session with ValueError',
|
|
591
|
+
'[testing-env/test_image:0@session1] shell: "feature1" setup session',
|
|
592
|
+
'[testing-env/test_image:0/feature1@session1] feature setup session',
|
|
593
|
+
'[testing-env/test_image:0/feature2@session1] feature setup session with ValueError',
|
|
594
594
|
"[testing-env/test_image:0] session 'session1' started with ValueError",
|
|
595
595
|
'[testing-env/test_image:0] setting_up -> shutting_down',
|
|
596
|
-
'[testing-env/test_image:0
|
|
596
|
+
'[testing-env/test_image:0@session1] shell: "feature1" teardown',
|
|
597
597
|
'[testing-env/test_image:0/feature1] feature teardown',
|
|
598
|
-
'[testing-env/test_image:0
|
|
598
|
+
'[testing-env/test_image:0@session1] shell: "feature2" teardown',
|
|
599
599
|
'[testing-env/test_image:0/feature2] feature teardown',
|
|
600
600
|
'[testing-env/test_image:0] shutting_down -> offline',
|
|
601
|
-
'[testing-env/test_image:0] sandbox shutdown'
|
|
601
|
+
'[testing-env/test_image:0] sandbox shutdown'
|
|
602
602
|
# pylint: enable=line-too-long
|
|
603
603
|
]
|
|
604
604
|
)
|
|
@@ -614,7 +614,7 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
614
614
|
)
|
|
615
615
|
with env:
|
|
616
616
|
with self.assertRaises(interface.SessionTeardownError):
|
|
617
|
-
with env.sandbox(
|
|
617
|
+
with env.sandbox('session1') as sb:
|
|
618
618
|
sb.shell('echo "hello"')
|
|
619
619
|
self.assertEqual(sb.status, interface.Sandbox.Status.OFFLINE)
|
|
620
620
|
self.assertEqual(
|
|
@@ -622,34 +622,34 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
622
622
|
[
|
|
623
623
|
# pylint: disable=line-too-long
|
|
624
624
|
'[testing-env] environment started',
|
|
625
|
-
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
625
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" setup',
|
|
626
626
|
'[testing-env/test_image:0/feature1] feature setup',
|
|
627
|
-
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
627
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" setup',
|
|
628
628
|
'[testing-env/test_image:0/feature2] feature setup',
|
|
629
629
|
'[testing-env/test_image:0] created -> ready',
|
|
630
630
|
'[testing-env/test_image:0] sandbox started',
|
|
631
631
|
'[testing-env/test_image:0] ready -> acquired',
|
|
632
632
|
'[testing-env/test_image:0] acquired -> setting_up',
|
|
633
|
-
'[testing-env/test_image:0
|
|
634
|
-
'[testing-env/test_image:0/feature1] feature setup session',
|
|
635
|
-
'[testing-env/test_image:0
|
|
636
|
-
'[testing-env/test_image:0/feature2] feature setup session',
|
|
633
|
+
'[testing-env/test_image:0@session1] shell: "feature1" setup session',
|
|
634
|
+
'[testing-env/test_image:0/feature1@session1] feature setup session',
|
|
635
|
+
'[testing-env/test_image:0@session1] shell: "feature2" setup session',
|
|
636
|
+
'[testing-env/test_image:0/feature2@session1] feature setup session',
|
|
637
637
|
'[testing-env/test_image:0] setting_up -> in_session',
|
|
638
638
|
"[testing-env/test_image:0] session 'session1' started",
|
|
639
|
-
'[testing-env/test_image:0
|
|
639
|
+
'[testing-env/test_image:0@session1] shell: echo "hello"',
|
|
640
640
|
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
641
|
-
'[testing-env/test_image:0/feature1] feature teardown session with ValueError',
|
|
642
|
-
'[testing-env/test_image:0
|
|
643
|
-
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
641
|
+
'[testing-env/test_image:0/feature1@session1] feature teardown session with ValueError',
|
|
642
|
+
'[testing-env/test_image:0@session1] shell: "feature2" teardown session',
|
|
643
|
+
'[testing-env/test_image:0/feature2@session1] feature teardown session',
|
|
644
644
|
"[testing-env/test_image:0] session 'session1' ended",
|
|
645
645
|
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
646
646
|
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
647
|
-
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
647
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" teardown',
|
|
648
648
|
'[testing-env/test_image:0/feature1] feature teardown',
|
|
649
|
-
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
649
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" teardown',
|
|
650
650
|
'[testing-env/test_image:0/feature2] feature teardown',
|
|
651
651
|
'[testing-env/test_image:0] shutting_down -> offline',
|
|
652
|
-
'[testing-env/test_image:0] sandbox shutdown'
|
|
652
|
+
'[testing-env/test_image:0] sandbox shutdown',
|
|
653
653
|
# pylint: enable=line-too-long
|
|
654
654
|
]
|
|
655
655
|
)
|
|
@@ -664,7 +664,7 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
664
664
|
},
|
|
665
665
|
)
|
|
666
666
|
with env:
|
|
667
|
-
with env.sandbox(
|
|
667
|
+
with env.sandbox('session1') as sb:
|
|
668
668
|
sb.shell('echo "hello"')
|
|
669
669
|
self.assertEqual(len(sb.state_errors), 1)
|
|
670
670
|
self.assertEqual(sb.status, interface.Sandbox.Status.OFFLINE)
|
|
@@ -673,34 +673,34 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
673
673
|
[
|
|
674
674
|
# pylint: disable=line-too-long
|
|
675
675
|
'[testing-env] environment started',
|
|
676
|
-
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
676
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" setup',
|
|
677
677
|
'[testing-env/test_image:0/feature1] feature setup',
|
|
678
|
-
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
678
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" setup',
|
|
679
679
|
'[testing-env/test_image:0/feature2] feature setup',
|
|
680
680
|
'[testing-env/test_image:0] created -> ready',
|
|
681
681
|
'[testing-env/test_image:0] sandbox started',
|
|
682
682
|
'[testing-env/test_image:0] ready -> acquired',
|
|
683
683
|
'[testing-env/test_image:0] acquired -> setting_up',
|
|
684
|
-
'[testing-env/test_image:0
|
|
685
|
-
'[testing-env/test_image:0/feature1] feature setup session',
|
|
686
|
-
'[testing-env/test_image:0
|
|
687
|
-
'[testing-env/test_image:0/feature2] feature setup session',
|
|
684
|
+
'[testing-env/test_image:0@session1] shell: "feature1" setup session',
|
|
685
|
+
'[testing-env/test_image:0/feature1@session1] feature setup session',
|
|
686
|
+
'[testing-env/test_image:0@session1] shell: "feature2" setup session',
|
|
687
|
+
'[testing-env/test_image:0/feature2@session1] feature setup session',
|
|
688
688
|
'[testing-env/test_image:0] setting_up -> in_session',
|
|
689
689
|
"[testing-env/test_image:0] session 'session1' started",
|
|
690
|
-
'[testing-env/test_image:0
|
|
690
|
+
'[testing-env/test_image:0@session1] shell: echo "hello"',
|
|
691
691
|
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
692
|
-
'[testing-env/test_image:0/feature1] feature teardown session with SandboxStateError',
|
|
693
|
-
'[testing-env/test_image:0
|
|
694
|
-
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
692
|
+
'[testing-env/test_image:0/feature1@session1] feature teardown session with SandboxStateError',
|
|
693
|
+
'[testing-env/test_image:0@session1] shell: "feature2" teardown session',
|
|
694
|
+
'[testing-env/test_image:0/feature2@session1] feature teardown session',
|
|
695
695
|
"[testing-env/test_image:0] session 'session1' ended with SandboxStateError",
|
|
696
696
|
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
697
697
|
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
698
|
-
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
698
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" teardown',
|
|
699
699
|
'[testing-env/test_image:0/feature1] feature teardown',
|
|
700
|
-
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
700
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" teardown',
|
|
701
701
|
'[testing-env/test_image:0/feature2] feature teardown',
|
|
702
702
|
'[testing-env/test_image:0] shutting_down -> offline',
|
|
703
|
-
'[testing-env/test_image:0] sandbox shutdown'
|
|
703
|
+
'[testing-env/test_image:0] sandbox shutdown',
|
|
704
704
|
# pylint: enable=line-too-long
|
|
705
705
|
]
|
|
706
706
|
)
|
|
@@ -715,39 +715,39 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
715
715
|
},
|
|
716
716
|
)
|
|
717
717
|
with env:
|
|
718
|
-
with env.sandbox(
|
|
718
|
+
with env.sandbox('session1') as sb:
|
|
719
719
|
sb.shell('echo "hello"')
|
|
720
720
|
self.assertEqual(
|
|
721
721
|
self.event_handler.logs,
|
|
722
722
|
[
|
|
723
723
|
# pylint: disable=line-too-long
|
|
724
724
|
'[testing-env] environment started',
|
|
725
|
-
'[testing-env/test_image:0] shell: "feature1" setup',
|
|
725
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" setup',
|
|
726
726
|
'[testing-env/test_image:0/feature1] feature setup',
|
|
727
|
-
'[testing-env/test_image:0] shell: "feature2" setup',
|
|
727
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" setup',
|
|
728
728
|
'[testing-env/test_image:0/feature2] feature setup',
|
|
729
729
|
'[testing-env/test_image:0] created -> ready',
|
|
730
730
|
'[testing-env/test_image:0] sandbox started',
|
|
731
731
|
'[testing-env/test_image:0] ready -> acquired',
|
|
732
732
|
'[testing-env/test_image:0] acquired -> setting_up',
|
|
733
|
-
'[testing-env/test_image:0
|
|
734
|
-
'[testing-env/test_image:0/feature1] feature setup session',
|
|
735
|
-
'[testing-env/test_image:0
|
|
736
|
-
'[testing-env/test_image:0/feature2] feature setup session',
|
|
733
|
+
'[testing-env/test_image:0@session1] shell: "feature1" setup session',
|
|
734
|
+
'[testing-env/test_image:0/feature1@session1] feature setup session',
|
|
735
|
+
'[testing-env/test_image:0@session1] shell: "feature2" setup session',
|
|
736
|
+
'[testing-env/test_image:0/feature2@session1] feature setup session',
|
|
737
737
|
'[testing-env/test_image:0] setting_up -> in_session',
|
|
738
738
|
"[testing-env/test_image:0] session 'session1' started",
|
|
739
|
-
'[testing-env/test_image:0
|
|
739
|
+
'[testing-env/test_image:0@session1] shell: echo "hello"',
|
|
740
740
|
'[testing-env/test_image:0] in_session -> exiting_session',
|
|
741
|
-
'[testing-env/test_image:0
|
|
742
|
-
'[testing-env/test_image:0/feature1] feature teardown session',
|
|
743
|
-
'[testing-env/test_image:0
|
|
744
|
-
'[testing-env/test_image:0/feature2] feature teardown session',
|
|
741
|
+
'[testing-env/test_image:0@session1] shell: "feature1" teardown session',
|
|
742
|
+
'[testing-env/test_image:0/feature1@session1] feature teardown session',
|
|
743
|
+
'[testing-env/test_image:0@session1] shell: "feature2" teardown session',
|
|
744
|
+
'[testing-env/test_image:0/feature2@session1] feature teardown session',
|
|
745
745
|
"[testing-env/test_image:0] session 'session1' ended",
|
|
746
746
|
'[testing-env/test_image:0] exiting_session -> acquired',
|
|
747
747
|
'[testing-env/test_image:0] acquired -> shutting_down',
|
|
748
|
-
'[testing-env/test_image:0] shell: "feature1" teardown',
|
|
748
|
+
'[testing-env/test_image:0@<idle>] shell: "feature1" teardown',
|
|
749
749
|
'[testing-env/test_image:0/feature1] feature teardown',
|
|
750
|
-
'[testing-env/test_image:0] shell: "feature2" teardown',
|
|
750
|
+
'[testing-env/test_image:0@<idle>] shell: "feature2" teardown',
|
|
751
751
|
'[testing-env/test_image:0/feature2] feature teardown',
|
|
752
752
|
'[testing-env/test_image:0] shutting_down -> offline',
|
|
753
753
|
'[testing-env/test_image:0] sandbox shutdown'
|
|
@@ -763,7 +763,7 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
763
763
|
},
|
|
764
764
|
)
|
|
765
765
|
with env:
|
|
766
|
-
with env.sandbox(
|
|
766
|
+
with env.sandbox('session1') as sb:
|
|
767
767
|
with self.assertRaises(ValueError):
|
|
768
768
|
sb.shell('echo foo', raise_error=ValueError)
|
|
769
769
|
self.assertEqual(len(sb.state_errors), 0)
|
|
@@ -775,10 +775,10 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
775
775
|
self.event_handler.logs,
|
|
776
776
|
[
|
|
777
777
|
# pylint: disable=line-too-long
|
|
778
|
-
'[testing-env/test_image:0:0] shell: "feature1" setup',
|
|
778
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature1" setup',
|
|
779
779
|
'[testing-env/test_image:0:0/feature1] feature setup',
|
|
780
|
-
'[testing-env/test_image:0:0] shell: "feature1" setup session',
|
|
781
|
-
'[testing-env/test_image:0:0/feature1] feature setup session',
|
|
780
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature1" setup session',
|
|
781
|
+
'[testing-env/test_image:0:0/feature1@<idle>] feature setup session',
|
|
782
782
|
'[testing-env/test_image:0:0] created -> ready',
|
|
783
783
|
'[testing-env/test_image:0:0] sandbox started',
|
|
784
784
|
'[testing-env] environment started',
|
|
@@ -786,15 +786,15 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
786
786
|
'[testing-env/test_image:0:0] acquired -> setting_up',
|
|
787
787
|
'[testing-env/test_image:0:0] setting_up -> in_session',
|
|
788
788
|
"[testing-env/test_image:0:0] session 'session1' started",
|
|
789
|
-
'[testing-env/test_image:0:0
|
|
790
|
-
'[testing-env/test_image:0:0
|
|
789
|
+
'[testing-env/test_image:0:0@session1] shell: echo foo with ValueError',
|
|
790
|
+
'[testing-env/test_image:0:0@session1] shell: echo bar',
|
|
791
791
|
'[testing-env/test_image:0:0] in_session -> exiting_session',
|
|
792
|
-
'[testing-env/test_image:0:0
|
|
793
|
-
'[testing-env/test_image:0:0/feature1] feature teardown session',
|
|
792
|
+
'[testing-env/test_image:0:0@session1] shell: "feature1" teardown session',
|
|
793
|
+
'[testing-env/test_image:0:0/feature1@session1] feature teardown session',
|
|
794
794
|
"[testing-env/test_image:0:0] session 'session1' ended",
|
|
795
795
|
'[testing-env/test_image:0:0] exiting_session -> setting_up',
|
|
796
|
-
'[testing-env/test_image:0:0] shell: "feature1" setup session',
|
|
797
|
-
'[testing-env/test_image:0:0/feature1] feature setup session',
|
|
796
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature1" setup session',
|
|
797
|
+
'[testing-env/test_image:0:0/feature1@<idle>] feature setup session',
|
|
798
798
|
'[testing-env/test_image:0:0] setting_up -> ready',
|
|
799
799
|
# pylint: enable=line-too-long
|
|
800
800
|
]
|
|
@@ -809,7 +809,7 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
809
809
|
)
|
|
810
810
|
with env:
|
|
811
811
|
with self.assertRaises(interface.SandboxStateError):
|
|
812
|
-
with env.sandbox(
|
|
812
|
+
with env.sandbox('session1') as sb:
|
|
813
813
|
sb.shell('echo foo', raise_error=RuntimeError)
|
|
814
814
|
self.assertEqual(len(sb.state_errors), 1)
|
|
815
815
|
self.assertEqual(sb.status, interface.Sandbox.Status.OFFLINE)
|
|
@@ -817,10 +817,10 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
817
817
|
self.event_handler.logs,
|
|
818
818
|
[
|
|
819
819
|
# pylint: disable=line-too-long
|
|
820
|
-
'[testing-env/test_image:0:0] shell: "feature1" setup',
|
|
820
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature1" setup',
|
|
821
821
|
'[testing-env/test_image:0:0/feature1] feature setup',
|
|
822
|
-
'[testing-env/test_image:0:0] shell: "feature1" setup session',
|
|
823
|
-
'[testing-env/test_image:0:0/feature1] feature setup session',
|
|
822
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature1" setup session',
|
|
823
|
+
'[testing-env/test_image:0:0/feature1@<idle>] feature setup session',
|
|
824
824
|
'[testing-env/test_image:0:0] created -> ready',
|
|
825
825
|
'[testing-env/test_image:0:0] sandbox started',
|
|
826
826
|
'[testing-env] environment started',
|
|
@@ -828,14 +828,14 @@ class BaseSandboxTests(unittest.TestCase):
|
|
|
828
828
|
'[testing-env/test_image:0:0] acquired -> setting_up',
|
|
829
829
|
'[testing-env/test_image:0:0] setting_up -> in_session',
|
|
830
830
|
"[testing-env/test_image:0:0] session 'session1' started",
|
|
831
|
-
'[testing-env/test_image:0:0
|
|
831
|
+
'[testing-env/test_image:0:0@session1] shell: echo foo with RuntimeError',
|
|
832
832
|
'[testing-env/test_image:0:0] in_session -> exiting_session',
|
|
833
|
-
'[testing-env/test_image:0:0
|
|
834
|
-
'[testing-env/test_image:0:0/feature1] feature teardown session',
|
|
833
|
+
'[testing-env/test_image:0:0@session1] shell: "feature1" teardown session',
|
|
834
|
+
'[testing-env/test_image:0:0/feature1@session1] feature teardown session',
|
|
835
835
|
"[testing-env/test_image:0:0] session 'session1' ended with SandboxStateError",
|
|
836
836
|
'[testing-env/test_image:0:0] exiting_session -> acquired',
|
|
837
837
|
'[testing-env/test_image:0:0] acquired -> shutting_down',
|
|
838
|
-
'[testing-env/test_image:0:0] shell: "feature1" teardown',
|
|
838
|
+
'[testing-env/test_image:0:0@<idle>] shell: "feature1" teardown',
|
|
839
839
|
'[testing-env/test_image:0:0/feature1] feature teardown',
|
|
840
840
|
'[testing-env/test_image:0:0] shutting_down -> offline',
|
|
841
841
|
'[testing-env/test_image:0:0] sandbox shutdown',
|
|
@@ -869,7 +869,7 @@ class SandboxActivityTests(unittest.TestCase):
|
|
|
869
869
|
sandbox_keepalive_interval=0,
|
|
870
870
|
)
|
|
871
871
|
with env:
|
|
872
|
-
with env.sandbox(
|
|
872
|
+
with env.sandbox('session1') as sb:
|
|
873
873
|
sb.rebind(
|
|
874
874
|
simulate_ping_error=interface.SandboxStateError,
|
|
875
875
|
skip_notification=True
|
|
@@ -889,7 +889,7 @@ class SandboxActivityTests(unittest.TestCase):
|
|
|
889
889
|
event_handler=event_handler,
|
|
890
890
|
)
|
|
891
891
|
with env:
|
|
892
|
-
with env.sandbox(
|
|
892
|
+
with env.sandbox('session1') as sb:
|
|
893
893
|
self.assertEqual(len(env.sandbox_pool), 1)
|
|
894
894
|
self.assertEqual(sb.status, interface.Sandbox.Status.IN_SESSION)
|
|
895
895
|
self.assertEqual(sb.session_id, 'session1')
|
|
@@ -909,22 +909,22 @@ class SandboxActivityTests(unittest.TestCase):
|
|
|
909
909
|
event_handler.logs,
|
|
910
910
|
[
|
|
911
911
|
# pylint: disable=line-too-long
|
|
912
|
-
'[testing-env/test_image:0:0] shell: "test_feature" setup',
|
|
912
|
+
'[testing-env/test_image:0:0@<idle>] shell: "test_feature" setup',
|
|
913
913
|
'[testing-env/test_image:0:0/test_feature] feature setup',
|
|
914
|
-
'[testing-env/test_image:0:0] shell: "test_feature" setup session',
|
|
914
|
+
'[testing-env/test_image:0:0@<idle>] shell: "test_feature" setup session',
|
|
915
915
|
'[testing-env/test_image:0:0] sandbox started',
|
|
916
916
|
'[testing-env] environment started',
|
|
917
917
|
"[testing-env/test_image:0:0] session 'session1' started",
|
|
918
|
-
'[testing-env/test_image:0:0
|
|
918
|
+
'[testing-env/test_image:0:0@session1] shell: "test_feature" teardown session',
|
|
919
919
|
"[testing-env/test_image:0:0] session 'session1' ended with SandboxStateError",
|
|
920
|
-
'[testing-env/test_image:0:0] shell: "test_feature" teardown',
|
|
920
|
+
'[testing-env/test_image:0:0@<idle>] shell: "test_feature" teardown',
|
|
921
921
|
'[testing-env/test_image:0:0/test_feature] feature teardown',
|
|
922
922
|
'[testing-env/test_image:0:0] sandbox shutdown',
|
|
923
|
-
'[testing-env/test_image:0:1] shell: "test_feature" setup',
|
|
923
|
+
'[testing-env/test_image:0:1@<idle>] shell: "test_feature" setup',
|
|
924
924
|
'[testing-env/test_image:0:1/test_feature] feature setup',
|
|
925
|
-
'[testing-env/test_image:0:1] shell: "test_feature" setup session',
|
|
925
|
+
'[testing-env/test_image:0:1@<idle>] shell: "test_feature" setup session',
|
|
926
926
|
'[testing-env/test_image:0:1] sandbox started',
|
|
927
|
-
'[testing-env/test_image:0:1] shell: "test_feature" teardown',
|
|
927
|
+
'[testing-env/test_image:0:1@<idle>] shell: "test_feature" teardown',
|
|
928
928
|
'[testing-env/test_image:0:1/test_feature] feature teardown',
|
|
929
929
|
'[testing-env/test_image:0:1] sandbox shutdown',
|
|
930
930
|
'[testing-env] environment shutdown'
|
|
@@ -959,9 +959,17 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
959
959
|
def on_sandbox_activity(
|
|
960
960
|
self,
|
|
961
961
|
name: str,
|
|
962
|
-
environment: interface.Environment,
|
|
963
962
|
sandbox: interface.Sandbox,
|
|
964
|
-
|
|
963
|
+
session_id: str | None,
|
|
964
|
+
duration: float,
|
|
965
|
+
error: BaseException | None,
|
|
966
|
+
**kwargs: Any):
|
|
967
|
+
self.calls.append((session_id, name, kwargs))
|
|
968
|
+
|
|
969
|
+
def on_feature_activity(
|
|
970
|
+
self,
|
|
971
|
+
name: str,
|
|
972
|
+
feature: interface.Feature,
|
|
965
973
|
session_id: str | None,
|
|
966
974
|
duration: float,
|
|
967
975
|
error: BaseException | None,
|
|
@@ -990,7 +998,7 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
990
998
|
|
|
991
999
|
def test_service_call_from_feature(self):
|
|
992
1000
|
with self.env:
|
|
993
|
-
with self.env.sandbox(
|
|
1001
|
+
with self.env.sandbox('session1') as sb:
|
|
994
1002
|
self.assertEqual(sb.test_feature.num_shell_calls(), 2)
|
|
995
1003
|
self.assertEqual(sb.test_feature.num_shell_calls(), 2)
|
|
996
1004
|
self.assertEqual(
|
|
@@ -998,19 +1006,19 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
998
1006
|
[
|
|
999
1007
|
# pylint: disable=line-too-long
|
|
1000
1008
|
'[testing-env] environment started',
|
|
1001
|
-
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1009
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" setup',
|
|
1002
1010
|
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1003
1011
|
'[testing-env/test_image:0] sandbox started',
|
|
1004
|
-
'[testing-env/test_image:0
|
|
1012
|
+
'[testing-env/test_image:0@session1] shell: "test_feature" setup session',
|
|
1005
1013
|
"[testing-env/test_image:0] session 'session1' started",
|
|
1006
|
-
'[testing-env/test_image:0/session1
|
|
1007
|
-
'[testing-env/test_image:0/session1
|
|
1008
|
-
'[testing-env/test_image:0
|
|
1014
|
+
'[testing-env/test_image:0/test_feature@session1] test_feature.num_shell_calls: None',
|
|
1015
|
+
'[testing-env/test_image:0/test_feature@session1] test_feature.num_shell_calls: None',
|
|
1016
|
+
'[testing-env/test_image:0@session1] shell: "test_feature" teardown session',
|
|
1009
1017
|
"[testing-env/test_image:0] session 'session1' ended",
|
|
1010
|
-
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1018
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" teardown',
|
|
1011
1019
|
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1012
1020
|
'[testing-env/test_image:0] sandbox shutdown',
|
|
1013
|
-
'[testing-env] environment shutdown'
|
|
1021
|
+
'[testing-env] environment shutdown',
|
|
1014
1022
|
# pylint: enable=line-too-long
|
|
1015
1023
|
]
|
|
1016
1024
|
)
|
|
@@ -1018,26 +1026,25 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1018
1026
|
def test_service_call_from_feature_with_error(self):
|
|
1019
1027
|
with self.env:
|
|
1020
1028
|
with self.assertRaises(interface.SandboxStateError):
|
|
1021
|
-
with self.env.sandbox(
|
|
1029
|
+
with self.env.sandbox('session1') as sb:
|
|
1022
1030
|
sb.test_feature.bad_shell_call()
|
|
1023
1031
|
self.assertEqual(sb.status, interface.Sandbox.Status.OFFLINE)
|
|
1024
1032
|
self.assertEqual(len(sb.state_errors), 1)
|
|
1025
|
-
|
|
1026
1033
|
self.assertEqual(
|
|
1027
1034
|
self.event_handler.logs,
|
|
1028
1035
|
[
|
|
1029
1036
|
# pylint: disable=line-too-long
|
|
1030
1037
|
'[testing-env] environment started',
|
|
1031
|
-
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1038
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" setup',
|
|
1032
1039
|
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1033
1040
|
'[testing-env/test_image:0] sandbox started',
|
|
1034
|
-
'[testing-env/test_image:0
|
|
1041
|
+
'[testing-env/test_image:0@session1] shell: "test_feature" setup session',
|
|
1035
1042
|
"[testing-env/test_image:0] session 'session1' started",
|
|
1036
|
-
'[testing-env/test_image:0
|
|
1037
|
-
'[testing-env/test_image:0/session1
|
|
1038
|
-
'[testing-env/test_image:0
|
|
1043
|
+
'[testing-env/test_image:0@session1] shell: bad command with RuntimeError',
|
|
1044
|
+
'[testing-env/test_image:0/test_feature@session1] test_feature.bad_shell_call: None with SandboxStateError',
|
|
1045
|
+
'[testing-env/test_image:0@session1] shell: "test_feature" teardown session',
|
|
1039
1046
|
"[testing-env/test_image:0] session 'session1' ended with SandboxStateError",
|
|
1040
|
-
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1047
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" teardown',
|
|
1041
1048
|
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1042
1049
|
'[testing-env/test_image:0] sandbox shutdown',
|
|
1043
1050
|
'[testing-env] environment shutdown'
|
|
@@ -1054,15 +1061,15 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1054
1061
|
[
|
|
1055
1062
|
# pylint: disable=line-too-long
|
|
1056
1063
|
'[testing-env] environment started',
|
|
1057
|
-
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1064
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" setup',
|
|
1058
1065
|
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1059
1066
|
'[testing-env/test_image:0] sandbox started',
|
|
1060
|
-
'[testing-env/test_image:0
|
|
1067
|
+
'[testing-env/test_image:0@test_feature-session-2291d8c] shell: "test_feature" setup session',
|
|
1061
1068
|
"[testing-env/test_image:0] session 'test_feature-session-2291d8c' started",
|
|
1062
|
-
'[testing-env/test_image:0/test_feature-session-2291d8c
|
|
1063
|
-
'[testing-env/test_image:0
|
|
1069
|
+
'[testing-env/test_image:0/test_feature@test_feature-session-2291d8c] test_feature.num_shell_calls: None',
|
|
1070
|
+
'[testing-env/test_image:0@test_feature-session-2291d8c] shell: "test_feature" teardown session',
|
|
1064
1071
|
"[testing-env/test_image:0] session 'test_feature-session-2291d8c' ended",
|
|
1065
|
-
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1072
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" teardown',
|
|
1066
1073
|
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1067
1074
|
'[testing-env/test_image:0] sandbox shutdown',
|
|
1068
1075
|
'[testing-env] environment shutdown'
|
|
@@ -1080,26 +1087,26 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1080
1087
|
[
|
|
1081
1088
|
# pylint: disable=line-too-long
|
|
1082
1089
|
'[testing-env] environment started',
|
|
1083
|
-
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1090
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" setup',
|
|
1084
1091
|
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1085
1092
|
'[testing-env/test_image:0] sandbox started',
|
|
1086
|
-
'[testing-env/test_image:0
|
|
1093
|
+
'[testing-env/test_image:0@session1] shell: "test_feature" setup session',
|
|
1087
1094
|
"[testing-env/test_image:0] session 'session1' started",
|
|
1088
|
-
'[testing-env/test_image:0
|
|
1089
|
-
'[testing-env/test_image:0/session1
|
|
1090
|
-
'[testing-env/test_image:0
|
|
1095
|
+
'[testing-env/test_image:0@session1] shell: bad command with RuntimeError',
|
|
1096
|
+
'[testing-env/test_image:0/test_feature@session1] test_feature.bad_shell_call: None with SandboxStateError',
|
|
1097
|
+
'[testing-env/test_image:0@session1] shell: "test_feature" teardown session',
|
|
1091
1098
|
"[testing-env/test_image:0] session 'session1' ended with SandboxStateError",
|
|
1092
|
-
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1099
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" teardown',
|
|
1093
1100
|
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1094
1101
|
'[testing-env/test_image:0] sandbox shutdown',
|
|
1095
|
-
'[testing-env] environment shutdown'
|
|
1102
|
+
'[testing-env] environment shutdown',
|
|
1096
1103
|
# pylint: enable=line-too-long
|
|
1097
1104
|
]
|
|
1098
1105
|
)
|
|
1099
1106
|
|
|
1100
1107
|
def test_service_context_manager_from_feature(self):
|
|
1101
1108
|
with self.env:
|
|
1102
|
-
with self.env.sandbox(
|
|
1109
|
+
with self.env.sandbox('session1') as sb:
|
|
1103
1110
|
with sb.test_feature.my_service() as service:
|
|
1104
1111
|
service.do('hello')
|
|
1105
1112
|
sb.shell('foo')
|
|
@@ -1109,19 +1116,19 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1109
1116
|
[
|
|
1110
1117
|
# pylint: disable=line-too-long
|
|
1111
1118
|
'[testing-env] environment started',
|
|
1112
|
-
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1119
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" setup',
|
|
1113
1120
|
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1114
1121
|
'[testing-env/test_image:0] sandbox started',
|
|
1115
|
-
'[testing-env/test_image:0
|
|
1122
|
+
'[testing-env/test_image:0@session1] shell: "test_feature" setup session',
|
|
1116
1123
|
"[testing-env/test_image:0] session 'session1' started",
|
|
1117
|
-
'[testing-env/test_image:0
|
|
1118
|
-
'[testing-env/test_image:0
|
|
1119
|
-
'[testing-env/test_image:0
|
|
1124
|
+
'[testing-env/test_image:0@session1] shell: hello',
|
|
1125
|
+
'[testing-env/test_image:0@session1] shell: foo',
|
|
1126
|
+
'[testing-env/test_image:0@session1] shell: "test_feature" teardown session',
|
|
1120
1127
|
"[testing-env/test_image:0] session 'session1' ended",
|
|
1121
|
-
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1128
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" teardown',
|
|
1122
1129
|
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1123
1130
|
'[testing-env/test_image:0] sandbox shutdown',
|
|
1124
|
-
'[testing-env] environment shutdown'
|
|
1131
|
+
'[testing-env] environment shutdown',
|
|
1125
1132
|
# pylint: enable=line-too-long
|
|
1126
1133
|
]
|
|
1127
1134
|
)
|
|
@@ -1129,7 +1136,7 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1129
1136
|
def test_service_context_manager_from_feature_with_error(self):
|
|
1130
1137
|
with self.env:
|
|
1131
1138
|
with self.assertRaises(interface.SandboxStateError):
|
|
1132
|
-
with self.env.sandbox(
|
|
1139
|
+
with self.env.sandbox('session1') as sb:
|
|
1133
1140
|
with sb.test_feature.my_service() as service:
|
|
1134
1141
|
service.do('hello', raise_error=interface.SandboxStateError)
|
|
1135
1142
|
self.assertEqual(sb.status, interface.Sandbox.Status.OFFLINE)
|
|
@@ -1139,18 +1146,18 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1139
1146
|
[
|
|
1140
1147
|
# pylint: disable=line-too-long
|
|
1141
1148
|
'[testing-env] environment started',
|
|
1142
|
-
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1149
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" setup',
|
|
1143
1150
|
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1144
1151
|
'[testing-env/test_image:0] sandbox started',
|
|
1145
|
-
'[testing-env/test_image:0
|
|
1152
|
+
'[testing-env/test_image:0@session1] shell: "test_feature" setup session',
|
|
1146
1153
|
"[testing-env/test_image:0] session 'session1' started",
|
|
1147
|
-
'[testing-env/test_image:0
|
|
1148
|
-
'[testing-env/test_image:0
|
|
1154
|
+
'[testing-env/test_image:0@session1] shell: hello with SandboxStateError',
|
|
1155
|
+
'[testing-env/test_image:0@session1] shell: "test_feature" teardown session',
|
|
1149
1156
|
"[testing-env/test_image:0] session 'session1' ended with SandboxStateError",
|
|
1150
|
-
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1157
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" teardown',
|
|
1151
1158
|
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1152
1159
|
'[testing-env/test_image:0] sandbox shutdown',
|
|
1153
|
-
'[testing-env] environment shutdown'
|
|
1160
|
+
'[testing-env] environment shutdown',
|
|
1154
1161
|
# pylint: enable=line-too-long
|
|
1155
1162
|
]
|
|
1156
1163
|
)
|
|
@@ -1169,29 +1176,29 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1169
1176
|
[
|
|
1170
1177
|
# pylint: disable=line-too-long
|
|
1171
1178
|
'[testing-env] environment started',
|
|
1172
|
-
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1179
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" setup',
|
|
1173
1180
|
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1174
1181
|
'[testing-env/test_image:0] sandbox started',
|
|
1175
|
-
'[testing-env/test_image:0
|
|
1182
|
+
'[testing-env/test_image:0@session1] shell: "test_feature" setup session',
|
|
1176
1183
|
"[testing-env/test_image:0] session 'session1' started",
|
|
1177
|
-
'[testing-env/test_image:0
|
|
1178
|
-
'[testing-env/test_image:0
|
|
1184
|
+
'[testing-env/test_image:0@session1] shell: foo',
|
|
1185
|
+
'[testing-env/test_image:0@session1] shell: "test_feature" teardown session',
|
|
1179
1186
|
"[testing-env/test_image:0] session 'session1' ended",
|
|
1180
|
-
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1187
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" teardown',
|
|
1181
1188
|
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1182
1189
|
'[testing-env/test_image:0] sandbox shutdown',
|
|
1183
|
-
'[testing-env/test_image:1] shell: "test_feature" setup',
|
|
1190
|
+
'[testing-env/test_image:1@<idle>] shell: "test_feature" setup',
|
|
1184
1191
|
'[testing-env/test_image:1/test_feature] feature setup',
|
|
1185
1192
|
'[testing-env/test_image:1] sandbox started',
|
|
1186
|
-
'[testing-env/test_image:1
|
|
1193
|
+
'[testing-env/test_image:1@test_feature-session-2291d8c] shell: "test_feature" setup session',
|
|
1187
1194
|
"[testing-env/test_image:1] session 'test_feature-session-2291d8c' started",
|
|
1188
|
-
'[testing-env/test_image:1
|
|
1189
|
-
'[testing-env/test_image:1
|
|
1195
|
+
'[testing-env/test_image:1@test_feature-session-2291d8c] shell: bar',
|
|
1196
|
+
'[testing-env/test_image:1@test_feature-session-2291d8c] shell: "test_feature" teardown session',
|
|
1190
1197
|
"[testing-env/test_image:1] session 'test_feature-session-2291d8c' ended",
|
|
1191
|
-
'[testing-env/test_image:1] shell: "test_feature" teardown',
|
|
1198
|
+
'[testing-env/test_image:1@<idle>] shell: "test_feature" teardown',
|
|
1192
1199
|
'[testing-env/test_image:1/test_feature] feature teardown',
|
|
1193
1200
|
'[testing-env/test_image:1] sandbox shutdown',
|
|
1194
|
-
'[testing-env] environment shutdown'
|
|
1201
|
+
'[testing-env] environment shutdown',
|
|
1195
1202
|
# pylint: enable=line-too-long
|
|
1196
1203
|
]
|
|
1197
1204
|
)
|
|
@@ -1207,18 +1214,18 @@ class SandboxServiceTests(unittest.TestCase):
|
|
|
1207
1214
|
[
|
|
1208
1215
|
# pylint: disable=line-too-long
|
|
1209
1216
|
'[testing-env] environment started',
|
|
1210
|
-
'[testing-env/test_image:0] shell: "test_feature" setup',
|
|
1217
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" setup',
|
|
1211
1218
|
'[testing-env/test_image:0/test_feature] feature setup',
|
|
1212
1219
|
'[testing-env/test_image:0] sandbox started',
|
|
1213
|
-
'[testing-env/test_image:0
|
|
1220
|
+
'[testing-env/test_image:0@test_feature-session-2291d8c] shell: "test_feature" setup session',
|
|
1214
1221
|
"[testing-env/test_image:0] session 'test_feature-session-2291d8c' started",
|
|
1215
|
-
'[testing-env/test_image:0
|
|
1216
|
-
'[testing-env/test_image:0
|
|
1222
|
+
'[testing-env/test_image:0@test_feature-session-2291d8c] shell: hello with SandboxStateError',
|
|
1223
|
+
'[testing-env/test_image:0@test_feature-session-2291d8c] shell: "test_feature" teardown session',
|
|
1217
1224
|
"[testing-env/test_image:0] session 'test_feature-session-2291d8c' ended with SandboxStateError",
|
|
1218
|
-
'[testing-env/test_image:0] shell: "test_feature" teardown',
|
|
1225
|
+
'[testing-env/test_image:0@<idle>] shell: "test_feature" teardown',
|
|
1219
1226
|
'[testing-env/test_image:0/test_feature] feature teardown',
|
|
1220
1227
|
'[testing-env/test_image:0] sandbox shutdown',
|
|
1221
|
-
'[testing-env] environment shutdown'
|
|
1228
|
+
'[testing-env] environment shutdown',
|
|
1222
1229
|
# pylint: enable=line-too-long
|
|
1223
1230
|
]
|
|
1224
1231
|
)
|