From 198085f40ed81b5791742f289cce37087c018a3f Mon Sep 17 00:00:00 2001 From: Lukas Piatkowski Date: Mon, 21 Sep 2020 07:51:32 -0700 Subject: [PATCH] mononoke/integration tests: fix returning different output in OSS cases in tests (#60) Summary: Pull Request resolved: https://github.com/facebookexperimental/eden/pull/60 For the tests that output different data to stdout in OSS vs FB create helpers that remove the differences. Reviewed By: farnz Differential Revision: D23814134 fbshipit-source-id: 36d323906ba9ed335c255d5b1940f2832c01371b --- eden/mononoke/tests/integration/library.sh | 7 ++ .../tests/integration/run_tests_getdeps.py | 7 +- .../integration/test-fastreplay-inline-args.t | 7 +- .../test-remotefilelog-lfs-client-certs.t | 16 ++--- eden/mononoke/tests/integration/test-server.t | 64 ------------------- .../test-unbundle-replay-hg-recording.t | 5 +- 6 files changed, 16 insertions(+), 90 deletions(-) delete mode 100644 eden/mononoke/tests/integration/test-server.t diff --git a/eden/mononoke/tests/integration/library.sh b/eden/mononoke/tests/integration/library.sh index be6bb3d9762a6..2d033c238ca51 100644 --- a/eden/mononoke/tests/integration/library.sh +++ b/eden/mononoke/tests/integration/library.sh @@ -13,6 +13,7 @@ fi ALLOWED_IDENTITY_TYPE="${FB_ALLOWED_IDENTITY_TYPE:-X509_SUBJECT_NAME}" ALLOWED_IDENTITY_DATA="${FB_ALLOWED_IDENTITY_DATA:-CN=localhost,O=Mononoke,C=US,ST=CA}" +JSON_CLIENT_ID="${FB_JSON_CLIENT_ID:-[\"X509_SUBJECT_NAME:CN=localhost,O=Mononoke,C=US,ST=CA\"]}" if [[ -n "$DB_SHARD_NAME" ]]; then MONONOKE_DEFAULT_START_TIMEOUT=60 @@ -1648,6 +1649,12 @@ function summarize_scuba_json() { jq -S "if (.normal.log_tag | match(\"^($interesting_tags)\$\")) then ${key_spec:3} else empty end" } +if [ -z "$HAS_FB" ]; then + function format_single_scuba_sample() { + jq -S . + } +fi + function regenerate_hg_filenodes() { "$MONONOKE_REGENERATE_HG_FILENODES" \ "${COMMON_ARGS[@]}" \ diff --git a/eden/mononoke/tests/integration/run_tests_getdeps.py b/eden/mononoke/tests/integration/run_tests_getdeps.py index a6b74d1dd0148..712a4dbb492b1 100755 --- a/eden/mononoke/tests/integration/run_tests_getdeps.py +++ b/eden/mononoke/tests/integration/run_tests_getdeps.py @@ -121,12 +121,7 @@ def get_test_groups(repo_root): "test-walker-count-objects.t", "test-walker-error-as-data.t", }, - TestGroup.BROKEN: { - "test-fastreplay-inline-args.t", # Returns different data in OSS - "test-remotefilelog-lfs-client-certs.t", # Returns different data in OSS - "test-server.t", # Returns different data in OSS - "test-unbundle-replay-hg-recording.t", # Returns different data in OSS - }, + TestGroup.BROKEN: set(), } if platform == "darwin": diff --git a/eden/mononoke/tests/integration/test-fastreplay-inline-args.t b/eden/mononoke/tests/integration/test-fastreplay-inline-args.t index 94d0e317a0fa6..048ad5f2a061c 100644 --- a/eden/mononoke/tests/integration/test-fastreplay-inline-args.t +++ b/eden/mononoke/tests/integration/test-fastreplay-inline-args.t @@ -43,7 +43,7 @@ Test a few more options Replay Succeeded Check logging structure - $ grep "Replay Succeeded" "$fastreplay_log" | grep gettreepack | head -n 1 | jq . + $ grep "Replay Succeeded" "$fastreplay_log" | grep gettreepack | head -n 1 | format_single_scuba_sample { "int": { "completion_time_us": *, (glob) @@ -57,15 +57,12 @@ Check logging structure "time": * (glob) }, "normal": { - "build_revision": *, (glob) - "build_rule": *, (glob) "command": "gettreepack", "command_args": "[{\"basemfnodes\":\"\",\"depth\":\"65536\",\"directories\":\"\",\"mfnodes\":\"7c9b4fd8b49377e2fead2e9610bb8db910a98c53\",\"rootdir\":\"\"}]", "log_tag": "Replay Succeeded", "recorded_mononoke_session_id": *, (glob) "recorded_server": "mononoke", - "reponame": "repo", - "server_hostname": * (glob) + "reponame": "repo" } } diff --git a/eden/mononoke/tests/integration/test-remotefilelog-lfs-client-certs.t b/eden/mononoke/tests/integration/test-remotefilelog-lfs-client-certs.t index 772c9b9818da1..ecd260c98a0cd 100644 --- a/eden/mononoke/tests/integration/test-remotefilelog-lfs-client-certs.t +++ b/eden/mononoke/tests/integration/test-remotefilelog-lfs-client-certs.t @@ -58,14 +58,8 @@ Now, remove the killswitch. This will work Finally, check what identities the client presented. $ wait_for_json_record_count "$TESTTMP/scuba.json" 2 - $ jq -S .normvector.client_identities "$TESTTMP/scuba.json" - [ - "MACHINE:devvm000.lla0.facebook.com", - "MACHINE_TIER:devvm", - "USER:myusername0" - ] - [ - "MACHINE:devvm000.lla0.facebook.com", - "MACHINE_TIER:devvm", - "USER:myusername0" - ] + $ diff <( + > jq -S .normvector.client_identities "$TESTTMP/scuba.json" + > ) <( + > printf "$JSON_CLIENT_ID\n$JSON_CLIENT_ID" | jq -S . + > ) diff --git a/eden/mononoke/tests/integration/test-server.t b/eden/mononoke/tests/integration/test-server.t deleted file mode 100644 index 9ba6521fc59df..0000000000000 --- a/eden/mononoke/tests/integration/test-server.t +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This software may be used and distributed according to the terms of the -# GNU General Public License found in the LICENSE file in the root -# directory of this source tree. - -setup - $ . "${TEST_FIXTURES}/library.sh" - -setup configuration - $ setup_common_config - $ cd $TESTTMP - -setup repo - $ hginit_treemanifest repo-hg - $ cd repo-hg - $ echo "a file content" > a - $ hg add a - $ hg ci -ma - -setup data - $ cd $TESTTMP - $ blobimport repo-hg/.hg repo - -start mononoke - $ mononoke - $ wait_for_mononoke - -test TLS Session/Ticket resumption when using client certs - $ TMPFILE=$(mktemp) - $ RUN1=$(echo -e "hello\n" | s_client -sess_out $TMPFILE | grep -E "^(HTTP|\s+Session-ID:)") - Can't use SSL_get_servername - depth=1 C = US, ST = CA, O = TestRoot, CN = mononoke.com - verify return:1 - depth=0 CN = localhost, O = Mononoke, C = US, ST = CA - verify return:1 - read:errno=0 - $ RUN2=$(echo -e "hello\n" | s_client -sess_in $TMPFILE | grep -E "^(HTTP|\s+Session-ID:)") - Can't use SSL_get_servername - read:errno=0 - $ echo "$RUN1" - Session-ID: [A-Z0-9]{64} (re) - $ if [ "$RUN1" == "$RUN2" ]; then echo "SUCCESS"; fi - SUCCESS - -test TLS Tickets use encryption keys from seeds - sessions should persist across restarts - $ kill -SIGTERM $MONONOKE_PID && wait $MONONOKE_PID - $ grep -c "stop accepting connections" "$TESTTMP/mononoke.out" - 1 - $ mononoke - $ wait_for_mononoke - $ echo -e "hello\n" | s_client -sess_in $TMPFILE -state | grep -E "^SSL_connect" - SSL_connect:before SSL initialization - SSL_connect:SSLv3/TLS write client hello - SSL_connect:SSLv3/TLS write client hello - Can't use SSL_get_servername - SSL_connect:SSLv3/TLS read server hello - SSL_connect:SSLv3/TLS read change cipher spec - SSL_connect:SSLv3/TLS read finished - SSL_connect:SSLv3/TLS write change cipher spec - SSL_connect:SSLv3/TLS write finished - read:errno=0 - SSL3 alert write:warning:close notify - [1] diff --git a/eden/mononoke/tests/integration/test-unbundle-replay-hg-recording.t b/eden/mononoke/tests/integration/test-unbundle-replay-hg-recording.t index ea8755e7336d8..a7b8bc877da9a 100644 --- a/eden/mononoke/tests/integration/test-unbundle-replay-hg-recording.t +++ b/eden/mononoke/tests/integration/test-unbundle-replay-hg-recording.t @@ -90,7 +90,7 @@ Check history again. We're back to where we were: (master_bookmark) 7a8f33ce453248a6f5cc4747002e931c77234fbd pushrebase * (glob) (master_bookmark) 26805aba1e600a82e93661149f2313866a221a7b blobimport * (glob) - $ jq -S . < $TESTTMP/scuba.json + $ format_single_scuba_sample < $TESTTMP/scuba.json { "int": { "age_s": *, (glob) @@ -105,10 +105,7 @@ Check history again. We're back to where we were: }, "normal": { "bookmark": "master_bookmark", - "build_revision": *, (glob) - "build_rule": "fbcode:eden/mononoke/unbundle_replay:unbundle_replay", "from_cs_id": "c3384961b16276f2db77df9d7c874bbe981cf0525bd6f84a502f919044f2dabd", - "server_hostname": *, (glob) "to_cs_id": "604bc07f395768cd320516a640bef6a1af75d13b4214d44ae3faa2a36f1203bb" } }