Skip to content

Commit

Permalink
Fix tests by consuming an initial log entry
Browse files Browse the repository at this point in the history
Summary: Starting an LFS server seems to implicitly send a health check request. The timing of it is a bit random, enough to make the test flaky. We don't care about it for the purposes of this test, so just wait for it, consume it and ignore it.

Reviewed By: mitrandir77

Differential Revision: D55012938

fbshipit-source-id: dfda3338cdbfe643c0568894e5e34f2e26b39493
  • Loading branch information
andreacampi authored and facebook-github-bot committed Mar 18, 2024
1 parent e71a3fc commit 4a8a91c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
> EOF
$ lfs_root="$(CACHE_ARGS=--cache-mode=disabled lfs_server --log "$lfs_log" --always-wait-for-upstream --scuba-dataset "file://$SCUBA" --live-config "$(get_configerator_relative_path "${LIVE_CONFIG}")")"

# `lfs_server` sends a health check request (via `lfs_health`), which will emit
# a (sampled) log entry. In most cases that's ok, and logs are sample anyway.
# This test requires unsampled Scuba logs and cares about each one of them,
# so we have to consume.
$ wait_for_json_record_count "$SCUBA" 1

# Send a health check request
$ truncate -s 0 "$SCUBA"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
> EOF
$ lfs_root="$(CACHE_ARGS=--cache-mode=disabled lfs_server --log "$lfs_log" --always-wait-for-upstream --scuba-dataset "file://$SCUBA")"

# `lfs_server` sends a health check request (via `lfs_health`), which will emit
# a (sampled) log entry. In most cases that's ok, and logs are sample anyway.
# This test requires unsampled Scuba logs and cares about each one of them,
# so we have to consume.
$ wait_for_json_record_count "$SCUBA" 1

# Send a health check request
$ truncate -s 0 "$SCUBA"
Expand Down

0 comments on commit 4a8a91c

Please sign in to comment.