-
Notifications
You must be signed in to change notification settings - Fork 200
chore: implement respect_max_steps #1945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
24a9309
chore: implement respect_max_steps
RomanHotsiy 41b1c53
chore: remove recors from fake-db
DmitryAnansky 6a0160a
chore: fix git ignore
DmitryAnansky 198e7f2
chore: update e2e snapshot
DmitryAnansky 521233a
chore: fix json logs
RomanHotsiy 032a4a3
chore: fix types
RomanHotsiy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| fake-db.json |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,20 +1,3 @@ | ||
| { | ||
| "items": [ | ||
| { | ||
| "id": "a959", | ||
| "value": 9 | ||
| }, | ||
| { | ||
| "id": "1768", | ||
| "value": 6 | ||
| }, | ||
| { | ||
| "id": "6e43", | ||
| "value": 10 | ||
| }, | ||
| { | ||
| "id": "8cf3", | ||
| "value": 7 | ||
| } | ||
| ] | ||
| "items": [] | ||
| } |
165 changes: 165 additions & 0 deletions
165
__tests__/respect/max-steps/__snapshots__/max-steps.test.ts.snap
This file contains hidden or 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,165 @@ | ||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
|
||
| exports[`should quit an infinite loop on RESPECT_MAX_STEPS 1`] = ` | ||
| "──────────────────────────────────────────────────────────────────────────────── | ||
|
|
||
| Running workflow arazzo.yaml / infinite | ||
|
|
||
| ✗ GET /ping - step pre-step | ||
|
|
||
| Request URL: https://bad-api-url.com/api/ping | ||
|
|
||
| ✗ failed network request | ||
|
|
||
| Running failure action continue for the step pre-step | ||
|
|
||
| Running child workflow for the step with-nested | ||
| Running workflow arazzo.yaml / nested-workflow | ||
|
|
||
| ✗ GET /ping - step step-1 | ||
|
|
||
| Request URL: https://bad-api-url.com/api/ping | ||
|
|
||
| ✗ failed network request | ||
|
|
||
| Running failure action next-step for the step step-1 | ||
|
|
||
| ✗ GET /ping - step step-2 | ||
|
|
||
| Request URL: https://bad-api-url.com/api/ping | ||
|
|
||
| ✗ failed network request | ||
|
|
||
|
|
||
|
|
||
| ✗ GET /ping - step ping | ||
|
|
||
| Request URL: https://bad-api-url.com/api/ping | ||
|
|
||
| ✗ failed network request | ||
|
|
||
| Running failure action infinite-loop for the step ping | ||
|
|
||
| ✗ GET /ping - step ping | ||
|
|
||
| Request URL: https://bad-api-url.com/api/ping | ||
|
|
||
| ✗ failed network request | ||
|
|
||
| Running failure action infinite-loop for the step ping | ||
|
|
||
| ✗ GET /ping - step ping | ||
|
|
||
| Request URL: https://bad-api-url.com/api/ping | ||
|
|
||
| ✗ failed network request | ||
|
|
||
| Running failure action infinite-loop for the step ping | ||
|
|
||
| ✗ GET /ping - step ping | ||
|
|
||
| Request URL: https://bad-api-url.com/api/ping | ||
|
|
||
| ✗ failed network request | ||
|
|
||
| Running failure action infinite-loop for the step ping | ||
|
|
||
| ✗ GET /ping - step ping | ||
|
|
||
| Request URL: https://bad-api-url.com/api/ping | ||
|
|
||
| ✗ failed network request | ||
|
|
||
| Running failure action infinite-loop for the step ping | ||
|
|
||
| ✗ GET /ping - step ping | ||
|
|
||
| Request URL: https://bad-api-url.com/api/ping | ||
|
|
||
| ✗ failed network request | ||
|
|
||
| Running failure action infinite-loop for the step ping | ||
|
|
||
| ✗ GET /ping - step ping | ||
|
|
||
| Request URL: https://bad-api-url.com/api/ping | ||
|
|
||
| ✗ failed network request | ||
|
|
||
| Running failure action infinite-loop for the step ping | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| Failed tests info: | ||
|
|
||
| Workflow name: infinite | ||
|
|
||
| stepId - pre-step | ||
| ✗ failed network request | ||
| fetch failed | ||
|
|
||
| stepId - step-1 | ||
| ✗ failed network request | ||
| fetch failed | ||
|
|
||
| stepId - step-2 | ||
| ✗ failed network request | ||
| fetch failed | ||
|
|
||
| stepId - ping | ||
| ✗ failed network request | ||
| fetch failed | ||
|
|
||
| stepId - ping | ||
| ✗ failed network request | ||
| fetch failed | ||
|
|
||
| stepId - ping | ||
| ✗ failed network request | ||
| fetch failed | ||
|
|
||
| stepId - ping | ||
| ✗ failed network request | ||
| fetch failed | ||
|
|
||
| stepId - ping | ||
| ✗ failed network request | ||
| fetch failed | ||
|
|
||
| stepId - ping | ||
| ✗ failed network request | ||
| fetch failed | ||
|
|
||
| stepId - ping | ||
| ✗ failed network request | ||
| fetch failed | ||
|
|
||
| stepId - ping | ||
| ✗ unexpected error | ||
| Reason: Max steps (10) reached | ||
| Summary for arazzo.yaml | ||
|
|
||
| Workflows: 1 failed, 1 total | ||
| Steps: 11 failed, 11 total | ||
| Checks: 11 failed, 11 total | ||
| Time: <test>ms | ||
|
|
||
|
|
||
| ┌─────────────────────────────────────────────────────┬────────────┬─────────┬─────────┬──────────┬─────────┐ | ||
| │ Filename │ Workflows │ Passed │ Failed │ Warnings │ Skipped │ | ||
| ├─────────────────────────────────────────────────────┼────────────┼─────────┼─────────┼──────────┼─────────┤ | ||
| │ x arazzo.yaml │ 1 │ 0 │ 1 │ - │ - │ | ||
| └─────────────────────────────────────────────────────┴────────────┴─────────┴─────────┴──────────┴─────────┘ | ||
|
|
||
|
|
||
|
|
||
| Tests exited with error | ||
| " | ||
| `; |
This file contains hidden or 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,47 @@ | ||
| arazzo: 1.0.1 | ||
| info: | ||
| title: Arazzo | ||
| version: 1.0.0 | ||
| description: Test infinite loop | ||
| sourceDescriptions: | ||
| - name: oas | ||
| type: openapi | ||
| url: ./oas.yaml | ||
| workflows: | ||
| - workflowId: infinite | ||
| steps: | ||
| - stepId: pre-step | ||
| description: Pre-step | ||
| operationId: ping | ||
| onFailure: | ||
| - name: continue | ||
| type: goto | ||
| stepId: with-nested | ||
|
|
||
| - stepId: with-nested | ||
| description: With nested workflow | ||
| workflowId: nested-workflow | ||
|
|
||
| - stepId: ping | ||
| description: Ping the API | ||
| operationId: ping | ||
| onFailure: | ||
| - name: infinite-loop | ||
| type: goto | ||
| stepId: ping | ||
|
|
||
| - workflowId: nested-workflow | ||
| steps: | ||
| - stepId: step-1 | ||
| description: Step 1 | ||
| operationId: ping | ||
| onFailure: | ||
| - name: next-step | ||
| type: goto | ||
| stepId: step-2 | ||
| - stepId: step-2 | ||
| description: Step 2 | ||
| operationId: ping | ||
| onFailure: | ||
| - name: end | ||
| type: end |
This file contains hidden or 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,20 @@ | ||
| import { getParams, getCommandOutput } from '../utils'; | ||
| import { join } from 'path'; | ||
|
|
||
| test('should quit an infinite loop on RESPECT_MAX_STEPS', () => { | ||
| const indexEntryPoint = join(process.cwd(), 'packages/cli/lib/index.js'); | ||
| const fixturesPath = join(__dirname, 'arazzo.yaml'); | ||
| const args = getParams(indexEntryPoint, [ | ||
| 'respect', | ||
| fixturesPath, | ||
| '--verbose', | ||
| '--workflow', | ||
| 'infinite', | ||
| ]); | ||
|
|
||
| const result = getCommandOutput(args, { | ||
| RESPECT_MAX_STEPS: '10', | ||
| }); | ||
|
|
||
| expect(result).toMatchSnapshot(); | ||
| }); |
This file contains hidden or 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,18 @@ | ||
| openapi: 3.1.0 | ||
| info: | ||
| title: Arazzo | ||
| version: 1.0.0 | ||
| description: Arazzo API | ||
| license: | ||
| name: MIT | ||
| servers: | ||
| - url: https://bad-api-url.com/api | ||
| paths: | ||
| /ping: | ||
| get: | ||
| security: [] | ||
| summary: Ping | ||
| operationId: ping | ||
| responses: | ||
| '200': | ||
| description: A list of users |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.