Skip to content

Commit 25f6011

Browse files
authored
fix(api): command intent and test (#15022)
## This is a copy of #15020
1 parent bd1f8da commit 25f6011

File tree

2 files changed

+120
-1
lines changed

2 files changed

+120
-1
lines changed

api/src/opentrons/protocol_engine/commands/hash_command_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def hash_protocol_command_params(
2828
The command hash, if the command is a protocol command.
2929
`None` if the command is a setup command.
3030
"""
31-
if create.intent != CommandIntent.PROTOCOL:
31+
if create.intent == CommandIntent.SETUP:
3232
return None
3333
# We avoid Python's built-in hash() function because it's not stable across
3434
# runs of the Python interpreter. (Jira RSS-215.)
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
test_name: Test that command keys in analysis and protocol run match for a deterministic protocol running using protocol engine
2+
3+
marks:
4+
- usefixtures:
5+
- ot2_server_base_url
6+
7+
stages:
8+
- name: Upload a protocol
9+
request:
10+
url: '{ot2_server_base_url}/protocols'
11+
method: POST
12+
files:
13+
files: 'tests/integration/protocols/basic_transfer_with_run_time_parameters.py'
14+
response:
15+
save:
16+
json:
17+
protocol_id: data.id
18+
analysis_id: data.analysisSummaries[0].id
19+
strict:
20+
- json:off
21+
status_code: 201
22+
23+
- name: Save command keys from protocol analysis
24+
max_retries: 5
25+
delay_after: 1
26+
request:
27+
url: '{ot2_server_base_url}/protocols/{protocol_id}/analyses/{analysis_id}'
28+
response:
29+
save:
30+
json:
31+
analysis_data: data
32+
home_cmd_key: data.commands[0].key
33+
plate_load_key: data.commands[1].key
34+
pipette_load_key: data.commands[3].key
35+
pick_up_tip_key: data.commands[4].key
36+
drop_tip_key: data.commands[7].key
37+
strict:
38+
- json:off
39+
json:
40+
data:
41+
id: '{analysis_id}'
42+
commands:
43+
- commandType: loadPipette
44+
45+
- name: Create run from protocol
46+
request:
47+
url: '{ot2_server_base_url}/runs'
48+
method: POST
49+
json:
50+
data:
51+
protocolId: '{protocol_id}'
52+
response:
53+
status_code: 201
54+
save:
55+
json:
56+
original_run_data: data
57+
run_id: data.id
58+
59+
- name: Play the run
60+
request:
61+
url: '{ot2_server_base_url}/runs/{run_id}/actions'
62+
method: POST
63+
json:
64+
data:
65+
actionType: play
66+
response:
67+
status_code: 201
68+
69+
- name: Wait for the protocol to complete
70+
max_retries: 5
71+
delay_after: 1
72+
request:
73+
url: '{ot2_server_base_url}/runs/{run_id}'
74+
method: GET
75+
response:
76+
status_code: 200
77+
strict:
78+
- json:off
79+
json:
80+
data:
81+
status: succeeded
82+
83+
- name: Verify commands have keys identical to their counterparts in analysis
84+
request:
85+
url: '{ot2_server_base_url}/runs/{run_id}/commands'
86+
method: GET
87+
response:
88+
strict:
89+
- json:off
90+
status_code: 200
91+
json:
92+
links:
93+
current:
94+
href: !anystr
95+
meta:
96+
runId: !anystr
97+
commandId: !anystr
98+
index: 7
99+
key: !anystr
100+
createdAt: !anystr
101+
meta:
102+
cursor: 0
103+
totalLength: 8
104+
data:
105+
- id: !anystr
106+
key: '{home_cmd_key}'
107+
commandType: home
108+
- id: !anystr
109+
key: '{plate_load_key}'
110+
commandType: loadLabware
111+
- id: !anystr
112+
key: '{pipette_load_key}'
113+
commandType: loadPipette
114+
- id: !anystr
115+
key: '{pick_up_tip_key}'
116+
commandType: pickUpTip
117+
- id: !anystr
118+
key: '{drop_tip_key}'
119+
commandType: dropTip

0 commit comments

Comments
 (0)