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

Run integration test in $TMPDIR or /tmp #279

Merged

Conversation

simonjbeaumont
Copy link
Collaborator

Motivation

Our CI workspace is filling up with integration test runs. This is because they are created in a temporary directory within the current working directory.

Modifications

In the integration test script, do everything under $TMPDIR or /tmp, if $TMPDIR is unset.

Note that this script needs to run on macOS and Linux so we have used a set of arguments to mktemp which results in similar behaviour on both platforms:

# macOS
❯ mktemp -u -d -p ${TMPDIR-/tmp} d.XXXXXX
/var/folders/06/__qdhxzn7ld3_bsvfcfz0kch0000gn/T//d.HLKbxa

❯ export TMPDIR=/tmp

❯ mktemp -u -d -p ${TMPDIR-/tmp} d.XXXXXX
/tmp/d.VcrPx7
# Linux
root@c548c02e41b1:/code# mktemp -u -d -p ${TMPDIR-/tmp} d.XXXXXX
/tmp/d.cfDcwc
root@c548c02e41b1:/code# export TMPDIR=/var/tmp
root@c548c02e41b1:/code# mktemp -u -d -p ${TMPDIR-/tmp} d.XXXXXX
/var/tmp/d.aah3FR

Note also that, on macOS, the XXXXXX needs to be at the end, so we've had to stop adding .noindex to the end of the directory name.

Result

No longer clogging up CI workspace with integration test builds.

Test Plan

Tested locally and in docker-compose:

# docker-compose logs
** Checking required executables...
** Cloning file:///code to /tmp/run-integration-test.sh.KBytC5cXAS/code
Cloning into '/tmp/run-integration-test.sh.KBytC5cXAS/code'...
# macOS logs
** Checking required executables...
** Cloning https://github.com/apple/swift-openapi-generator to /var/folders/06/__qdhxzn7ld3_bsvfcfz0kch0000gn/T//run-integration-test.sh.eO0Lt7O0TM/swift-openapi-generator
Cloning into '/var/folders/06/__qdhxzn7ld3_bsvfcfz0kch0000gn/T//run-integration-test.sh.eO0Lt7O0TM/swift-openapi-generator'...

@simonjbeaumont simonjbeaumont marked this pull request as ready for review September 15, 2023 17:57
@simonjbeaumont simonjbeaumont merged commit ca26dca into apple:main Sep 15, 2023
@czechboy0 czechboy0 added the semver/none No version bump required. label Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/none No version bump required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants