Closed Bug 1470476 Opened 7 years ago Closed 7 years ago

Port the pushlog test suite to use Mercurial .t tests

Categories

(Developer Services :: Mercurial: Pushlog, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sheehan, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(6 files, 1 obsolete file)

The pushlog extension includes a set of verbose unit tests that query a repo behind an `hg serve` process with the pushlog extension enabled and compare the returned result with some expected output. This is great, except the repo that the pushlog is queried against is decompressed from a tarball kept inside the repo. Since the tests were written, Mercurial has developed the .t test format which can create the repo based on a set of shell commands directly in the test. This is much better for Mozilla's purposes as it allows us to see exactly what commands were used to create the repository. We can also use commands like `hg log -G` to look at the DAG structure in the test and update the test to support more complex queries. We should port the existing test suite to the .t test format.
We appear to only have tests for this in test-pushlog.py. And those tests aren't verbose, so it is difficult to figure out failures. Let's add explicit test coverage for paging.
Comment on attachment 8990428 [details] pushlog: add test coverage for paging; r?sheehan Connor Sheehan [:sheehan] has approved the revision. https://phabricator.services.mozilla.com/D1984
Attachment #8990428 - Flags: review+
Keywords: leave-open
Pushed by gszorc@mozilla.com: https://hg.mozilla.org/hgcustom/version-control-tools/rev/1bda3af8f34a pushlog: add test coverage for paging; r=sheehan
The function added in this commit essentially recreates the repo found by decompressing hgext/pushlog-legacy/testdata/test-repo.tar.bz2. We export `USER` so when `hg serve` starts, that variable will be set to a predictable username. Since we can't use the timestamps from the old tests and need to know the dates of some pushes to make queries that will actually test the functionality of the code, we save the date and time of execution a few times throughout the creation process. In later tests we will use these values as our `startdate` and `enddate` parameters. A sleep has been added around the calls to `date` to assert the second value for the push and the exported variable are different.
This commit adds a function to `helpers.sh` that creates a repo with similar pushlog qualities as `"test-user-repo.tar.bz2"`. Unlike the other archived repo in the `pushlog-legacy` tests, this repo was designed to test querying pushing users. The push user is pulled from the `USER` or `REMOTE_USER` environment variables, and is therefore required to be set in the environment of the `hg serve` process which is handling pushes to the server. To simulate this, before every change in user making the push, we kill the `hg serve` process, wait for $HGPORT to open up and re-spawn the server. This functionality is encapsulated in the `setpushuser` function. Like the other repo creation function in `helpers.sh`, we record an occasional timestamp to use in query string parameters in later testing.
This commit changes test-hgweb.t to use the previously added repo creation functions instead of decompressing an existing repository. We also move the reference JSON output directly into the test, and remove the redundant files.
This commit moves the ATOM tests from `test-pushlog.py` into a new file `test-hgweb-atom.t`. The redundant tests and files have been removed as well.
Some tests in `test-pushlog.py` test similar things to the tests in `test-hgweb.t`. This commit ports these tests to the .t format.
This commit ports the pushlog user queries to the .t format. These tests are tests of the pushlog user filtering functionality, and require the repo created via `maketestrepousers` to function. As with previous commits, this commit removes all redundant testdata files that are no longer required after this test. It also removes the `test-pushlog.py` file, since all Python integration tests are now in the .t format. Yay!
Attachment #8992813 - Attachment description: pushlog-legacy: use repo creation function instead of repo archive (Bug 1470476) r?gps → pushlog: use repo creation function instead of repo archive (Bug 1470476) r?gps
Attachment #8992811 - Attachment is obsolete: true
Pushed by gszorc@mozilla.com: https://hg.mozilla.org/hgcustom/version-control-tools/rev/d4592798494e pushlog: add function to create pushlog-legacy test repo with users r=gps
Comment on attachment 8992812 [details] pushlog: add function to create pushlog-legacy test repo with users (Bug 1470476) r?gps Gregory Szorc [:gps] has approved the revision. https://phabricator.services.mozilla.com/D2211
Attachment #8992812 - Flags: review+
Comment on attachment 8992813 [details] pushlog: use repo creation function instead of repo archive (Bug 1470476) r?gps Gregory Szorc [:gps] has approved the revision. https://phabricator.services.mozilla.com/D2212
Attachment #8992813 - Flags: review+
Pushed by gszorc@mozilla.com: https://hg.mozilla.org/hgcustom/version-control-tools/rev/a135f1d23f09 pushlog: use repo creation function instead of repo archive r=gps
Comment on attachment 8992814 [details] pushlog: port pushlog ATOM tests to .t format (Bug 1470476) r?gps Gregory Szorc [:gps] has approved the revision. https://phabricator.services.mozilla.com/D2213
Attachment #8992814 - Flags: review+
Pushed by gszorc@mozilla.com: https://hg.mozilla.org/hgcustom/version-control-tools/rev/3732af5a5022 pushlog: port pushlog ATOM tests to .t format r=gps
Comment on attachment 8992815 [details] pushlog: convert JSON hgweb query tests to .t format (Bug 1470476) r?gps Gregory Szorc [:gps] has approved the revision. https://phabricator.services.mozilla.com/D2214
Attachment #8992815 - Flags: review+
Pushed by gszorc@mozilla.com: https://hg.mozilla.org/hgcustom/version-control-tools/rev/889dc454afa1 pushlog: convert JSON hgweb query tests to .t format r=gps
Pushed by gszorc@mozilla.com: https://hg.mozilla.org/hgcustom/version-control-tools/rev/97394b3a4f96 pushlog: port pushlog user queries to .t format r=gps
Comment on attachment 8992816 [details] pushlog: port pushlog user queries to .t format (Bug 1470476) r?gps Gregory Szorc [:gps] has approved the revision. https://phabricator.services.mozilla.com/D2215
Attachment #8992816 - Flags: review+
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: