Commit Graph

29 Commits

Author SHA1 Message Date
Jia Chen
c717ef0d7d Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Differential Revision: D19548623

fbshipit-source-id: 12d5e8ec6450de42107d07b230e4b2d0824f7c9d
2020-01-24 12:32:43 -08:00
generatedunixname89002005307016
4c76d686a8 Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: grievejia

Differential Revision: D17956249

fbshipit-source-id: d5c8b5aa73151b3fea67aec35d70f332030da2c9
2019-10-16 16:56:29 -07:00
Andres Suarez
fbdb46f5cb Tidy up license headers
Reviewed By: chadaustin

Differential Revision: D17872966

fbshipit-source-id: cd60a364a2146f0dadbeca693b1d4a5d7c97ff63
2019-10-11 05:28:23 -07:00
generatedunixname89002005289445
13e683608d Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: sinancepel

Differential Revision: D17135557

fbshipit-source-id: 07afef940271a277c75834892733901d070bfa5f
2019-08-30 13:37:34 -07:00
Adam Simpkins
9bfb48c921 update license headers in .py files
Summary:
Update the copyright & license headers in Python files to reflect the
relicensing to GPLv2

Reviewed By: wez

Differential Revision: D15487088

fbshipit-source-id: 9f2138dff41048d2c35f15e09a04ae5a9c9c80dd
2019-06-19 17:02:46 -07:00
Adam Simpkins
ce93814006 add an eden stop --kill option
Summary:
Add an option to forcibly kill `edenfs` with SIGKILL without ever attempting
to query it over thrift.

This should provide a way for users to reliably kill edenfs even if it is
hung.  This shouldn't be necessary in most cases, but it lets us tell users to
run this command as a last resort if something is wrong.

Reviewed By: chadaustin, strager

Differential Revision: D13744188

fbshipit-source-id: 13378d04b3398e72ed3733d4ebb68b39868007bd
2019-01-22 13:03:55 -08:00
Adam Simpkins
09ba1f146a update ServiceTestCaseBase to keep everything in one tmp directory
Summary:
Update the ServiceTestCaseBase code so that each test case keeps its state in
a single top-level temporary directory.  This makes it a little easier to
figure out which directory is which when debugging a test.  I also plan to
write a new test soon that creates some additional directories, and having one
top-level temporary directory avoids needing to create new TemporaryDirectory
objects.

Reviewed By: strager

Differential Revision: D13522026

fbshipit-source-id: 95a3d268d267a107bbf5e405839d64afd6afdb03
2019-01-11 18:31:48 -08:00
Sinan Cepel
8d30ff0d6a upgrade fbcode/eden version
Reviewed By: simpkins, dark

Differential Revision: D13617216

fbshipit-source-id: 01066612dfc68cee9283b587fc08f25530857690
2019-01-10 16:13:47 -08:00
Marco Leogrande
bdccac3ea2 Upgrade pyre version for eden
Reviewed By: shannonzhu

Differential Revision: D13502225

fbshipit-source-id: d21fb9da209e4f376a7fbe4f618954ef43d08fea
2018-12-18 11:15:40 -08:00
Matt Glazar
9262202c9e Refactor TemporaryDirectoryMixin into ServiceTestCaseBase
Summary:
D13422460 made TemporaryDirectoryMixin required for classes deriving from ServiceTestCaseBase, but ServiceTestCaseBase expressed this requirement poorly. Make the dependency explicit by making ServiceTestCaseBase derive from TemporaryDirectoryMixin.

This diff should not change behavior.

Reviewed By: simpkins

Differential Revision: D13454141

fbshipit-source-id: e07745cfd2a364da5011371fe8671d94d32c6798
2018-12-13 13:52:17 -08:00
Matt Glazar
efd2d6b397 Isolate fake_edenfs tests from ~/.edenrc
Summary:
I noticed some Managed service tests behaving strangely on my dev server. They behave as if they are being managed by systemd.

I noticed that `systemctl --user status 'fb-edenfs@*.service'` showed a bunch of tmp-eden_test services. Since the Managed tests don't create an isolated systemd instance, they are starting and stopping services on my real systemd!

This behavior is caused by me setting service.experimental_systemd=true in my ~/.edenrc (D13371186).

Fix the odd behavior of these tests by preventing them from reading ~/.edenrc. Also do the same for /etc/eden.

Reviewed By: simpkins

Differential Revision: D13422460

fbshipit-source-id: b8a4cbabe55b75b34729d4122ba804cd7d3297a2
2018-12-13 13:52:17 -08:00
Matt Glazar
75d7a135b5 Pass extra daemon args from 'eden start' to systemd
Summary: Several tests for 'eden start', 'eden stop', and 'eden status' need to pass command-line arguments to fake_edenfs. With systemd support enabled, make 'eden start' forward daemon arguments to fake_edenfs, making these tests pass.

Reviewed By: wez

Differential Revision: D13249891

fbshipit-source-id: 9008a361fce7a5629535cc9d245b86073ee70826
2018-12-07 17:07:08 -08:00
Matt Glazar
7e7c15976e Refactor systemd status assertions into EdenFSSystemdMixin
Summary:
I want to reuse assert_systemd_service_is_active in another test. Move it (and the related assert_systemd_service_is_stopped function) so it can be reused.

This diff should not change behavior.

Reviewed By: chadaustin

Differential Revision: D13327802

fbshipit-source-id: 022c3ed3b9e8f04ef1156c2bb4b3deda662439e4
2018-12-06 19:13:17 -08:00
Matt Glazar
9f84aba270 Add test: 'eden stop' stops systemd service
Summary: 'eden stop' should behave like 'systemctl stop'; the service should be stopped after 'eden stop' returns. Add a test which verifies this.

Reviewed By: chadaustin

Differential Revision: D13288819

fbshipit-source-id: 5b836c8ac7c5eb97c484195496f38c7cf70c84dc
2018-12-06 19:13:17 -08:00
Matt Glazar
e53e3c4cad Enable some 'eden stop' tests with systemd
Summary:
The following tests in stop_test.py pass with systemd enabled:

* test_killing_hung_daemon_during_stop_makes_stop_finish
* test_stop_not_running
* test_stop_stops_running_daemon
* test_stopping_daemon_stopped_by_sigstop_kills_daemon
* test_stopping_killed_daemon_reports_not_running

Enable these tests to prevent regressions.

Reviewed By: chadaustin

Differential Revision: D13229634

fbshipit-source-id: 1c632260afdc7286bd8b1465258b129f20f02f18
2018-12-06 17:48:15 -08:00
Matt Glazar
c20d275a6b Make 'eden start' run a bare minimum systemd service (opt-in)
Summary:
Add the plumbing necessary to make 'eden start' start a systemd user service. This is only enabled if you opt in using EDEN_EXPERIMENTAL_SYSTEMD.

Currently, only fake_edenfs works. The real edenfs doesn't work yet because it needs root access to configure mount points.

'eden restart', 'eden stop', etc. are not affected by this diff (and are probably broken with EDEN_EXPERIMENTAL_SYSTEMD enabled).

Reviewed By: simpkins

Differential Revision: D10849390

fbshipit-source-id: c087a6498951ff100e5c80bd07ad869b2709e1b3
2018-12-06 16:01:43 -08:00
Matt Glazar
506cf4ebf8 Use TemporaryDirectoryMixin in CLI tests
Summary: CLI tests use shutil.rmtree to clean up temporary directories. Reuse TemporaryDirectoryMixin which is more robust against errors and supports EDEN_TEST_NO_CLEANUP.

Reviewed By: chadaustin

Differential Revision: D13268108

fbshipit-source-id: d77e95a2def0dceb34cf14e19c0c0c0e3aeef3f2
2018-12-03 14:42:11 -08:00
Adam Simpkins
9beff99012 add type annotations to most of the integration test functions
Summary:
This updates the integration tests to add type annotations to most functions
that were missing annotations.

In particular this is needed to make pyre happy, as it complains if subclasses
override methods from their parent class and do not specify type annotations
if the parent class did have annotations.

This diff also contains some minor changes to hg_extension_test_base.py to
explicitly declare some abstract methods that it uses.  This was also
necessary to make pyre happy about this ocde.

Reviewed By: strager

Differential Revision: D13051097

fbshipit-source-id: 77567ed2f4d3050f93acefb52e688932d276d587
2018-11-16 19:47:48 -08:00
Matt Glazar
8f73588127 Improve test coverage of 'eden start', 'eden stop', and 'eden restart'
Summary: While creating a systemd service unit for EdenFS, I noticed a few features of the current implementation of 'eden start', 'eden stop', and 'eden restart' which are not covered by tests. Write tests for these features to ensure they don't regress with systemd integration.

Reviewed By: wez

Differential Revision: D10434379

fbshipit-source-id: 6c828a85d59179bbc4beda87e1bf2534543b60b2
2018-10-31 15:26:39 -07:00
Matt Glazar
574cef54e3 Test restart/stop/status with 'eden start'd and ad-hoc daemon
Summary:
Right now, 'eden start' spawns edenfs directly (using `os.exec`). In the future, 'eden start' will spawn edenfs using systemd. 'eden restart', 'eden stop', and 'eden status' might behave differently depending on how the edenfs process was spawned.

Parameterize some tests on how fake_edenfs was originally started. This flexibility lets us easily spawn fake_edenfs with 'systemctl start' (systemd) in the future. For now, spawn fake_edenfs in ad-hoc mode (i.e. directly without 'eden start') or in managed mode (i.e. indirectly with 'eden start').

Reviewed By: chadaustin

Differential Revision: D10414995

fbshipit-source-id: 2ee0d5df8a605ca9d7da8f6eeca1fc171a8342e8
2018-10-23 14:12:03 -07:00
Matt Glazar
d1f1df8178 Refactor test code using fake_edenfs
Summary:
I want a function like `fake_eden_daemon` which instead spawns fake_edenfs using `eden start`. Refactor existing code to make such a function easier to write:

* Replace `contextlib.contextmanager` with a class called `FakeEdenFS` so its `__exit__` method can be reused.
* Rename `fake_eden_daemon` to `FakeEdenFS.spawn` so it's clearer that the function creates a process.

This diff should not change behavior.

Reviewed By: chadaustin

Differential Revision: D10415123

fbshipit-source-id: 81e6a0618214a527dc7f15cc18d4fe97dd1a957e
2018-10-23 14:12:03 -07:00
Matt Glazar
3727e33d38 Factor duplicate pexpect.spawn 'eden stop'/'eden status' calls
Summary:
Make StopTest and HealthOfFakeEdenFSTest similar to RestartTest by putting the code to invoke 'eden --config-dir ... stop-or-status' into its own function.

This diff should not change behavior.

Reviewed By: chadaustin

Differential Revision: D10414421

fbshipit-source-id: e42cdee64ae282fa0575cf875b53ac91fa61d490
2018-10-22 20:27:25 -07:00
Matt Glazar
790947a4c1 Consolidate test temp dir creation and cleanup
Summary: Several tests create a temporary directory and destroy it. Consolidate the temporary directories and their cleanup code to reduce code duplication.

Reviewed By: simpkins

Differential Revision: D10251110

fbshipit-source-id: caa5b5ad49fcb7925f63094594af4a20009d790d
2018-10-10 17:29:39 -07:00
Matt Glazar
870ce65f0f Fix 'eden stop' hang if Thrift hangs
Summary:
If 'eden stop' tries to tell edenfs to cleanly shut down, and edenfs never responds, 'eden stop' just hangs. Make 'eden stop' time out CLI -> edenfs Thrift calls. After a timeout, 'eden stop' should by stop edenfs via SIGKILL.

Note: This diff does not affect 'eden restart'.

Reviewed By: chadaustin

Differential Revision: D9982372

fbshipit-source-id: 42e498fb93fd97a2ec963e97c25f4b4101c7d524
2018-10-09 15:12:34 -07:00
Matt Glazar
ada2bd6752 Refactor stop_test.py to use pexpect
Summary:
pexpect prints program output while the program is running, which is very useful when debugging. Make the tests in stop_test.py use this feature.

Also, add some assertions to some of the tests.

Reviewed By: chadaustin

Differential Revision: D10157354

fbshipit-source-id: 210fcde79d5d21c6ee34fad3813e7c56eb298b9b
2018-10-09 14:32:59 -07:00
Matt Glazar
043e036260 Add timeout to 'eden status'
Summary: If edenfs is unresponsive, 'eden status' hangs forever. Add a timeout to turn the hang into a user-friendly error.

Reviewed By: chadaustin

Differential Revision: D10156229

fbshipit-source-id: 9186826ae6b131a193b1499c8baac616d131357f
2018-10-09 13:56:56 -07:00
Matt Glazar
362e567f68 Add some 'eden stop' tests
Summary:
'eden stop' has poor test coverage. Write tests for the common case and some edge cases which 'eden stop' already handles.

This diff should not change behavior.

Reviewed By: wez

Differential Revision: D10017819

fbshipit-source-id: 4d9f5db52187c34c62a9379a6b3dd62f62894233
2018-09-26 13:23:03 -07:00
Adam Simpkins
3d27bdca1b improve behavior of "eden restart"
Summary:
Update `eden restart` to explain that the restart will be disruptive when
performing a full restart, and prompt the user for confirmation.  This prompt
can be overridden with the `--force` option.  Also print more messaging after
the restart completes telling users what to do if they see "Transport endpoint
not connected" errors from programs still using the old mount points.

This also updates `eden restart` to more carefully handle cases where there is
an existing edenfs daemon running but it is not fully healthy.

Reviewed By: wez

Differential Revision: D8731004

fbshipit-source-id: 05762187b47057b2930d0a6b71b0a6fdbd4aa7e5
2018-07-11 19:05:32 -07:00
Adam Simpkins
4b8a6ad542 fix timeout handling in eden stop
Summary:
D7946842 moved some of the daemon management code from util.py to daemon.py
but accidentally broke handling of TimeoutError exceptions.  The code in
daemon.py was trying to catch python's built-in `TimeoutError` type, while the
code in util.py throws its own `util.TimeoutError` type.

This removes the custom `TimeoutError` type in util.py and just uses the
built-in python type to be consistent everywhere.

Reviewed By: wez

Differential Revision: D8373739

fbshipit-source-id: 8523c444fef74b0758c38b4fe2644d4f68d38442
2018-06-12 11:54:49 -07:00