Repository navigation
feat(acceptance): add support for Elasticsearch to the acceptance workflow - #88
Conversation
…kflow Apps whose acceptance tests need Elasticsearch - search_elastic - could not run them on GitHub Actions at all: the acceptance workflow provisions only mysql and postgres, so those suites were stranded in Drone. An optional `elasticsearch-version` input now starts owncloudops/elasticsearch on the host network. The version is an input rather than a boolean so callers pin it explicitly, the way `databases` already carries "mysql:8.0"-style values. Empty - the default - keeps the workflow unchanged for every existing caller. Running it with --network host means the app is reachable under its own default `localhost:9200` setting, so no `occ config:app:set` step is needed; that is only required in Drone because Elasticsearch is a separate container hostname there. The two ELASTICSEARCH_* variables mirror the Drone service definition to quieten the logs and skip the memory-lock bootstrap check. The readiness gate polls `_cluster/health?wait_for_status=yellow` rather than just probing the port, because the first Background step of these suites creates the search index and therefore needs shards allocated, not merely a listening socket. On failure the cluster health, the index list and the container log are dumped so a red run can be diagnosed. Note the new `acceptance-api-elasticsearch` job in test.yml stays red until owncloud/search_elastic gains the `make ci` target the "Setup app" step invokes - that app has never had one, having never run through this workflow. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: Thomas Müller <[email protected]>
The `elasticsearch-version` input does not exist on owncloud/reusable-workflows@main yet - it is only on the branch of owncloud/reusable-workflows#88. GitHub validates reusable workflow inputs when the run starts, before any job executes, so an unknown input is not a failure of the job that passes it: it is a startup failure that invalidates the whole workflow file. The result was a run with no checks at all, taking down the existing code style and unit test jobs as collateral damage. Referencing the feature branch directly makes the file valid again, so every job runs and the acceptance suites can actually be exercised before either PR merges. A TODO records the switch back to @main once #88 lands. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: Thomas Müller <[email protected]>
The Elasticsearch plumbing is verified workingowncloud/search_elastic#349 consumes this branch and is fully green: So the service step, the The
|
* ci: run acceptance tests on GitHub Actions Code style and unit tests were migrated to GitHub Actions already, with the corresponding Drone stages switched off, but acceptance tests were left behind and still ran only in Drone. The whole Behat layer was therefore invisible to the checks on a pull request - including the regression scenario added for the stored XSS fix in the search content highlights, which no GitHub check executed. Both suites now run there: the API job fans out over apiSearchElastic and apiLimitSearches, and a second job runs webUISearchElastic. Elasticsearch is provided by the reusable workflow's new `elasticsearch-version` input, and mysql:8.0 is pinned to match what Drone uses rather than taking the reusable default of mariadb. The reusable workflow installs the app under test with `make ci`, which this Makefile did not define - the target is added here, mirroring the other apps. It depends on `vendor`, whose `--no-dev` install omits the behat tooling; that is intentional, since the acceptance targets pull their own dependencies in on the test-runner side. Two deliberate differences from the Drone configuration: Firefox is dropped, as the reusable workflow only starts a Chrome Selenium container - the one Firefox-sensitive scenario is already tagged @skipOnFIREFOX - and the files_external extra app is not requested, because it ships with core and is enabled by default. .drone.star is left untouched so both systems run acceptance in parallel for now, which is what makes it possible to compare results and rule out flakiness before the Drone pipeline is retired. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: Thomas Müller <[email protected]> * ci: point acceptance jobs at the reusable workflow branch The `elasticsearch-version` input does not exist on owncloud/reusable-workflows@main yet - it is only on the branch of owncloud/reusable-workflows#88. GitHub validates reusable workflow inputs when the run starts, before any job executes, so an unknown input is not a failure of the job that passes it: it is a startup failure that invalidates the whole workflow file. The result was a run with no checks at all, taking down the existing code style and unit test jobs as collateral damage. Referencing the feature branch directly makes the file valid again, so every job runs and the acceptance suites can actually be exercised before either PR merges. A TODO records the switch back to @main once #88 lands. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: Thomas Müller <[email protected]> * test: convert behat config from YAML to PHP The acceptance suites could not start at all: behat aborted with "Unable to parse at line 1 (near "<?php")" and ran 0 scenarios. Core's tests/acceptance/run.sh looks for config/behat.php, acceptance/config/ behat.php and tests/acceptance/config/behat.php, and falls back to its own config/behat.php when none is found. There is no behat.yml in that list any more, so this app's YAML config was never found and behat was handed core's PHP config as a YAML file instead. This is pre-existing breakage rather than a consequence of moving to GitHub Actions - Drone clones core master too and also never sets BEHAT_CONFIG_FILE - but it blocks the migration, so the config is converted here. All three suites and their contexts are carried over unchanged; the shared FeatureContext arguments keep the behaviour the YAML anchor gave them. behat itself is bumped from ^3.13 to ^3.31 because PHP configuration is not supported before 3.20, and ^3.13 resolved to 3.15. The vendor-bin platform is raised from 7.4 to 8.3 to match, which is what appinfo/info.xml already requires and what behat 3.31 needs. Verified by dry-running the suites inside a core checkout: apiSearchElastic resolves 72 scenarios and apiLimitSearches 52, where both previously reached 0. The webUI suite cannot be dry-run outside run.sh, as its page objects need the Mink session - files_texteditor, whose webUI suite passes in CI, fails the same way under the same command. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: Thomas Müller <[email protected]> * test: wait for the search index to refresh after creating it The apiLimitSearches suite failed intermittently, and on different rows each run: one attempt missed '/फन्नि näme/upload.txt', the next also missed the plain ASCII '/just-a-folder/upload.txt'. That the failing paths move between runs, and are not confined to non-ASCII names, points at a race rather than an encoding problem. `the search index has been updated` already sleeps for two seconds, with a comment explaining that Elasticsearch only makes changed shards searchable every index.refresh_interval, which defaults to one second, so continuing immediately can return results based on stale data. `the search index has been created` had no such wait, even though it leaves documents equally unsearchable, so scenarios whose Background creates the index could search before the shards had refreshed. The same two second wait is applied there. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: Thomas Müller <[email protected]> --------- Signed-off-by: Thomas Müller <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]>
The comment asked for both acceptance jobs to be switched back to @main once owncloud/reusable-workflows#88 merged. That happened in #350, so the two jobs already reference @main and the note now contradicts the four lines below it. Signed-off-by: Thomas Müller <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]>
Description
Apps whose acceptance tests need Elasticsearch —
search_elastic— could not run them on GitHub Actions at all. The acceptance workflow provisions only mysql and postgres, and there was no hook for anything else, so those suites stayed stranded in Drone.This adds an optional
elasticsearch-versioninput that startsowncloudops/elasticsearchon the host network. Empty — the default — leaves the workflow completely unchanged for every existing caller.The shape follows #58 (email server) exactly: one
workflow_callinput, one gateddocker runstep, one demo caller intest.yml.Design notes
Why a version string, not a boolean. Callers pin the version explicitly, the way
databasesalready carriesmysql:8.0-style values, so apps can move between ES versions without touching this workflow.Why no
occ config:app:set search_elastic serversstep. Drone needs one because Elasticsearch is a separate container hostname there. With--network host, the service is reachable under the app's own default setting oflocalhost:9200, so nothing has to be configured — verified against a live container, including thatparse_urlhandles that scheme-less value correctly. This also matches how Selenium and Inbucket are already started.Why poll
_cluster/health?wait_for_status=yellowrather than probing the port like Drone'swait-for: the firstBackgroundstep of these suites creates the search index, so it needs shards allocated, not merely a listening socket. A TCP check would pass too early and fail intermittently.The two
ELASTICSEARCH_*variables mirror the Drone service definition — quieten the logs, skip the memory-lock bootstrap check. Novm.max_map_counttuning is needed: the image's entrypoint template setsdiscovery.type: single-node.On failure the cluster health, index list and container log are dumped, so a red run is diagnosable rather than opaque.
Note on the new test.yml job
acceptance-api-elasticsearchwill fail until owncloud/search_elastic#349 lands — the "Setup app" step runsmake ci, and that app has never defined the target, having never run through this workflow before. Flagging it here rather than leaving a reviewer to discover it. Merging that PR first, or accepting one red job briefly, both work.How Has This Been Tested?
Each new step was executed verbatim against a live container, not just reviewed:
owncloudops/elasticsearch:7.17starts and is reachable onlocalhost:9200;_cat/pluginsreportsingest-attachment 7.17.20.timeout 600 bash -c 'until curl -sf ...'command returns"status":"green"and exits 0, in ~18s from a cold start._cat/indicesanddocker logsall produce useful output.actionlinton both changed files: 75 findings before, 75 after — the changes introduce no new lint findings, and there are no schema or expression errors. (The pre-existing ones areshellcheckSC2086infonotes on untouched steps.)Not yet verified: a full acceptance run, which needs the dependency above.
Types of changes
🤖 Generated with Claude Code