Skip to content

Commit c3255d5

Browse files
authored
Update FF test to integrate with new API calls (#1696)
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
1 parent c67da74 commit c3255d5

File tree

4 files changed

+188
-7
lines changed

4 files changed

+188
-7
lines changed

cypress/fixtures/plugins/dashboards-flow-framework/semantic_search/import_workflow.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"type": "create_ingest_pipeline",
1919
"previous_node_inputs": {},
2020
"user_inputs": {
21-
"configurations": "{\"description\":\"An ingest pipeline\",\"processors\":[{\"ml_inference\":{\"model_id\":\"jUssbZIBtUlObUc3aHho\",\"input_map\":[{\"inputText\":\"item_text\"}],\"output_map\":[{\"my_embedding\":\"embedding\"}],\"full_response_path\":false,\"ignore_missing\":false,\"ignore_failure\":false,\"model_config\":{}}}]}",
21+
"configurations": "{\"description\":\"An ingest pipeline\",\"processors\":[{\"ml_inference\":{\"model_id\":\"jUssbZIBtUlObUc3aHho\",\"input_map\":[{\"inputText\":\"item_text\"}],\"output_map\":[{\"my_embedding\":\"embedding\"}],\"full_response_path\":false,\"ignore_missing\":true,\"ignore_failure\":true,\"model_config\":{}}}]}",
2222
"pipeline_id": "ingest_pipeline_4112b7671c507097"
2323
}
2424
},
@@ -27,7 +27,7 @@
2727
"type": "create_search_pipeline",
2828
"previous_node_inputs": {},
2929
"user_inputs": {
30-
"configurations": "{\"request_processors\":[{\"ml_inference\":{\"model_id\":\"jUssbZIBtUlObUc3aHho\",\"input_map\":[{\"inputText\":\"query.term.item_text.value\"}],\"output_map\":[{\"vector\":\"embedding\"}],\"query_template\":\"{\\n \\\"_source\\\": {\\n \\\"excludes\\\": [\\n \\\"my_embedding\\\"\\n ]\\n },\\n \\\"query\\\": {\\n \\\"knn\\\": {\\n \\\"my_embedding\\\": {\\n \\\"vector\\\": ${vector},\\n \\\"k\\\": 10\\n }\\n }\\n }\\n}\",\"full_response_path\":false,\"ignore_missing\":false,\"ignore_failure\":false,\"model_config\":{}}}],\"response_processors\":[],\"phase_results_processors\":[]}",
30+
"configurations": "{\"request_processors\":[{\"ml_inference\":{\"model_id\":\"jUssbZIBtUlObUc3aHho\",\"input_map\":[{\"inputText\":\"query.term.item_text.value\"}],\"output_map\":[{\"vector\":\"embedding\"}],\"query_template\":\"{\\n \\\"_source\\\": {\\n \\\"excludes\\\": [\\n \\\"my_embedding\\\"\\n ]\\n },\\n \\\"query\\\": {\\n \\\"knn\\\": {\\n \\\"my_embedding\\\": {\\n \\\"vector\\\": ${vector},\\n \\\"k\\\": 10\\n }\\n }\\n }\\n}\",\"full_response_path\":false,\"ignore_missing\":true,\"ignore_failure\":true,\"model_config\":{}}}],\"response_processors\":[],\"phase_results_processors\":[]}",
3131
"pipeline_id": "search_pipeline_bbfed4e51c5f8b65"
3232
}
3333
},
@@ -135,12 +135,12 @@
135135
{
136136
"id": "ignore_missing",
137137
"type": "boolean",
138-
"value": false
138+
"value": true
139139
},
140140
{
141141
"id": "ignore_failure",
142142
"type": "boolean",
143-
"value": false
143+
"value": true
144144
},
145145
{
146146
"id": "max_prediction_tasks",
@@ -224,12 +224,12 @@
224224
{
225225
"id": "ignore_missing",
226226
"type": "boolean",
227-
"value": false
227+
"value": true
228228
},
229229
{
230230
"id": "ignore_failure",
231231
"type": "boolean",
232-
"value": false
232+
"value": true
233233
},
234234
{
235235
"id": "max_prediction_tasks",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
{
2+
"docs": [
3+
{
4+
"processor_results": [
5+
{
6+
"processor_type": "ml_inference",
7+
"status": "success",
8+
"doc": {
9+
"_index": "knn_index_1bb84aa",
10+
"_id": "_f3cdc2fc4c373d50",
11+
"_source": {
12+
"item_text": [
13+
"purpul high heels"
14+
],
15+
"item_price": 150
16+
},
17+
"_ingest": {
18+
"pipeline": "ingest_pipeline_380a8d4a2822af03",
19+
"timestamp": "2025-02-05T18:36:09.052476732Z"
20+
}
21+
}
22+
}
23+
]
24+
},
25+
{
26+
"processor_results": [
27+
{
28+
"processor_type": "ml_inference",
29+
"status": "success",
30+
"doc": {
31+
"_index": "knn_index_1bb84aa",
32+
"_id": "_ef32c6e3aea5ba0c",
33+
"_source": {
34+
"item_text": [
35+
"pair of jordans"
36+
],
37+
"item_price": 250
38+
},
39+
"_ingest": {
40+
"pipeline": "ingest_pipeline_380a8d4a2822af03",
41+
"timestamp": "2025-02-05T18:36:09.052485265Z"
42+
}
43+
}
44+
}
45+
]
46+
},
47+
{
48+
"processor_results": [
49+
{
50+
"processor_type": "ml_inference",
51+
"status": "success",
52+
"doc": {
53+
"_index": "knn_index_1bb84aa",
54+
"_id": "_0b6355fa93f0ea3d",
55+
"_source": {
56+
"item_text": [
57+
"baseball cleats"
58+
],
59+
"item_price": 85
60+
},
61+
"_ingest": {
62+
"pipeline": "ingest_pipeline_380a8d4a2822af03",
63+
"timestamp": "2025-02-05T18:36:09.052487251Z"
64+
}
65+
}
66+
}
67+
]
68+
},
69+
{
70+
"processor_results": [
71+
{
72+
"processor_type": "ml_inference",
73+
"status": "success",
74+
"doc": {
75+
"_index": "knn_index_1bb84aa",
76+
"_id": "_421a6a0714e06776",
77+
"_source": {
78+
"item_text": [
79+
"red pants"
80+
],
81+
"item_price": 95
82+
},
83+
"_ingest": {
84+
"pipeline": "ingest_pipeline_380a8d4a2822af03",
85+
"timestamp": "2025-02-05T18:36:09.052488989Z"
86+
}
87+
}
88+
}
89+
]
90+
},
91+
{
92+
"processor_results": [
93+
{
94+
"processor_type": "ml_inference",
95+
"status": "success",
96+
"doc": {
97+
"_index": "knn_index_1bb84aa",
98+
"_id": "_831d3b110de17a2c",
99+
"_source": {
100+
"item_text": [
101+
"blue skirt"
102+
],
103+
"item_price": 55
104+
},
105+
"_ingest": {
106+
"pipeline": "ingest_pipeline_380a8d4a2822af03",
107+
"timestamp": "2025-02-05T18:36:09.052494905Z"
108+
}
109+
}
110+
}
111+
]
112+
},
113+
{
114+
"processor_results": [
115+
{
116+
"processor_type": "ml_inference",
117+
"status": "success",
118+
"doc": {
119+
"_index": "knn_index_1bb84aa",
120+
"_id": "_d665b2eba6aaa1b3",
121+
"_source": {
122+
"item_text": [
123+
"orange tank top"
124+
],
125+
"item_price": 30
126+
},
127+
"_ingest": {
128+
"pipeline": "ingest_pipeline_380a8d4a2822af03",
129+
"timestamp": "2025-02-05T18:36:09.052497Z"
130+
}
131+
}
132+
}
133+
]
134+
},
135+
{
136+
"processor_results": [
137+
{
138+
"processor_type": "ml_inference",
139+
"status": "success",
140+
"doc": {
141+
"_index": "knn_index_1bb84aa",
142+
"_id": "_f6fba11d465ddf31",
143+
"_source": {
144+
"item_text": [
145+
"maroon shorts"
146+
],
147+
"item_price": 35
148+
},
149+
"_ingest": {
150+
"pipeline": "ingest_pipeline_380a8d4a2822af03",
151+
"timestamp": "2025-02-05T18:36:09.052516292Z"
152+
}
153+
}
154+
}
155+
]
156+
}
157+
]
158+
}

cypress/integration/plugins/dashboards-flow-framework/create_workflow_spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe('Creating Workflows Using Various Methods', () => {
124124
cy.getElementByDataTestId('updateSourceDataButton')
125125
.should('be.visible')
126126
.click();
127-
cy.mockIngestion(() => {
127+
cy.mockAllIngestActions(() => {
128128
cy.getElementByTestId('updateAndRunIngestButton')
129129
.should('be.visible')
130130
.click();

cypress/utils/plugins/dashboards-flow-framework/commands.js

+23
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,29 @@ Cypress.Commands.add('mockIngestion', (funcMockedOn) => {
124124
});
125125
});
126126

127+
Cypress.Commands.add('mockAllIngestActions', (funcMockedOn) => {
128+
cy.fixture(
129+
FF_FIXTURE_BASE_PATH + 'semantic_search/simulate_pipeline_response.json'
130+
).then((simulatePipelineResponse) => {
131+
cy.intercept('POST', /simulatePipeline/, {
132+
statusCode: 200,
133+
body: simulatePipelineResponse,
134+
}).as('simulatePipelineRequest');
135+
cy.fixture(
136+
FF_FIXTURE_BASE_PATH + 'semantic_search/ingest_response.json'
137+
).then((ingestResponse) => {
138+
cy.intercept('POST', INGEST_NODE_API_PATH, {
139+
statusCode: 200,
140+
body: ingestResponse,
141+
}).as('ingestionRequest');
142+
funcMockedOn();
143+
144+
cy.wait('@simulatePipelineRequest');
145+
cy.wait('@ingestionRequest');
146+
});
147+
});
148+
});
149+
127150
Cypress.Commands.add('mockSemanticSearchIndexSearch', (funcMockedOn) => {
128151
cy.fixture(
129152
FF_FIXTURE_BASE_PATH + 'semantic_search/search_response.json'

0 commit comments

Comments
 (0)