... |
... |
@@ -216,51 +216,6 @@ def test_work_rejected_by_bot(bot_session, context, instance): |
216
|
216
|
context.set_code.assert_called_once_with(grpc.StatusCode.UNIMPLEMENTED)
|
217
|
217
|
|
218
|
218
|
|
219
|
|
-@pytest.mark.parametrize("state", [LeaseState.LEASE_STATE_UNSPECIFIED, LeaseState.PENDING])
|
220
|
|
-def test_work_out_of_sync_from_pending(state, bot_session, context, instance):
|
221
|
|
- request = bots_pb2.CreateBotSessionRequest(parent='',
|
222
|
|
- bot_session=bot_session)
|
223
|
|
- # Inject work
|
224
|
|
- action_digest = remote_execution_pb2.Digest(hash='gaff')
|
225
|
|
- instance._instance._scheduler.append_job(job.Job(action_digest))
|
226
|
|
- # Simulated the severed binding between client and server
|
227
|
|
- bot = copy.deepcopy(instance.CreateBotSession(request, context))
|
228
|
|
-
|
229
|
|
- request = bots_pb2.UpdateBotSessionRequest(name=bot.name,
|
230
|
|
- bot_session=bot)
|
231
|
|
-
|
232
|
|
- response = copy.deepcopy(instance.UpdateBotSession(request, context))
|
233
|
|
-
|
234
|
|
- response.leases[0].state = state.value
|
235
|
|
-
|
236
|
|
- request = bots_pb2.UpdateBotSessionRequest(name=response.name,
|
237
|
|
- bot_session=response)
|
238
|
|
-
|
239
|
|
- response = instance.UpdateBotSession(request, context)
|
240
|
|
-
|
241
|
|
- context.set_code.assert_called_once_with(grpc.StatusCode.DATA_LOSS)
|
242
|
|
-
|
243
|
|
-
|
244
|
|
-@pytest.mark.parametrize("state", [LeaseState.LEASE_STATE_UNSPECIFIED, LeaseState.PENDING])
|
245
|
|
-def test_work_out_of_sync_from_active(state, bot_session, context, instance):
|
246
|
|
- request = bots_pb2.CreateBotSessionRequest(parent='',
|
247
|
|
- bot_session=bot_session)
|
248
|
|
- # Inject work
|
249
|
|
- action_digest = remote_execution_pb2.Digest(hash='gaff')
|
250
|
|
- instance._instance._scheduler.append_job(job.Job(action_digest))
|
251
|
|
- # Simulated the severed binding between client and server
|
252
|
|
- bot = copy.deepcopy(instance.CreateBotSession(request, context))
|
253
|
|
-
|
254
|
|
- request = bots_pb2.UpdateBotSessionRequest(name=bot.name,
|
255
|
|
- bot_session=bot)
|
256
|
|
-
|
257
|
|
- response = copy.deepcopy(instance.UpdateBotSession(request, context))
|
258
|
|
-
|
259
|
|
- response = instance.UpdateBotSession(request, context)
|
260
|
|
-
|
261
|
|
- context.set_code.assert_called_once_with(grpc.StatusCode.UNIMPLEMENTED)
|
262
|
|
-
|
263
|
|
-
|
264
|
219
|
@pytest.mark.parametrize("state", [LeaseState.LEASE_STATE_UNSPECIFIED, LeaseState.PENDING])
|
265
|
220
|
def test_work_out_of_sync_from_pending(state, bot_session, context, instance):
|
266
|
221
|
request = bots_pb2.CreateBotSessionRequest(parent='',
|