goss-org / goss

Quick and Easy server testing/validation
https://goss.rocks
Apache License 2.0
5.5k stars 470 forks source link

Fix run-validate-tests.sh to run "make test-int-validate-darwin-amd64" on local Mac #830

Closed matsuo closed 11 months ago

matsuo commented 11 months ago
Checklist

Description of change

This pull request fixes run-validate-tests.sh to run "make test-int-validate-darwin-amd64" on local Mac.

On macOS, "make test-int-validate-darwin-amd64" failed because there is no readarray command in the default environment.

% sw_vers 
ProductName:        macOS
ProductVersion:     13.5
BuildVersion:       22G74
% make test-int-validate-darwin-amd64
INFO: Starting build test-int-validate-darwin-amd64
./integration-tests/run-validate-tests.sh darwin-amd64
Using: '/Users/USERNAME/go/src/github.com/goss-org/goss/release/goss-darwin-amd64', cwd: '/Users/USERNAME/go/src/github.com/goss-org/goss', os: darwin
./integration-tests/run-validate-tests.sh: line 24: readarray: command not found
panic: uncaught error
Traceback (most recent call first):
  at ./integration-tests/run-validate-tests.sh:24 in main()
readarray -t goss_test_files < <(find integration-tests -type f -name "*.goss.yaml" | grep "${os}" | sort | uniq) exited 127
make: *** [test-int-validate-darwin-amd64] Error 127
% panic: uncaught error
Traceback (most recent call first):
  at ./integration-tests/run-validate-tests.sh:24 in main()
uniq exited 141
aelsabbahy commented 11 months ago

I wonder if in the future it'll make sense to maintain a different set of shell scripts for osx.

Past experience is things 90-95% work across Linux and osx, but then there's always subtle differences.

Like mktemp, md5sum, sed -i flag, etc.

Thanks for the PR!