-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix: tests now work with different sh implementations #3505
Conversation
4915d8d introduced output checking of failing commands in workflow hook script tests. However, the output from sh is not stable between different platforms, so this broke tests on at least Mac OS X. The following commands have unstable output between architectures: sh -c "echo 'a" sh -c "lkjlkj" Fix by interpreting empty expected output as any output is valid in this test.
cc @X-Guardian |
Thank you @finnag for contributing this. Are you running atlantis on macos? Since you, @X-Guardian , contributed #3422, could you be a second pair of eyes and review this PR to ensure this works and is implemented as expected? |
@finnag, please detail the exact output you saw on the mac. It would be better to adjust the check to cope with the various output differences rather than ignore the check altogether. |
I sometimes develop on a mac, and run atlantis locally while developing. That's where I usually run the tests. In production it runs on a linux server somewhere. Looks like mac outputs the same as centos. There are many sh variants, here are some:
and for the unknown command:
|
@X-Guardian what do you think? the current tests require dash as /bin/sh. fails with bash (macos, centos) and busybox/ash (alpine). Doesn't feel necessary to force developers to use dash or docker to run the tests. |
I agree with @finnag here, we shouldn't be checking for shell outputs in unit tests. If we really feel it's vital to be checking shell outputs as part of testing, it should be moved to e2e tests where proper testing against different shell programs can be setup and performed. |
Head branch was pushed to by a user without write access
updated to match latest main. |
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month. |
There is now an alternative fix for this in main, so this is no longer required. |
what
Ignore output from commands that test failure scenarios with sh in workflow hooks
why
4915d8d introduced output checking of failing commands in workflow hook script tests. However, the output from sh is not stable between different platforms, so this broke tests on at least Mac OS X.
The following commands have unstable output between architectures:
sh -c "echo 'a"
sh -c "jlkjlkefjelkfjelkfj"
Fix by interpreting empty expected output as any output is valid in this test.
tests
I have tested my changes by
references