[go: up one dir, main page]

Skip to content
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

exec: add a 'stdin' attribute #767

Merged
merged 1 commit into from
Mar 28, 2024
Merged

exec: add a 'stdin' attribute #767

merged 1 commit into from
Mar 28, 2024

Conversation

cdevienne
Copy link
Contributor

If set, the value is written to the script stdin. This avoid the need to use 'echo' in the script, which makes thing clearer.

It is also particularly useful in the following case (probably other issues with variable substitution):

name: simple_test
vars:
  payload: {"s": "\n"}
testcases:
- name: simple_test
  steps:
  - type: exec
    script: echo {{.payload | toJSON}} | jq .
    assertions:
    - result.code MustEqual 0

This will fail because the \n is not properly escaped.

Using the new stdin attribute solves the issue:

name: simple_test
vars:
  payload: {"s": "\n"}
testcases:
- name: simple_test
  steps:
  - type: exec
    stdin: {{.payload | toJSON}}
    script: jq .
    assertions:
    - result.code MustEqual 0

If set, the value is written to the script stdin. This avoid the need to use 'echo' in the script.

Signed-off-by: Christophe de Vienne <christophe.devienne@orus.io>
@ovh-cds
Copy link
Collaborator
ovh-cds commented Mar 28, 2024

CDS Report build-venom-a#173.0 ✘

  • Build
    • Build ✔
    • Unit Tests ✔
  • Tests
    • Acceptance Tests ✘

@yesnault yesnault merged commit 2225450 into ovh:master Mar 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants