Commit Graph

693 Commits

Author SHA1 Message Date
Zeyi (Rice) Fan
a500f985d3 integration: fix test failure on Windows
Summary: This should fix the test failure introduced in D28203778 (9bee308885) where fsck tests were not skipped on Windows.

Reviewed By: genevievehelsel

Differential Revision: D28227230

fbshipit-source-id: 97ef5717fbda567b48f02a60e1906e374fdc6766
2021-05-05 15:01:01 -07:00
John Reese
9fd86a4fae apply upgraded black 21.4b2 formatting to fbsource
Summary:
This applies the formatting changes from black v21.4b2 to all covered
projects in fbsource. Most changes are to single line docstrings, as black
will now remove leading and trailing whitespace to match PEP8. Any other
formatting changes are likely due to files that landed without formatting,
or files that previously triggered errors in black.

Any changes to code should be AST identical. Any test failures are likely
due to bad tests, or testing against the output of pyfmt.

Reviewed By: thatch

Differential Revision: D28204910

fbshipit-source-id: 804725bcd14f763e90c5ddff1d0418117c15809a
2021-05-04 22:16:51 -07:00
Pyre Bot Jr
99f17e57ed suppress errors in fbcode/eden - batch 1
Differential Revision: D28190108

fbshipit-source-id: 6d67de1cb21f6ec4400adae2f42811f1f3e5d155
2021-05-04 15:25:14 -07:00
Diego Elio Pettenò
d0a4406f1c Make the eden restart --force command explicit.
Summary: This just makes it more obvious _where_ `--force` should be passed.

Reviewed By: genevievehelsel

Differential Revision: D28119590

fbshipit-source-id: 1fbdb4428e9b89e7b66c959f874067485a91d534
2021-05-04 09:51:40 -07:00
Katie Mancini
8e1a30a2a9 nfs: run most integration tests on edenfs
Summary:
Currently we have limited test coverage of the NFS code. Let's start running
our integration tests on NFS mounts. We already duplicate tests to run them on
both Git and Hg repos using a python decorator. We can update this decorator to
run a copy of tests on an nfs mount.

This covers most of the tests, but a few tests do not use this decorator. See next
change.

Note some tests are currently broken, so I am using the same skip list functionality
we use for windows so we use a uniform framework.

Reviewed By: xavierd

Differential Revision: D27874662

fbshipit-source-id: c7d425830b691e395b5228d0e0f797f67987b4ec
2021-04-23 13:30:17 -07:00
Xavier Deguillard
b98d8de5d6 integration: add a thread to duplicate edenfs output
Summary:
Some test runner don't properly redirect stdout/stderr of nested processes, or
even direct writes to filedescriptors. On these, debugging a test failure is
almost impossible for EdenFS as we rely on the test output to be interleaved
with the EdenFS logs to understand what the daemon is doing.

To solve this, we can simply create a thread that redirects the output of
EdenFS to sys.std{out,err}.

Reviewed By: kmancini

Differential Revision: D27570966

fbshipit-source-id: 6a8d5229d8d5d141e6ab423f7658744b42af46e3
2021-04-19 14:11:38 -07:00
Stiopa Koltsov
ec1e6b5bea log session id on startup
Summary:
Currently eden on startup prints:

```
Starting edenfs (dev build), pid 190
Opening local RocksDB store...
Opened RocksDB store in 0.073 seconds.
Could not parse config.json file: couldn't read /var/twsvcscm/local/.eden/config.json: No such file or directory
Skipping remount step.
Started edenfs (pid 190)
Logs available at /var/twsvcscm/local/.eden/logs/edenfs.log
```

Would be convenient if it also printed session id, to be able to query scuba straight away.

Reviewed By: chadaustin

Differential Revision: D27522665

fbshipit-source-id: d7d4cf6c97bc551061761f2653375f208e393498
2021-04-02 11:36:13 -07:00
Stiopa Koltsov
c247025da9 Log how long it took for eden to start
Summary:
I see in Sandcastle logs it was 10 minutes between `eden start` command and the following command.

So I'm curious, is it eden took 10 minutes to start or Sandcastle did something else but did not log it?

