-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tests for papi and json play and stop in the middle of a run
- Loading branch information
1 parent
c5249d3
commit 6c812d6
Showing
4 changed files
with
277 additions
and
0 deletions.
There are no files selected for viewing
114 changes: 114 additions & 0 deletions
114
robot-server/tests/integration/http_api/runs/test_play_stop_papi.tavern.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
test_name: Test python protocol run commands are failed when stopped. | ||
|
||
marks: | ||
- usefixtures: | ||
- ot2_server_base_url | ||
stages: | ||
- name: Upload a python protocol | ||
request: | ||
url: '{ot2_server_base_url}/protocols' | ||
method: POST | ||
files: | ||
files: 'tests/integration/protocols/wait_for_resume_stop_papi.py' | ||
response: | ||
status_code: 201 | ||
save: | ||
json: | ||
protocol_id: data.id | ||
|
||
- name: Create run from protocol | ||
request: | ||
url: '{ot2_server_base_url}/runs' | ||
method: POST | ||
json: | ||
data: | ||
protocolId: '{protocol_id}' | ||
response: | ||
status_code: 201 | ||
save: | ||
json: | ||
run_id: data.id | ||
|
||
- name: Play the run | ||
request: | ||
url: '{ot2_server_base_url}/runs/{run_id}/actions' | ||
method: POST | ||
json: | ||
data: | ||
actionType: play | ||
response: | ||
status_code: 201 | ||
|
||
- name: Stop the run | ||
request: | ||
url: '{ot2_server_base_url}/runs/{run_id}/actions' | ||
method: POST | ||
json: | ||
data: | ||
actionType: stop | ||
response: | ||
status_code: 201 | ||
|
||
- name: Wait for the run to complete | ||
max_retries: 10 | ||
delay_after: 0.2 | ||
request: | ||
url: '{ot2_server_base_url}/runs/{run_id}' | ||
method: GET | ||
response: | ||
status_code: 200 | ||
strict: | ||
- json:off | ||
json: | ||
data: | ||
status: stopped | ||
|
||
- name: Get run commands | ||
max_retries: 10 | ||
delay_after: 0.2 | ||
request: | ||
url: '{ot2_server_base_url}/runs/{run_id}/commands' | ||
method: GET | ||
response: | ||
status_code: 200 | ||
strict: | ||
- json:off | ||
json: | ||
data: | ||
- id: !anystr | ||
key: !anystr | ||
commandType: home | ||
createdAt: !anystr | ||
startedAt: !anystr | ||
completedAt: !anystr | ||
status: succeeded | ||
params: {} | ||
notes: [] | ||
- id: !anystr | ||
key: !anystr | ||
commandType: home | ||
createdAt: !anystr | ||
startedAt: !anystr | ||
completedAt: !anystr | ||
status: succeeded | ||
params: { } | ||
notes: [ ] | ||
- id: !anystr | ||
key: !anystr | ||
commandType: waitForResume | ||
createdAt: !anystr | ||
startedAt: !anystr | ||
completedAt: !anystr | ||
status: failed | ||
params: { } | ||
notes: [ ] | ||
error: | ||
createdAt: !anystr | ||
detail: 'Run was cancelled' | ||
errorCode: '4000' | ||
errorInfo: { } | ||
errorType: 'RunStoppedError' | ||
id: !anystr | ||
wrappedErrors: [ ] | ||
|
||
|
114 changes: 114 additions & 0 deletions
114
robot-server/tests/integration/http_api/runs/test_play_stop_v6.tavern.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
test_name: Test a JSONv6 run can be paused and then cancelled. | ||
|
||
marks: | ||
- usefixtures: | ||
- ot2_server_base_url | ||
stages: | ||
- name: Upload a JSONv6 protocol | ||
request: | ||
url: '{ot2_server_base_url}/protocols' | ||
method: POST | ||
files: | ||
files: 'tests/integration/protocols/wait_for_resume_stop_v6.json' | ||
response: | ||
status_code: 201 | ||
save: | ||
json: | ||
protocol_id: data.id | ||
|
||
- name: Create run from protocol | ||
request: | ||
url: '{ot2_server_base_url}/runs' | ||
method: POST | ||
json: | ||
data: | ||
protocolId: '{protocol_id}' | ||
response: | ||
status_code: 201 | ||
save: | ||
json: | ||
run_id: data.id | ||
|
||
- name: Play the run | ||
request: | ||
url: '{ot2_server_base_url}/runs/{run_id}/actions' | ||
method: POST | ||
json: | ||
data: | ||
actionType: play | ||
response: | ||
status_code: 201 | ||
|
||
- name: Stop the run | ||
request: | ||
url: '{ot2_server_base_url}/runs/{run_id}/actions' | ||
method: POST | ||
json: | ||
data: | ||
actionType: stop | ||
response: | ||
status_code: 201 | ||
|
||
- name: Wait for the run to complete | ||
max_retries: 10 | ||
delay_after: 0.2 | ||
request: | ||
url: '{ot2_server_base_url}/runs/{run_id}' | ||
method: GET | ||
response: | ||
status_code: 200 | ||
strict: | ||
- json:off | ||
json: | ||
data: | ||
status: stopped | ||
|
||
- name: Get run commands | ||
max_retries: 10 | ||
delay_after: 0.2 | ||
request: | ||
url: '{ot2_server_base_url}/runs/{run_id}/commands' | ||
method: GET | ||
response: | ||
status_code: 200 | ||
strict: | ||
- json:off | ||
json: | ||
data: | ||
- id: !anystr | ||
key: !anystr | ||
commandType: home | ||
createdAt: !anystr | ||
startedAt: !anystr | ||
completedAt: !anystr | ||
status: succeeded | ||
params: {} | ||
notes: [] | ||
- id: !anystr | ||
key: !anystr | ||
commandType: home | ||
createdAt: !anystr | ||
startedAt: !anystr | ||
completedAt: !anystr | ||
status: succeeded | ||
params: { } | ||
notes: [ ] | ||
- id: !anystr | ||
key: !anystr | ||
commandType: waitForResume | ||
createdAt: !anystr | ||
startedAt: !anystr | ||
completedAt: !anystr | ||
status: failed | ||
params: { } | ||
notes: [ ] | ||
error: | ||
createdAt: !anystr | ||
detail: 'Run was cancelled' | ||
errorCode: '4000' | ||
errorInfo: { } | ||
errorType: 'RunStoppedError' | ||
id: !anystr | ||
wrappedErrors: [ ] | ||
|
||
|
13 changes: 13 additions & 0 deletions
13
robot-server/tests/integration/protocols/wait_for_resume_stop_papi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from opentrons.protocol_api import ProtocolContext | ||
|
||
metadata = { | ||
"protocolName": "stop while waiting test", | ||
"author": "Opentrons <[email protected]>", | ||
"apiLevel": "2.15", | ||
} | ||
|
||
|
||
def run(ctx: ProtocolContext) -> None: | ||
ctx.home() | ||
ctx.pause() | ||
ctx.set_rail_lights(on=True) |
36 changes: 36 additions & 0 deletions
36
robot-server/tests/integration/protocols/wait_for_resume_stop_v6.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"$otSharedSchema": "#/protocol/schemas/6", | ||
"schemaVersion": 6, | ||
"metadata": { | ||
"protocolName": "Simple test protocol", | ||
"author": "engineering <[email protected]>", | ||
"description": "A short test protocol", | ||
"created": 1223131231, | ||
"tags": ["unitTest"] | ||
}, | ||
"robot": { | ||
"model": "OT-2 Standard", | ||
"deckId": "ot2_standard" | ||
}, | ||
"pipettes": {}, | ||
"modules": {}, | ||
"labware": {}, | ||
"liquids": {}, | ||
"labwareDefinitions": {}, | ||
"commands": [ | ||
{ | ||
"commandType": "home", | ||
"params": {} | ||
}, | ||
{ | ||
"commandType": "waitForResume", | ||
"params": { | ||
} | ||
}, | ||
{ | ||
"commandType": "home", | ||
"params": {} | ||
} | ||
], | ||
"commandAnnotations": [] | ||
} |