Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Prevent git port-forward from making bats hang
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddeco committed Nov 5, 2019
1 parent 728128a commit 1b52618
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/e2e/20_commit_signing.bats
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function setup() {
}

function teardown() {
# Teardown the created port-forward to gitsrv and restore Git settings.
# Teardown the created port-forward to gitsrv.
kill "$git_port_forward_pid"
# Kill the agent and remove temporary GNUPGHOME
gpgconf --kill gpg-agent
Expand Down
11 changes: 7 additions & 4 deletions test/e2e/20_commit_verification.bats
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bats

load lib/defer
load lib/env
load lib/gpg
load lib/install
load lib/poll

tmp_gnupghome=""
git_port_forward_pid=""

function setup() {
kubectl create namespace "${FLUX_NAMESPACE}"
Expand All @@ -32,6 +32,7 @@ function setup() {
git_ssh_cmd="${git_srv_result[0]}"
export GIT_SSH_COMMAND="$git_ssh_cmd"

# shellcheck disable=SC2030
git_port_forward_pid="${git_srv_result[1]}"
defer kill "$git_port_forward_pid"

Expand Down Expand Up @@ -78,9 +79,8 @@ function setup() {
gpg_key=$(create_gpg_key)
create_secret_from_gpg_key "$gpg_key"

# Install the git server with _unsigned_ init commit,
# allowing external access
install_git_srv flux-git-deploy git_srv_result false
# Install the git server with _unsigned_ init commit
install_git_srv flux-git-deploy "" false

# Install Flux with the GPG key, and commit verification enabled
install_flux_gpg "$gpg_key" true
Expand All @@ -95,6 +95,9 @@ function setup() {
}

function teardown() {
# (Maybe) teardown the created port-forward to gitsrv.
# shellcheck disable=SC2031
kill "$git_port_forward_pid" || true
# Kill the agent and remove temporary GNUPGHOME
gpgconf --kill gpg-agent
rm -rf "$tmp_gnupghome"
Expand Down

0 comments on commit 1b52618

Please sign in to comment.