mirror of
https://github.com/ryantm/agenix.git
synced 2024-11-22 17:50:48 +03:00
dev: reland add direct tests for agenix
Why === * We'd like some tests for the CLI * Last time we tried it failed on macos What changed === * This time, we try to create the temp diretory in a way that works with macos too
This commit is contained in:
parent
bc24f2e510
commit
a23aa271be
1 changed files with 10 additions and 5 deletions
|
@ -30,10 +30,15 @@ in
|
||||||
shellcheck ${bin}
|
shellcheck ${bin}
|
||||||
${bin} -h | grep ${version}
|
${bin} -h | grep ${version}
|
||||||
|
|
||||||
mkdir -p /tmp/home/.ssh
|
HOME=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
|
||||||
cp -r "${../example}" /tmp/home/secrets
|
function cleanup {
|
||||||
chmod -R u+rw /tmp/home/secrets
|
rm -rf $HOME
|
||||||
export HOME=/tmp/home
|
}
|
||||||
|
trap "cleanup" 0 2 3 15
|
||||||
|
|
||||||
|
mkdir -p $HOME/.ssh
|
||||||
|
cp -r "${../example}" $HOME/secrets
|
||||||
|
chmod -R u+rw $HOME/secrets
|
||||||
(
|
(
|
||||||
umask u=rw,g=r,o=r
|
umask u=rw,g=r,o=r
|
||||||
cp ${../example_keys/user1.pub} $HOME/.ssh/id_ed25519.pub
|
cp ${../example_keys/user1.pub} $HOME/.ssh/id_ed25519.pub
|
||||||
|
@ -45,7 +50,7 @@ in
|
||||||
chown $UID $HOME/.ssh/id_ed25519
|
chown $UID $HOME/.ssh/id_ed25519
|
||||||
)
|
)
|
||||||
|
|
||||||
cd /tmp/home/secrets
|
cd $HOME/secrets
|
||||||
test $(${bin} -d secret1.age) = "hello"
|
test $(${bin} -d secret1.age) = "hello"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue