Fix annoying keychain errors when running integration tests on OS X
This was caused by the fact that you can't disable the osxkeychain helper if it's set at the system gitconfig (which is the default in recent git), and the git credential 'store' operation will call ALL helpers, not just the special one created for the integration tests. Because the test user environment doesn't have a keychain this caused lots of annoying popup error messages saying "A keychain could not be found to store X".
This commit is contained in:
parent
c98bc5be88
commit
332b22944e
@ -161,6 +161,17 @@ setup() {
|
||||
}
|
||||
cp "$HOME/.gitconfig" "$HOME/.gitconfig-backup"
|
||||
|
||||
if [[ `git config --system credential.helper | grep osxkeychain` == "osxkeychain" ]]
|
||||
then
|
||||
# Only OS X will encounter this
|
||||
# We can't disable osxkeychain and it gets called on store as well as ours,
|
||||
# reporting "A keychain cannot be found to store.." errors because the test
|
||||
# user env has no keychain; so create one
|
||||
# Note deliberately not using $HOME in case anything goes wrong overriding that,
|
||||
# we do not want to stomp on the user's main keychain by accident!
|
||||
security create-keychain -p pass $REMOTEDIR/home/Library/Keychains/login.keychain
|
||||
fi
|
||||
|
||||
wait_for_file "$LFS_URL_FILE"
|
||||
}
|
||||
|
||||
@ -175,6 +186,17 @@ shutdown() {
|
||||
if [ -s "$LFS_URL_FILE" ]; then
|
||||
curl "$(cat "$LFS_URL_FILE")/shutdown"
|
||||
fi
|
||||
[ -z "$KEEPTRASH" ] && rm -rf "$REMOTEDIR"
|
||||
|
||||
if [[ `git config --system credential.helper | grep osxkeychain` == "osxkeychain" ]]
|
||||
then
|
||||
# explicitly clean up keychain to make sure search list doesn't look for it
|
||||
# Note deliberately not using $HOME in case anything goes wrong overriding that,
|
||||
# we do not want to stomp on the user's main keychain by accident!
|
||||
security delete-keychain $REMOTEDIR/home/Library/Keychains/login.keychain
|
||||
fi
|
||||
|
||||
[ -z "$KEEPTRASH" ] && rm -rf "$REMOTEDIR"
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user