- Issue created by @larowlan
- last update
about 1 year ago 30,142 pass, 1 fail - @larowlan opened merge request.
- last update
about 1 year ago 30,142 pass, 1 fail - last update
about 1 year ago 30,142 pass, 1 fail - last update
about 1 year ago 30,142 pass, 1 fail - last update
about 1 year ago 30,150 pass - last update
about 1 year ago 30,150 pass - Status changed to Needs review
about 1 year ago 11:38pm 11 September 2023 - 🇬🇧United Kingdom catch
Would never have believed this would be easier than patches. There will be cases that this doesn't cover, but it should cover 90% of issues where we'd ask for a 'test only' patch or more than that.
- last update
about 1 year ago 30,150 pass - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Yeah this is also better on the $$ than patches because we just run the changed tests and not the whole suite.
Pushed some changes to split out how I revert deletions and modifications from additions using diff-filter.
The cases it won't catch are nightwatch tests. Still thinking about how to handle that, but they're nowhere near as common.
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Sample pipeline showing this works - https://git.drupalcode.org/project/drupal/-/pipelines/19253
MR currently has patch from 🐛 "Enforced" Dependencies of Optional Configs Overwrite Other Dependencies RTBC as a proof of concept
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
I guess we postpone this on the parent?
- 🇬🇧United Kingdom catch
Let's postpone, but also try to get it in asap once the main issue lands. The output looks really good!
- 🇺🇸United States smustgrave
Wonder if this could include a CR or note how to do a test-only in gitlab? is it automatic?
- Status changed to Needs work
about 1 year ago 2:17pm 13 September 2023 - 🇳🇱Netherlands bbrala Netherlands
Since it was merged, we need a rebase since this includes some changes that now live in core.
- 🇪🇸Spain fjgarlin
Answering #10. Yes, the idea is that it is automatic. No need to upload test-only branches or patches, the Gitlab CI job will do it for you (and the reviewers).
- 🇬🇧United Kingdom catch
Yeah there'll be a button to press on the pipeline UI to get the test only run, but no extra MR to create, no patch to upload etc.
- 🇺🇸United States smustgrave
That. Is. AMAZING!!
So it just automatically picks up test files?
- 🇬🇧United Kingdom catch
Yes so what the new pipeline actually does is:
1. For every change that's not to an test file, checks it out from origin.
2. Lists the remaining files - which is just the tests now.
5. Runs phpunit against those files - so if there is one method addition to a test class, it'll run that test class, if a patch updates 15 tests, it runs those 15.It's an individual pipeline job which is manually triggered alongside the other pipeline jobs, and it is set not to cause the entire pipeline to fail. So you can get a passing pipeline, + a test only job which you manually start, and when it fails, that means the tests failed.
There are occasionally issues where this approach won't work - say you need half a change to make the tests run at all but omit something else to show the test failure, but those are pretty rare and we could handle it ad-hoc issue by issue - possibly with extra 'draft' MRs, possibly something else - like reverting a commit, running a pipeline, taking a screenshot, reinstating the change.
- Status changed to Needs review
about 1 year ago 9:02pm 13 September 2023 - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Rebased on top of 11.x and removed the code from 🐛 "Enforced" Dependencies of Optional Configs Overwrite Other Dependencies RTBC
- last update
about 1 year ago 30,150 pass - 🇳🇱Netherlands bbrala Netherlands
I think this is a great start. We might need to consider that there might be changes in something like composer.json. What is a change is also adding/updating a package since that broke. Then we need to composer install. I don't think we'd want to do this manually, but perhaps some sort of check for that is a good idea.
This could also be a follow up, to not run tests if [insert list of files] is changed.
- last update
about 1 year ago 30,154 pass - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Addressed reviews and fixed the out of date partial names
- Status changed to Needs work
about 1 year ago 5:58pm 19 September 2023 - 🇺🇸United States smustgrave
Don't want to interrupt the work here but may need a rebase? But there are some open threads from what I can tell.
- last update
about 1 year ago 30,168 pass - Status changed to Needs review
about 1 year ago 11:18pm 19 September 2023 - last update
about 1 year ago 30,169 pass - Status changed to Needs work
about 1 year ago 1:11am 20 September 2023 - 🇺🇸United States smustgrave
Picked 🐛 Generic Revision UI's Revision overview page generates wrong operations/view links for a translation Fixed for testing
Got a failure when I triggered the test-only build
fatal: ambiguous argument 'origin/11.x': unknown revision or path not in the working tree.
31:46 30:35 Running- Status changed to Needs review
about 1 year ago 1:38am 20 September 2023 - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Think I've fixed that, didn't revert 🐛 Generic Revision UI's Revision overview page generates wrong operations/view links for a translation Fixed yet
17:52 17:40 Running14:52 14:35 Running- Status changed to Needs work
about 1 year ago 2:36am 20 September 2023 - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Still not working, something wrong with the bash commands, pausing for today
https://git.drupalcode.org/project/drupal/-/jobs/102286 didn't checkout the non test changes so the tests passed
- 🇬🇧United Kingdom longwave UK
Do we have a better way of identifying tests? Not all of them end in Test.php, although maybe we should have a policy and test coverage to ensure this is consistent.
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Do we have many tests in core that use the @test annotation? Short of that I thought the file name had to end in Test.php to be found by phpunit?
- 🇬🇧United Kingdom catch
Yeah discovery looks for Test.php so I think everything actually does end with that, or at least the class name has to finish with Test which is the same thing.
- last update
about 1 year ago 30,169 pass - 🇪🇸Spain fjgarlin
I think I fixed the test-only script part.
https://git.drupalcode.org/issue/drupal-3386566/-/jobs/105712
- Status changed to Needs review
about 1 year ago 1:58pm 27 September 2023 - Status changed to Needs work
about 1 year ago 5:49pm 27 September 2023 - 🇺🇸United States smustgrave
I see that the pipeline failed in a few spots. Kernel, FunctionalJavascript.
Also looking at the test-only spot the failures it's reporting I don't believe are from this MR. HttpExceptionNormalizerTest was not something that was changed?
- last update
about 1 year ago 30,363 pass - last update
about 1 year ago 30,363 pass - Status changed to Needs review
about 1 year ago 7:30am 28 September 2023 - 🇪🇸Spain fjgarlin
The last pipeline fails were widespread across all MRs, with GitLab not being able to spin up runners, those should be fixed already.
I rebased the branch. The pipelines are running again.
Regarding the files, if the branch is not rebased it can show different files which are not in this branch but made it to the HEAD of 11.x.
I added an informative message after listing the "changed" files prompting users to rebase the branch if this happens.Back to Needs Review (will keep an eye on the pipeline).
- last update
about 1 year ago 30,363 pass - 🇬🇧United Kingdom catch
Regarding the files, if the branch is not rebased it can show different files which are not in this branch but made it to the HEAD of 11.x.
This also seems like a feature for making sure that changes won't cause test failures against HEAD :)
- Status changed to Needs work
about 1 year ago 2:12pm 28 September 2023 - 🇺🇸United States smustgrave
So the pipeline is showing all green, tests are showing all green.
When I run the test-only though I get errors https://git.drupalcode.org/issue/drupal-3386566/-/jobs/124477 from the last ticket to be merged.
- last update
about 1 year ago 30,361 pass - Status changed to Needs review
about 1 year ago 5:52am 29 September 2023 - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
I think it just needed a rebase, MRs aren't like patches in so far as they don't apply to HEAD, they apply to the point in time
- Status changed to RTBC
about 1 year ago 7:08am 29 September 2023 - 🇬🇧United Kingdom catch
This looks good to me, there's no test changes in the branch so we can't check the latest MR's output (and I realised this after pushing the button, not before), but there are successful examples from earlier in the issue. Once it's merged we can try it out on core MRs and will find any issues that way, it's only running on-demand so shouldn't introduce instability.
-
longwave →
committed d60aab72 on 10.1.x
Issue #3386566 by larowlan, fjgarlin, smustgrave, catch: Add support for...
-
longwave →
committed d60aab72 on 10.1.x
-
longwave →
committed 3f49e8cd on 11.x
Issue #3386566 by larowlan, fjgarlin, smustgrave, catch: Add support for...
-
longwave →
committed 3f49e8cd on 11.x
- Status changed to Fixed
about 1 year ago 9:04am 29 September 2023 - 🇬🇧United Kingdom longwave UK
Fantastic to see this working, we might need some tweaks in followups but let's see how we get on with this - and hopefully it should make it much easier than uploading separate test-only patches.
Committed and pushed 3f49e8cdca to 11.x and d60aab72b3 to 10.1.x. Thanks!
- Status changed to Needs work
about 1 year ago 6:19pm 30 September 2023 - 🇺🇸United States xjm
This is awesome!
However, it needs:
- To be documented in the hanbdook somewhere, with the screenshot from the IS (probably along with everything else about GitLab CI for issue users, like the little green check/red x, how to find the specific results of failed jobs because half the time a text search gets "stuck" in the results output and there's no clear build status with a fail message that I can find, etc. etc.)
- To be added to the core gate item about test-only patches, linking the above docs.
- 🇬🇧United Kingdom catch
We need an issue, not sure if one is open or not, for better failed result summaries. i.e. at least at the job level but ideally at the pipeline level we should be able to show which tests failed and with what message etc. Right now I am relying on ctrl-f. Keep forgetting to search/open issues though.
- 🇮🇳India bhanu951
In reference to #26 we need to fix this issue 📌 Rename test classes not ending with Test to end with Test Needs work
- 🇮🇳India bhanu951
catch in#28:
> so I think everything actually does end with that, or at least the class name has to finish with Test
That is still not the case there are still test classes without ending with Test.php
- 🇬🇧United Kingdom catch
I opened 📌 [GitLab CI] Improve failure reporting summary Active .
- 🇸🇰Slovakia poker10
I have created 🐛 Remove variables export from test-only job Needs review , as it seems like that we have reintroduced variables export in this commit.
- 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺
if [[ $(git diff refs/heads/${TARGET_BRANCH} --diff-filter=DM --name-only|grep -Ev "Test.php$"|grep -v .gitlab-ci|grep -v scripts/run-tests.sh) ]]; then
We are filtering *Test.php.
IMHO we should use */tests/* instead. When we move this to the gitlab contrib templates, I've used to have mock data too in the tests folder.
This might actually be relevant for core too if there are fixes to e.g. Upgrade tests with db dumps.Didn't create a new issue, but we might if you agree?
- 🇨🇭Switzerland berdir Switzerland
Came here to comment on that as well. test-only tests often also require changes to/new test modules and other information that is most of the time found in tests folders. I guess there are exceptions to that, but they are probably pretty rare?
- 🇬🇧United Kingdom catch
That seems like a good idea to me too, will catch more changes that way.