Closed Bug 1484231 Opened 7 years ago Closed 7 years ago

Write tests for unifyrepo extension

Categories

(Developer Services :: Mercurial: hg.mozilla.org, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sheehan, Assigned: sheehan)

References

Details

Attachments

(6 files)

We've had the unify repo service break twice in the last month (bug 1484181 and bug 1480034). Setting the service to notify developer-services@mozilla.org when a failure occurs alerted us to bug 1480203, which we have yet to resolve. It's time we write some tests for this functionality.
I have a few patches for this ready to go, just ironing out a race condition in the test. Should be up for review later today.
Assignee: nobody → sheehan
Status: NEW → ASSIGNED
If this warning is displayed, we will always hit an abort later in the program: "abort: repository is unrelated". We will hit this condition while pulling in changesets from other repos, but we may end up wasting time pulling in changesets for repos that are relevant first. We should abort upon hitting this condition instead.
Currently the call to `replicatesync` comes from inside the unifyrepo extension. This means that vcsreplicator is a direct dependency of unifyrepo and we will need to run the Docker test suite to test this extension. Boo! By moving the replicatesync call into the daemon, we can create a lightweight test for the unifyrepo extension that does not require Docker. We can also run the unifyrepo tests in our Docker-less CI environment. A later commit will add a test to ensure this functionality works as intended.
The path variable is set when iterating over the source repos the first time, but it is never reset to the correct source when iterating over the sources a second time. Therefore whatever repo was last in the iteration during the first loop will have the same name in the final loop. This causes an issue in the `unifypushes` function, as we will hit the `if lastsource == source and lastid == pushid` condition when pushlogs between two separate repos have the same push id. For example, this condition will be true for repo1 push 1 and repo2 push 1, as source is the same for all repos. This is likely the root cause of bug 1480203, further testing will be required to know for certain.
This extension requires a pushlog to exist on every source repo to correctly function. While we are ensuring the repos have correct origin commits, we should also check for a pushlog.
This commit adds a basic test for unifyrepo functionality. The test covers all available config options and a few failure conditions (no common ancestor, pushlog required).
This commit adds a test for the unify-daemon process. The main thing to test in this instance is that we can successfully use the script to specify an `hg` executable, config files and that moving the `hg replicatesync` call into the daemon will work as intended.
Comment on attachment 9002965 [details] unifyrepo: abort when source commit is not shared by all repos (Bug 1484231) r?gps Gregory Szorc [:gps] has approved the revision.
Attachment #9002965 - Flags: review+
Comment on attachment 9002967 [details] unifyrepo: set `path` variable correctly while iterating over source repos (Bug 1484231) r?gps Gregory Szorc [:gps] has approved the revision.
Attachment #9002967 - Flags: review+
Comment on attachment 9002968 [details] unifyrepo: verify pushlog is available before repo unification (Bug 1484231) r?gps Gregory Szorc [:gps] has approved the revision.
Attachment #9002968 - Flags: review+
Attachment #9002966 - Attachment description: unifyrepo: move `hg replicatesync` call to unify-daemon (Bug 1484231) r?gps → unifyrepo: move `hg replicatesync` call behind conditional flag (Bug 1484231) r?gps
Keywords: leave-open
Pushed by cosheehan@mozilla.com: https://hg.mozilla.org/hgcustom/version-control-tools/rev/b25f52b53220 unifyrepo: abort when source commit is not shared by all repos r=gps
Comment on attachment 9002966 [details] unifyrepo: move `hg replicatesync` call behind conditional flag (Bug 1484231) r?gps Gregory Szorc [:gps] has approved the revision.
Attachment #9002966 - Flags: review+
Pushed by gszorc@mozilla.com: https://hg.mozilla.org/hgcustom/version-control-tools/rev/f8bbd15046e4 unifyrepo: move `hg replicatesync` call behind conditional flag r=gps
Comment on attachment 9002969 [details] unifyrepo: add basic test functionality (Bug 1484231) r?gps Gregory Szorc [:gps] has approved the revision.
Attachment #9002969 - Flags: review+
Pushed by gszorc@mozilla.com: https://hg.mozilla.org/hgcustom/version-control-tools/rev/a0122a3f55fd unifyrepo: set `path` variable correctly while iterating over source repos r=gps
Pushed by gszorc@mozilla.com: https://hg.mozilla.org/hgcustom/version-control-tools/rev/0f67d96305df unifyrepo: verify pushlog is available before repo unification r=gps
Comment on attachment 9002970 [details] unifyrepo: add test for daemon process (Bug 1484231) r?gps Gregory Szorc [:gps] has approved the revision.
Attachment #9002970 - Flags: review+
Tests for unifyrepo have landed.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Keywords: leave-open
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: