Commit Graph

21 Commits

Author SHA1 Message Date
James E. Blair 249ccc403b Report per-branch cyclic-dependency conflicts
If a cycle of dependencies is attempted to be enqueued into a pipeline
and at least one of the participating projects has a per-branch change queue
and the changes in the cycle are in different branches, it can be confusing
for users why the changes were not enqueued.  This is even more likely to
happen with implicit cyclic dependencies such as those from Gerrit's
submitted-together feature (but can happen with any driver).

To aid users in this situation, report this situation back to the code
review system.

Change-Id: I26174849deab627b2cf91d75029c5a2674cc37d6
2022-03-21 12:54:02 -07:00
James E. Blair 80e909c385 Remove disused gearman_server usages from tests
The gearman server in tests doesn't do anything anymore, therefore
these tests don't actually need to use it.  Remove those references.

Change-Id: I48663a994647d6385a80d8c263c34ac8d9b8438f
2022-01-25 06:44:16 -08:00
Felix Edel c924435f1e Skip tests asserting on tenant reconfig results on multi scheduler
Those tests are failing with multiple schedulers depending on which
scheduler completed the tenant reconfiguration first. As all assertions
are done on the objects from scheduler-0, they will fail if scheduler-1
completed the tenant reconfiguration first.

To make those tests work with multiple schedulers, we might want to wait
until all schedulers completed their reconfigs before doing the
assertions.

There are also a few test cases that don't rely directly on the results
of a tenant reconfiguration, but still use local tenant objects for
assertions. I assume that those tests are failing for the same reason -
because the tenant object used for the assertion is not up-to-date.

Change-Id: I4df816ec98f5fbab25cd412a5146f0f85d6d0138
2021-11-30 08:58:27 -08:00
Simon Westphahl 4faf5498e4 Move re-enqueue to pipeline processing
Moving the re-enqueue step after a reconfiguration to the pipeline
processing phase allows us to re-enqueue multiple pipelines in
parallel in a multi-scheduler environment.

In case of a failure the re-enqueue can also be retried the next time
the pipeline is processed.

Change-Id: Iad483c37610b51d94ead72573c3540b1dea9ab84
2021-10-29 12:04:44 +02:00
Simon Westphahl 0d635181f8 Periodically maintain connection caches
With the persistent change cache in Zookeeper we need to periodically
remove changes that are outdated and no longer required by any active
item in the pipelines.

The cache maintenance will be performed together with the other general
cleanup every hour.

Change-Id: I62e75ab8c5b43f830e01b0e4c08b25ecdc5eed08
2021-09-16 10:50:29 +02:00
Felix Edel 6ac14615a0 Execute builds via ZooKeeper
This is the second part of I5de26afdf6774944b35472e2054b93d12fe21793.
It uses the executor api.

Three tests are disabled until the next change.

Change-Id: Ie08fa9dfb4bb3adb9a02e0a2e8b11309e1ec27cd
2021-06-29 14:37:15 -07:00
Jan Kubovy 8e333e65a9
Separate connection registries in tests
Each scheduler in tests needs its own connection registries.

This change only affects tests.

Change-Id: I2ad188cf5a72c46f7486c23ab653ff574123308b
Story: 2007192
2020-10-13 07:00:09 +02:00
Jan Kubovy 7df5508dbd Use scheduler manager consistently in tests
To improve consistency and remove `self.sched` and
use `self.scheds.first.sched` in all tests.

This change only touches tests.

Change-Id: I0a8c3f8ad634d1d88f3c68a11e4d5587993f4a0d
Story: 2007192
2020-04-03 14:49:59 +02:00
Jan Kubovy a770be9b83 Scheduler test app manager
As a preparation for scale-out-scheduler the scheduler in tests
were extracted in order to start multiple instances in a previous
change.

This change continues on by introducing a manager to create
additional scheduler instances and the ability to call certain
methods on some or all of those instances.

This change only touches tests.

Change-Id: Ia05a7221f19bad97de1176239c075b8fc9dab7e5
Story: 2007192
2020-04-03 14:49:59 +02:00
Jan Kubovy 1bb26d7b37 Make test setup_config more pure
Setup config will not set the base test config object rather return a new one.
This allows to setup multiple config objects which is needed in order to
instantiate mutliple schedulers enabling them to have different configs, e.g.
command socket.

Change-Id: Icc7ccc82f7ca766b0b56c38e706e6e3215342efa
Story: 2007192
2020-02-28 11:50:22 +01:00
James E. Blair b1ed58b172 Fix gerrit errors from production
This corrects the following errors.

Test fixture errors:

* Unlike the SSH API, the Gerrit REST API does not include
  COMMIT_MSG in the list of files.
* We weren't checking all elements of the (change id, branch,
  project) tuple when searching for change ids
* I observed a race around poll synchronization; I can't figure it out
  so I've added more debug log lines.

Production errors:

* Break after the first successful submit rather than attemping the
  call multiple times in all cases.  This was non-fatal.
* Only attempt to get the remote version if using HTTP.  This was
  non-fatal.
* URLquote search queries (they may contain '#').  The additional CRD
  tests cover this now.
* Coerce the list of files to a list rather than a dict_keys instance.
  The new single file test covers this.

Change-Id: I89a68b2d189b82f0bc64e78fbc875d5628cc2cf0
2019-09-20 07:26:04 -07:00
James E. Blair 947b7b1dcb Support HTTP-only Gerrit
This adds support for performing queries and git clones over HTTP
(reporting over HTTP was already supported).  This will happen
automatically for any connection with a password configured.
Otherwise, the SSH connection will be used as before.

Change-Id: I11920a13615de103eb3d8fb305eacbbcb30e5e40
2019-09-17 14:15:18 -07:00
Fabien Boucher c2a33fcb9c Return dependency cycle failure to user
This change changes the dependency cycle error handling in order
to report the error to the user via the standard report mechanics.

Change-Id: I7cdbd9b7b48fd612b2887007b70acedd7a8e3113
2019-07-25 11:11:53 +02:00
Brendan Jackman f605862a4d Fix "reverse" Depends-On detection with new Gerrit URL schema
The regex to detect Depends-On relations between Gerrit changes was recently
updated for the new URL schema. However because the change.uris attribute was
not also updated, getChangesDependingOn was not working, and the functionality
that this enables ("reverse" dependency processing, where a dependee change
triggers a test for an already-approved dependent) was not covered by the test.

Update the attribute and add test coverage.

Change-Id: I400445093beda390aa9ce19af31e50820f7c56df
2018-11-30 11:02:32 +07:00
Brendan Jackman dc4d6bc61c Add support for Gerrit v2.16's change URL schema
Gerrit 2.16 change URLs look like:
"{baseurl}/c/{project}/+/{change_no}/". Update the regex so it matches those
too.

Suggested by tristanC on #zuul

Change-Id: I5eabe25bc26ce4a2d829b1a77d2023fd19c1068f
2018-11-23 16:50:19 +07:00
Fabien Boucher bc20de95e5 Remove unecessary shebang and exec bit
Change-Id: I54de68b11f055a9269ca5efb8a57f81d57f9d55f
2018-07-26 07:12:24 +00:00
Fabien Boucher b5496fa672 Fix new depends-on format matching for prefixed gerrit ui
This patch aims to fix issue where such a depends-on won't match.

Depends-On: https://sftests2.com/r/#/c/1/

Indeed here Gerrit is hosted behind a reverse proxy under /r.
The regexp matching fail. Also the connection source lookup
may fail if Gerrit web interface is not connection.server or
connection.canonical_hostname so this path defines connection.baseurl
as a new lookup condition.

connection.baseurl is then used to build the regexp in order
to set the path prefix of the Gerrit ui.

Story: 2002080

Co-Authored-By: Nicolas Hicher <nhicher@redhat.com>

Change-Id: Ie764bfc814b821636d447f82147a7d76e0511d2f
2018-05-23 13:13:11 +02:00
James E. Blair df31eb63cf Support the fragment form of Gerrit URLs
Some folks may copy the URL out of their brower location field
rather than using the permalink when creating a Gerrit Depends-On,
so support that as well.

Change-Id: Ie35fde41befcb0c5c062fcc0417afeed1cf60a77
2018-01-31 14:11:39 -08:00
James E. Blair a86134f528 Fix dependency cycle false positive
This corrects a false-positive in the dependency cycle detection,
but only for the new URL-style depends-on headers.  It does not
do so for the legacy gerrit headers.

We used a single history list to store all the changes we enqueued
ahead of a given change, but this meant that if there was more
than one path to a change, we would see it in the history on the
second traversal.  Instead, when traversing the tree, use copies
of the history list at each stage so that it can be rewound when
going back up the tree.  The second path to a change will not
trip the cycle detection, and will proceed on to the point where
it notices the change is already in the queue and return harmlessly.

Also, check whether the exact change is in the history, not just
the number, since numbers are no longer unique with multiple sources.

Also, fix a bug in the test_crd_cycle test which was causing the
test to always pass since the changes were never enqueued due to
missing approval requirements.

Change-Id: I3241f90a1d7469d433cfa176e719322203d4d089
Story: 2001427
Task: 6133
2018-01-17 04:23:39 +00:00
James E. Blair 0e4c791c7b Support cross-source dependencies
Additional tests and docs in later patches.

Change-Id: I3b86a1e3dd507fa5e584680fb6c86d35f9ff3e23
Story: 2001334
Task: 5885
2018-01-16 09:37:40 -08:00
James E. Blair 1c2023c108 Add skipped CRD tests
Change-Id: I145617342b424397ae19cf92335b357e413559ba
2018-01-10 13:33:27 -08:00