This little message in log will help to understand that.

Reviewed By: kmancini

Differential Revision: D27491709

fbshipit-source-id: 796c8db5abe49b056bd81b03ea57585a761c3cb6
2021-04-01 10:32:18 -07:00
Xavier Deguillard
0fb5fa7846 thrift: remove getManifestEntry
Summary:
This is unused, and the Thrift file mentions that it should be fine to remove
in July 2020. It's now March 2021, time to kill it.

Reviewed By: chadaustin

Differential Revision: D26852134

fbshipit-source-id: 2872185edd834f889b78802210071d16b881e14c
2021-03-19 09:25:05 -07:00
Xavier Deguillard
ac0a4eee2e test: add clone_nfs test
Summary:
For now, this simply clone a repo with NFS, and nothing else, more of the
protocol needs implementing to support reading directories, files, etc.

Reviewed By: kmancini

Differential Revision: D26266144

fbshipit-source-id: e379e12126162f41d8d166bb53652e1e501de2e9
2021-03-17 21:30:06 -07:00
Zeyi (Rice) Fan
f3f3fc546f integration: improve error reporting
Summary:
Previously the code would result an exception raised while handling another
exception which is a little confusing. This diff fixes that.

Reviewed By: chadaustin

Differential Revision: D27100659

fbshipit-source-id: 8c6be4df62214c8e8d778478de66f271f7b84d3c
2021-03-17 11:06:21 -07:00
generatedunixname89002005307016
50f5138b6f Add annotations to eden/integration/doteden_test.py
Reviewed By: xavierd

Differential Revision: D27012538

fbshipit-source-id: fa8ccea1aa218323ded54115bf5a3fd9728e19bb
2021-03-12 09:57:26 -08:00
generatedunixname89002005307016
dc4229e10b Add annotations to eden/integration/hg/lib/histedit_command.py
Reviewed By: xavierd

Differential Revision: D26848360

fbshipit-source-id: fb9ee483e1718f6541766caa60482b093ef983dc
2021-03-05 12:44:35 -08:00
Chad Austin
99c59c7e2b add some status edge case integration tests
Summary:
As Rice is replacing the overlay, introduce some integration tests
around the subtler interactions of mode bits and status.

Reviewed By: genevievehelsel

Differential Revision: D26707622

fbshipit-source-id: 429ba404c1c0655f8fff393664bc5ba9e3b0301f
2021-03-01 19:49:59 -08:00
generatedunixname89002005307016
428d0f602e Add annotations to eden/integration/lib/fake_edenfs.py
Reviewed By: xavierd

Differential Revision: D26710952

fbshipit-source-id: 207169a4f283ded2d4a33f46d585aa83af50e863
2021-03-01 10:58:17 -08:00
Xavier Deguillard
be8a46ce6e Add annotations to eden/integration/lib/edenclient.py
Reviewed By: fanzeyi

Differential Revision: D26692495

fbshipit-source-id: dac2a484bbf1f6e1c8e3e258bdb27849720c9882
2021-02-26 11:01:05 -08:00
Chad Austin
68cf44a8d1 add eden glob command
Summary:
It's silly to use `eden prefetch --no-prefetch` to efficiently glob
for filenames. Introduce an `eden glob` command which resolves a glob
relative to the current working directory.

Reviewed By: genevievehelsel

Differential Revision: D25450358

fbshipit-source-id: 45d6dc870d21510e51d5662c75e80385886899fc
2021-02-23 19:58:03 -08:00
Xavier Deguillard
8853701e91 path: forbid building non-utf8 paths
Summary:
The world has moved on utf-8 as the default encoding for files and data, but
EdenFS still accepts non utf-8 filenames to be written to it. In fact, most of
the time when a non utf-8 file is written to the working copy, and even though
EdenFS handles it properly, Mercurial ends up freaking out and crash. In all of
these cases, non-utf8 files were not intentional, and thus refusing to create
them wouldn't be a loss of functionality.

Note that this diff makes the asumption that Mercurial's manifest only accept
utf8 path, and thus we only have to protect against files being created in the
working copy that aren't utf8.

The unfortunate part of this diff is that it makes importing trees a bit more
expensive as testing that a path is utf8 valid is not free.

Reviewed By: chadaustin

Differential Revision: D25442975

fbshipit-source-id: 89341a004272736a61639751da43c2e9c673d5b3
2021-02-23 11:35:12 -08:00
generatedunixname89002005307016
a301311ce8 Add annotations to eden/integration/lib/pexpect.py
Reviewed By: xavierd

Differential Revision: D26486496

fbshipit-source-id: 16c4b0cd1cc7a657b8575adc7d45e2c1f96ed3a1
2021-02-17 10:30:15 -08:00
Saurabh Singh
cfe084d02f telemetry: switch to using quantile stats instead of timeseries
Summary:
Timeseries is memory intensive and not really required in the current context
it is being used.

Reviewed By: chadaustin

Differential Revision: D26315632

fbshipit-source-id: ee51c3ad8bef6fce152aa787c8c4602f0b499f92
2021-02-14 16:37:08 -08:00
Leszek Nowaczyk
8a9ec43d3e change logging.warn to logging.warning
Summary: logging.warn() is deprecated since Python 3.3 in favor of logging.warning()

Reviewed By: ahornby, mannatsingh, klshuster

Differential Revision: D25870738

fbshipit-source-id: d866a7925300ad3404a5c8da29e380d5d01d7dc2
2021-02-11 02:42:51 -08:00
Xavier Deguillard
cc1fd73793 test: add a way to add edenfsrc config in tests
Summary:
Previously, for configs that are only read once, EdenFS would have to be
stopped, the config written, and then EdenFS would be restarted. For Mercurial,
this increases the test time significantly as starting EdenFS takes ~20s.

Reviewed By: fanzeyi

Differential Revision: D26258174

fbshipit-source-id: a74d1e5be35044e95e5a7403f1bf28d557b613d2
2021-02-04 20:10:38 -08:00
Xavier Deguillard
17c99d69de cli: add a --nfs argument to eden clone
Summary: This enables the repository to be mounted via NFS, and not FUSE.

Reviewed By: chadaustin

Differential Revision: D26229827

fbshipit-source-id: 5af5a47ebe5f1dd54df7707bf57d9b7476921f29
2021-02-04 20:10:37 -08:00
Adam Simpkins
1076f2dc58 improve the glob tests
Summary:
The `assert_glob()` function in the glob tests previously only checked that
the expected number of results were returned.  This updates the tests to
actually verify the returned paths.  This also adds a few checks that verify
the behavior when the `wantDtype` parameter is True

Reviewed By: chadaustin

Differential Revision: D18903993

fbshipit-source-id: 5ed4c88160ffbda2e5fdcf089e210fda92868d56
2021-01-27 12:04:50 -08:00
Genevieve Helsel
55da8ffcbc run linter in eden/integration
Summary: just running the linter!

Reviewed By: chadaustin

Differential Revision: D26000269

fbshipit-source-id: 184eb962fa7b88eb9b8b6bd22ae76477cbb6a06c
2021-01-25 16:13:54 -08:00
Giorgi Papakerashvili
aa984b0835 tests: Fix UnusedVariable in xattr_test.py
Summary: **expected_sha1**  was  declared but not used in **xattr_test.py** file, removing this unused variable and variables which was used to creat **expected_sha1**

Reviewed By: xavierd

Differential Revision: D25899401

fbshipit-source-id: 26f0bb06d2c96e7f6754a4b821ffe4cf59a2f35e
2021-01-14 01:23:42 -08:00
Xavier Deguillard
4cdbffe823 integration: allow OSS integration test to build on Windows
Summary:
On Windows, since Mercurial doesn't yet build with Buck, we need to test
against the system Mercurial, thus remove the dependencies to //eden/scm:hg for
the tests. Also remove various dependencies that don't build yet on Windows.

This allows for the tests to run, but fail while trying to execute edenfsctl.par.

Reviewed By: kmancini

Differential Revision: D25807727

fbshipit-source-id: c2533eedc361cc6db9fdf2190476c3d52833139d
2021-01-11 12:06:14 -08:00
Xavier Deguillard
978cd4549c hg: ignore invalid filename when importing manifest
Summary:
Mercurial support files with `\` in their name, which can't be represented on
Windows due to `\` being the path separator. Currently, EdenFS will throw
errors at the user when such file are encountered, let's simply warn, and
continue.

Reviewed By: chadaustin

Differential Revision: D25430523

fbshipit-source-id: 4167b4cd81380226aead8e4f4850a7738087fd95
2021-01-05 14:08:14 -08:00
generatedunixname89002005307016
1e1a7fa10d suppress errors in eden - batch 1
Differential Revision: D25562362

fbshipit-source-id: ec62c64396f61335f6cfe8f355ba977bfd1da031
2020-12-15 15:22:22 -08:00
Jun Wu
ec0b533381 ui: make ui.debug write to stderr
Summary:
Debug output belongs to stderr.

This makes it possible to turn on debug output without breaking programs
parsing stdout.

Reviewed By: singhsrb

Differential Revision: D25315954

fbshipit-source-id: c7813a824fbf6640cb5b80b5ed2d947e7059d53e
2020-12-15 12:07:47 -08:00
Genevieve Helsel
e0c23ea593 fix redirect list test on Windows
Summary:
From wez's description (slightly edited):

a symlink direction resolves outside the repo, and the new validation logic doesn't like that. the test is doing a redirect add bind then redirect add symlink. The second add is intended to implicitly delete the first one if the config is different, but it's not smart enough to realize that that is happening.

This adds an explicit `redirect del` before we do our second `redirect add`

Reviewed By: xavierd

Differential Revision: D25405011

fbshipit-source-id: 107fd272bbe830d8b23e437286ced00460902d91
2020-12-08 15:54:48 -08:00
Chad Austin
27b83d1d44 remove the unused glob() implementation
Summary:
Stop implementing the legacy glob() Thrift function, since it's
deprecated, and just noise at this point.

Reviewed By: xavierd

Differential Revision: D25247641

fbshipit-source-id: a022fee169ad54c886d8f300b57bef233453fe8b
2020-12-01 13:39:14 -08:00
Chad Austin
4299003775 return a better error message if something includes . or .. in their glob
Summary:
We used to produce a confusing error message during glob evaluation
when . or .. was specified as a glob component. Instead, fail early,
with an error message that more directly explains the problem.

Reviewed By: genevievehelsel

Differential Revision: D24969096

fbshipit-source-id: fe70a8f4db1fdce8eec13890d20913b63a516518
2020-11-17 12:53:39 -08:00
Chad Austin
20d032231c improve PathComponent parse failure error messaging
Summary:
Be more specific about which PathComponent string failed to validate
in order to help diagnose downstream issues like glob syntax errors.

Reviewed By: genevievehelsel

Differential Revision: D24966004

fbshipit-source-id: cd3bc0aeaeb389caa13c86b91149d48c5afdb306
2020-11-17 12:53:39 -08:00
John Reese
d13e0b137f apply pyfmt with usort to opted-in sources
Reviewed By: zertosh

Differential Revision: D24880203

fbshipit-source-id: 2034cdfc2712209e86d3d05c119c58f979b05c52
2020-11-10 21:25:54 -08:00
Xavier Deguillard
8c4429a4f5 integration: fix merge tests
Summary:
I'm not entirely sure why these started failing, but enabling ui.allowmerge
made these run again.

Reviewed By: chadaustin

Differential Revision: D24697462

fbshipit-source-id: ec5ca987e7116edb12658eb7b4d03f1cf0f876d3
2020-11-02 20:47:29 -08:00
Chad Austin
20c77da782 implement debugInodeStatus with traverseObservedInodes
Summary:
Replace the old implementation of debugInodeStatus with the more
general traverseObservedInodes functionality, and add the ability to
customize its results with flags.

Reviewed By: xavierd

Differential Revision: D24300122

fbshipit-source-id: 0fbd3aa02575faa515fd7852441547d7de13426d
2020-11-02 13:52:37 -08:00
Katie Mancini
f616872079 Allow specifying commits to match against and prefetch in globFiles
Summary:
We want to be able to fetch prefetch profiles on pull. That means we will need
to prefetch the contents of prefetch profiles for commits that we are not
currently on. Thus globFiles (the thrift endpoint used for prefetch profiles
fetching) needs to be able to take commit hashes to match and fetch against.

Why fetch prefetch profiles on pull? This would get the prefetch started earlier so
the files are hopefully fetched by the time the user needs them.

Reviewed By: chadaustin, genevievehelsel

Differential Revision: D23858659

fbshipit-source-id: 123e423d5117274b92405dbb5c2df690298a1c18
2020-10-29 13:34:06 -07:00
Xavier Deguillard
9db1fcdee8 inodes: do not ignore errors when computing sha1
Summary:
On Windows, computing the sha1 of a materialized file requires opening up the
file in the working copy, as the file is cached there. Interestingly, this
potentially means that for computing the sha1 of a file, EdenFS may receive a
callback from ProjectedFS about that file or a parent directory. At this point,
EdenFS just refuses to serve this callback, as doing so may trigger an infinite
loop, or simply deadlocks. While this may sound weird, recursive callbacks are
not expected, as this signify that EdenFS view of the working copy doesn't
match what it actually is.

To close the loop, and from a code perspective, this means that computing the
sha1 of a file can fail and can throw an exception. Unfortunately, the code
didn't reflect this fact and exceptions were simply ignored, when that happens
during a checkout operation, this can leave the working copy in a weird state,
further agravating the mismatch between EdenFS view of the working copy, and
what it actually is.

Reviewed By: wez

Differential Revision: D24282048

fbshipit-source-id: 745af03189fe345150f0b1792ee1b37a1b8fb0d4
2020-10-15 23:57:11 -07:00
Xavier Deguillard
18a313cba0 inodes: make invalidating inodes fallible
Summary:
While on Linux these can't fail (or, to be more precise: it doesnt' matter),
they can on Windows. One such exemple is when a user lock a file and triggers
an update that modifies this file. The invalidation will fail, and thus the
update should keep track of that file not being updated properly.

Previously, the invalidation would raise an exception, but that proved to be
the wrong approach as some state would need to be rolled back which the
exception didn't help in. For that, let's just return a Try and make sure that
we handle all the cases properly.

Reviewed By: chadaustin

Differential Revision: D24163672

fbshipit-source-id: ac881984138eefa65c053478a160e2a653fd3fdf
2020-10-15 17:31:13 -07:00
John Reese
737849c9dd apply black 20.8b1 formatting update
Summary:
allow-large-files

black_any_style

Reviewed By: zertosh

Differential Revision: D24325133

fbshipit-source-id: b4afe80d1e8b2bc993f4b8e3822c02964df47462
2020-10-14 20:21:52 -07:00
Xavier Deguillard
001c399d6f tests: enable remaining update_tests on Windows
Summary: Only 2 tests aren't passing on Windows.

Reviewed By: genevievehelsel

Differential Revision: D24257788

fbshipit-source-id: 42a0169955bbff6e05e02374c3b3e434bf849ba0
2020-10-12 17:09:41 -07:00
Chad Austin
f11c8893c0 always run hg in integration tests with --traceback
Summary:
I observed an integration test fail because Mercurial aborted with an
error about not handling EINTR, but it had no traceback. Always run
Mercurial with --traceback to try to debug these.

Reviewed By: xavierd

Differential Revision: D24204308

fbshipit-source-id: 44960bc645e5f97f61761e511b372328430fcda7
2020-10-09 17:18:12 -07:00
John Reese
f42333f17c Apply pyfmt to fbcode/eden
Summary:
Formats a subset of opted-in Python files in fbsource.
Black formatting was applied first, which is guaranteed
safe as the AST will not have changed during formatting.
Pyfmt was then run, which also includes import sorting.
The changes from isort were manually reviewed, and
some potentially dangerous changes were reverted,
and the  directive was added to those
files. A final run of pyfmt shows no more changes to
be applied.

Reviewed By: zertosh

Differential Revision: D24101830

fbshipit-source-id: 0f2616873117a821dbc6cfb6d8e4f64f4420312b
2020-10-04 04:51:00 -07:00
Xavier Deguillard
e2a4bcf917 tests: enable all doctor tests on Windows
Summary:
Now that `hg whereami` properly reads the SNAPSHOT file on Windows, the doctor
tests properly detect that Mercurial and EdenFS disagree about the current
commit, thus we can enable the remaining 2 tests.

Reviewed By: genevievehelsel

Differential Revision: D23819924

fbshipit-source-id: 21be19aff913e5e485d72e8cd730e6851ecaba2e
2020-09-21 13:12:11 -07:00
Wez Furlong
b39f678b85 edenfs: remove use of fork from StartupLogger
Summary:
on macOS we cannot safely use `fork`.

This commit replaces the use of `fork` in the startup logger subsystem.
This was a little tricky to untangle; originally (prior to any of
the `fork` removal efforts in this diff stack), the startup flow was
to spawn a set of processes via fork:

```
edenfs (setuid)
 \-----edenfs (privhelper, as root)
  \------edenfs (daemonized)
```

The forked children take advantage of being able to implicitly pass state to
the child processes from the parent.  That data flow needs to become explicit
when removing the fork which makes some things a little awkward.

With fork removed:

* `edenfs` unconditionally spawns `edenfs_privhelper` while it has
  root privs and before most of the process has been initialized.
* That same `edenfs` process will then spawn a child `edenfs`
  process which starts from scratch, but that which needs to
  run as the real server instance
* The original `edenfs` instance needs to linger for a while
  to remain connected to the controlling tty to pass back the
  startup state to the user, before terminating.

This commit deletes the check that `edenfs` is started originally
as root; previously the logic relied on the forked startup logger
continuing past the `daemonizeIfRequested` call and simply deferring
the check until after folly::init.  With these changes we can't
easily perform such a check without adding some extra gymnastics
to pass the state around; the place where that is checked is in
the spawned child of the original edenfs, which is not a privileged
process and doesn't know the original euid.  I don't believe this
to be a great loss as we tuck `edenfs` away under the libexec dir.

Reviewed By: chadaustin

Differential Revision: D23696569

fbshipit-source-id: 55b95daf022601a4699274d696af419f0a11f6f2
2020-09-18 17:22:39 -07:00
Zeyi (Rice) Fan
5fedaa71b8 enable redirection tests
Summary: This diff fixes the eden redirection tests so it runs on Windows.

Reviewed By: xavierd

Differential Revision: D22958766

fbshipit-source-id: 45d26587831ed74d6bd7912b22c7c955b077f571
2020-09-18 16:39:52 -07:00
Chad Austin
55f9f07c7d increase timeout in graceful restart tests
Summary:
tpx doesn't support heavyweight tags or rate limiting, and integration
tests regularly fail with timeouts on my devbig, so bump the process
start and process stop timeouts.

Reviewed By: genevievehelsel

Differential Revision: D23553924

fbshipit-source-id: fa9b8710395d61b087963d18718137e4525ae03d
2020-09-15 17:37:50 -07:00
Chad Austin
a303d6a399 increase shutdown timeout in integration tests and avoid EPERM when started with sudo
Summary:
30 seconds is not enough time on heavily contented systems, including
CI. Bump the shutdown timeout to 120.

Also, correctly send SIGKILL to the daemon process when it's been
started with sudo.

Reviewed By: simpkins

Differential Revision: D22422784

fbshipit-source-id: dc7be0962705f1feb9643990309f570e352b68a0
2020-09-15 17:37:50 -07:00
Chad Austin
5f8fde4570 remove an irredeemably flaky test
Summary:
This test can't be non-flaky, because it relies on the kernel deciding
when to drop inodes from cache, and we've investigated it multiple
times. Given it tests a rarely-used function that would be better
expressed as a unit test in C++, just remove it for now.

Reviewed By: wez

Differential Revision: D23665455

fbshipit-source-id: 522e47113857eff399be4f2bb60e26e801d61e9a
2020-09-14 14:57:44 -07:00