Skip to content

Commit

Permalink
silentkill
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspiatkowski committed Jul 28, 2020
1 parent 2056450 commit bfc1170
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 14 deletions.
10 changes: 10 additions & 0 deletions eden/mononoke/tests/integration/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ $PATH"
;;
esac

function silentkill {
# sends KILL to the given process and waits for it so that nothing is printed
# to the terminal on MacOS
{ kill -9 $1 && wait $1; } > /dev/null 2>&1
# wait exit code is 137, if the process was already killed when wait was
# called, or the process' exit code. Because we don't need it and we want
# determinism in tests lets return 0 here
true
}

function get_free_socket {

# From https://unix.stackexchange.com/questions/55913/whats-the-easiest-way-to-find-an-unused-local-port
Expand Down
1 change: 0 additions & 1 deletion eden/mononoke/tests/integration/run_tests_getdeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@
"test-scs.t", # Missing SCS_SERVER
"test-server.t", # Returns different data in OSS
"test-traffic-replay.t", # Missing TRAFFIC_REPLAY
"test-unbundle-replay-hg-bookmark.t", # "kill" printing problem
"test-unbundle-replay-hg-recording.t", # Returns different data in OSS
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Do a push, while bundle preservation is disabled
[1]

Restart mononoke with enabled bundle2 preservation
$ kill $MONONOKE_PID
$ silentkill $MONONOKE_PID
$ rm -rf $TESTTMP/mononoke-config
$ export ENABLE_PRESERVE_BUNDLE2=1
$ setup_common_config "blob_files"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Check that Mononoke booted despite the lack of microwave snapshot

Kill Mononoke

$ kill "$MONONOKE_PID"
$ silentkill "$MONONOKE_PID"
$ truncate -s 0 "$TESTTMP/mononoke.out"

Delete filenodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ check unhydrated infinitepush pulls
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

stop mononoke before running it with a different config
$ kill "$MONONOKE_PID"
$ silentkill "$MONONOKE_PID"
$ rm -rf "$TESTTMP/mononoke-config"

setup a new config and restart mononoke
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Do infinitepush (aka commit cloud) push
backing up stack rooted at * (glob)
commitcloud: backed up 1 commit

$ kill $MONONOKE_PID && wait $MONONOKE_PID
$ silentkill $MONONOKE_PID

At least once infinitepush was performed
$ jq '.normal | contains({log_tag: "Unbundle resolved", msg: "infinitepush"})' < "$SCUBA_LOGGING_PATH" | grep true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@
$ truncate -s 0 "$scuba_proxy"

# Kill nc, otherwise we don't exit properly :/
$ kill -KILL "$nc_pid"
$ silentkill "$nc_pid"
4 changes: 2 additions & 2 deletions eden/mononoke/tests/integration/test-redaction-config.t
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Censor the redacted blob (file 'b' in commit '14961831bd3af3a6331fef7e63367d61cb
* changeset resolved as: * (glob)

Restart mononoke
$ kill $MONONOKE_PID
$ silentkill $MONONOKE_PID
$ rm -rf "$TESTTMP/mononoke-config"
$ setup_common_config blob_files
$ mononoke
Expand All @@ -110,7 +110,7 @@ Should gives us the tombstone file since it is redacted
This version of the file is redacted and you are not allowed to access it. Update or rebase to a newer commit.

Restart mononoke and disable redaction verification
$ kill $MONONOKE_PID
$ silentkill $MONONOKE_PID
$ rm -rf "$TESTTMP/mononoke-config"
$ export REDACTION_DISABLED=1
$ setup_common_config blob_files
Expand Down
2 changes: 1 addition & 1 deletion eden/mononoke/tests/integration/test-redaction.t
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Censore the redacted blob (file 'c' in commit '064d994d0240f9738dba1ef7479f0a4ce
* changeset resolved as: * (glob)

Restart mononoke
$ kill $MONONOKE_PID
$ silentkill $MONONOKE_PID
$ rm -rf "$TESTTMP/mononoke-config"
$ setup_common_config blob_files
$ mononoke
Expand Down
4 changes: 1 addition & 3 deletions eden/mononoke/tests/integration/test-server.t
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ test TLS Session/Ticket resumption when using client certs
SUCCESS

test TLS Tickets use encryption keys from seeds - sessions should persist across restarts
$ kill -9 $MONONOKE_PID && wait $MONONOKE_PID
$TESTTMP.sh: * Killed * (glob)
[137]
$ silentkill $MONONOKE_PID
$ mononoke
$ wait_for_mononoke
$ echo -e "hello\n" | s_client -sess_in $TMPFILE -state | grep -E "^SSL_connect"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Export the bundles so we can replay it as it if were coming from hg, through the

Blow everything away: we're going to re-do the push from scratch, in a new repo.

$ kill -9 "$MONONOKE_PID"
$ silentkill "$MONONOKE_PID"
$ rm -rf "$TESTTMP/mononoke-config" "$TESTTMP/monsql" "$TESTTMP/blobstore"
$ ASSIGN_GLOBALREVS=1 BLOB_TYPE="blob_files" quiet default_setup

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Export the bundle so we can replay it as it if were coming from hg, through the

Blow everything away: we're going to re-do the push from scratch, in a new repo.

$ kill -9 "$MONONOKE_PID"
$ silentkill "$MONONOKE_PID"
$ rm -rf "$TESTTMP/mononoke-config" "$TESTTMP/monsql" "$TESTTMP/blobstore"
$ ASSIGN_GLOBALREVS=1 BLOB_TYPE="blob_files" quiet default_setup

Expand Down

0 comments on commit bfc1170

Please sign in to comment.