metalbear-co / mirrord

Connect your local process and your cloud environment, and run local code in cloud conditions.
https://mirrord.dev
MIT License
3.79k stars 103 forks source link

Add integration tests for a bash script #200

Open eyalb181 opened 2 years ago

eyalb181 commented 2 years ago

A possible use case for mirrord is running commands in bash as if it's running in the remote pod. Please add e2e tests that verify file reads, file writes, and environment variables access work for a bash script run with mirrord.

DmitryDodzin commented 2 years ago

After some testing it appears that the simplest and most common way of testing if "file exist" uses a not yet supported sys-call faccessat

FILE=/etc/resolv.conf
if [ -f "$FILE" ]; then
    echo "$FILE exists."
fi

the [ -f "$FILE" ]; or test -f "$FILE"; are the culprits -> faccessat2(AT_FDCWD, "/etc/resolv.conf", R_OK, AT_EACCESS)