Commit ca26dca
authored
Run integration test in $TMPDIR or /tmp (#279)
### 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'...
```1 parent 03e15cd commit ca26dca
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
0 commit comments