refactor test organisation#2383
Conversation
Hello sylvainsenechal,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
65f3a05 to
419f2de
Compare
There was a problem hiding this comment.
end2end.yaml file was like 700 lines, with like ~6 nodes setup so I think this is better
| run: yarn lint | ||
|
|
||
| lint-ctst: | ||
| lint-tests: |
There was a problem hiding this comment.
One linter for everything now, since all tests fits in a single js project
There was a problem hiding this comment.
We had some python scripts sitting in the /zenko_tests (old mocha tests) folder.
Yet these scripts are actually used for both cucumber and mocha tests. I moved these python script to their own folder. I was even thinking about putting them in .github/something but for now they are still in /tests, just in a separate subfolder
| 5. Install node and npm. | ||
| 6. Navigate to `Zenko/tests/node_tests/backbeat`. | ||
| 6. Navigate to `Zenko/tests/mocha/backbeat`. | ||
| 7. Install node modules: `npm i`. |
There was a problem hiding this comment.
might need another pass later for these readmeS and .md
I did some update, but here I see for example "npm i" but we generally use yarn. I think some stuffs are stale but not gonna address in this pr
| 'pass-on-failing-test-suite': process.env.CI_PASS_ON_TEST_FAILURE === 'true', | ||
| 'exit': true, | ||
| 'reporter': 'mocha-multi-reporters', | ||
| 'reporter-options': 'configFile=mocha/mocha-reporter.json', |
There was a problem hiding this comment.
this used to be embedded in the package.json yarn command of the mocha test
| @@ -0,0 +1,78 @@ | |||
| import path from 'node:path'; | |||
There was a problem hiding this comment.
This file, as well as the as the new package.json and tsconfig.json are really just some kind of merge of what we already had before, not much change
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
|
Few remarks (did not review the full PR, just had a quick look):
|
maeldonn
left a comment
There was a problem hiding this comment.
Merging cucumber and mocha makes sense as they share most dependencies. But workflows shares nothing with them, and its postinstall (downloads the act binary) now runs for every yarn install. Could we keep it as its own package.json like before?
There was a problem hiding this comment.
In all our tickets, documentation, and other materials, we refer to these tests as 'ctst.' Do you think it's a good idea to rename them ?
There was a problem hiding this comment.
im gonna keep workflow separated, especially now that other python tests are coming inside
and also ctst instead of cucumber
| "test:bucket_get_v2": "mocha --config mocha/.mocharc.js -t 10000 --recursive mocha/cloudserver/bucketGetV2/tests", | ||
| "test:bucket_policy": "mocha --config mocha/.mocharc.js -t 10000 --recursive mocha/cloudserver/bucketPolicy/tests", | ||
| "test:all_extensions": "run-p --aggregate-output test:crr test:aws_crr test:expiration test:transition test:ingestion_oob_s3c", | ||
| "postinstall": "node node_modules/@kie/act-js/scripts/postinstall.js 0.2.75" |
There was a problem hiding this comment.
As long as @kie/act-js lives in the root tests/package.json, every job using the new setup-node-env composite action pays the download cost — including lint-tests which has no use for it. And postinstall is silent so nobody will notice it growing.
I think that you can move workflows back into its own package (as you said), keep tests/package.json for cucumber + mocha only.
There was a problem hiding this comment.
I'm re writting the pr, removed tests/workflow from this new package because yeah these tests are a bit appart from the functional tests, so we won't have this problem
| description: GitHub App private key | ||
| required: true | ||
| repositories: | ||
| description: Newline-separated list of private repositories to grant access to |
There was a problem hiding this comment.
before the refactor, each job explicitly requested only the repos it consumes:
lint-ctst → cli-testing
end2end-2-shards-http → zenko-operator
end2end-sharded → metadata, zenko-operator
now, unless explicitly overridden (and no caller overrides), every job receives a token with access to all 3 repos. And check-workflows ends up with that token while it previously needed no private repo at all. I don't know if that is okay but rather point it as it's hidden inside this composite action.
I think we should remove the default, force each caller to pass the exact list (like the original code). If you want, keep a minimal default of cli-testing and we can document the convention clearly.
There was a problem hiding this comment.
Yeah I noticed this stuff, not sure it's super important, but yeah I removed the default value and re-add explicit repo list
| 'pass-on-failing-test-suite': process.env.CI_PASS_ON_TEST_FAILURE === 'true', | ||
| 'exit': true, |
There was a problem hiding this comment.
pass-on-failing-test-suite makes the process exit 0 even when tests fail.
Meaning green CI ≠ tests pass; the real verdict depends on the downstream JUnit aggregator. This is fragile: if the JUnit reporting step does not run (e.g. infra failure), the job appears green while everything broke. I know this is not new (already in the mocha package.json before), but moving it into .mocharc.js makes it the default, almost invisible to new contributors. At a minimum we need a comment explaining why.
'exit': true: Mocha explicitly does not recommend it (hides leaking handles → real bugs). Since we are touching this setup anyway, let's create a "drop --exit + fix the leaking handles" ticket and link it in the comment.
There was a problem hiding this comment.
I mean as you said the pass on failing test suite was already there before, with a comment above explaining why its done, i dont really like that its a bit implicit and can be missed but not much to do here
The exit thing and the rest were also already there before but they were in the package json commands directly.
Now we have this
"test:operator": "mocha --config mocha/.mocharc.js -t 10000 mocha/init_test.js",
Before we had
"test_operator": "mocha --exit -t 10000 --reporter mocha-multi-reporters --reporter-options configFile=config.json,cmrOutput=mocha-junit-reporter+testsuitesTitle+test_operator ./init_test.js",
I don't think we should bother too much with these tests, but I can remove the args in the package.json if you think it's more visible
| @@ -0,0 +1,91 @@ | |||
| { | |||
There was a problem hiding this comment.
=> mocha, mocha-junit-reporter, mocha-multi-reporters are in dependencies → these are test-only, should be devDependencies.
=> @aws-sdk/client-s3, @aws-sdk/client-iam, @aws-sdk/client-sts in devDependencies → but used at runtime by the cucumber/mocha tests. It is private: true so practically no consequence, but semantically inconsistent.
request: ^2.87.0 → deprecated since 2020.
uuid: ^3.0.1 → uuid 3 is EOL (uuid is at v11).
async: 2.1.2 → is pinned to a very old patch (v4 is current)- I don't know if this will break something-
=> werelogs: github:scality/werelogs → no tag/ref pinned. Any push on werelogs main can break the tests overnight. Pin a tag (cf. how arsenal is pinned).
There was a problem hiding this comment.
| "test:all_extensions": "run-p --aggregate-output test:crr test:aws_crr test:expiration test:transition test:ingestion_oob_s3c", | ||
| "postinstall": "node node_modules/@kie/act-js/scripts/postinstall.js 0.2.75" | ||
| }, | ||
| "resolutions": { |
There was a problem hiding this comment.
Why do we need this? Usually a resolutions entry signals an upstream bad pin or a version conflict. Can we document the reason in a comment, or we fix the issue it at the source if possible?
There was a problem hiding this comment.
Yes exactly there is an issue with azure client, some weird stuff with azurite moch being unbumpable because microsoft keeps on doing layoffs so their engineers are unable to update Azurite in time (Azure/Azurite#2623), making it incompatible with their latest sdk versions
Anyways, I think I have created a ticket, or at least we have this in mind, even Francois had a similar issue with Sorbet around this
| "resolveJsonModule": true, | ||
| "baseUrl": "./", | ||
| "paths": { | ||
| "cli-testing": ["./node_modules/cli-testing"], |
There was a problem hiding this comment.
with this root tsconfig + allowJs: false + strict: true + cucumber-only paths, I am not sure how the .ts files under workflows/ get type-checked
tsc --build is in build:cucumber but without include/references it will pick up every .ts file under baseUrl, including workflows/**/*.ts
can we confirm yarn build:cucumber and yarn test:workflows pass ?
There was a problem hiding this comment.
I guess no need to answer this question since I removed workflow from this folder 🌚
Which kinda raises the question about linting/building the workflow folder, but this is not the concern of this pr anymore
| extends: [ | ||
| ...compat.extends('scality'), | ||
| ], | ||
| rules: { |
There was a problem hiding this comment.
I know it is "what we had before", but by merging the configs we formally inherit all this debt in a single place. Either:
- we accept this debt consciously and open a ticket to reduce it
or we use this opportunity to drop the ones that are not really relevant anymore - and for workflows: '@typescript-eslint/no-explicit-any': 'off' — since we are consolidating, can we at least plan to remove it? otherwise we lose one of the benefits of unifying...
There was a problem hiding this comment.
I think for the second point no need to look at it anymore for now.
For the first point, so if I understand correctly, the best thing we want to do now is to inherit everything from scality without adding any other rules ?
There was a problem hiding this comment.
Yes, inheriting from scality's base config without additional overrides is the ideal state. The current overrides exist because they were carried over from the previous separate configs during the merge.
For this PR, keeping the existing overrides is appropriate since the focus is on organizational refactoring. A follow-up ticket to reduce these eslint rule exceptions would be valuable - each override should be evaluated to see if it can be removed or if the code should be fixed to meet the base standard.
419f2de to
b22c08f
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
|
@claude[agent] hello ? |
|
@claude[agent] review this stuff, be VERY MEAN with me |
f9b3c06 to
87dbcdc
Compare
87dbcdc to
4aeb26c
Compare
Issue: ZENKO-5251
4aeb26c to
f76a226
Compare
| "scubaclient": "git+https://github.com/scality/scubaclient.git#1.1.4", | ||
| "uuid": "^14.0.0", | ||
| "vaultclient": "scality/vaultclient#8.5.6", | ||
| "werelogs": "github:scality/werelogs" |
There was a problem hiding this comment.
werelogs has no pinned tag — any push to its main branch can break CI overnight. This was flagged in the earlier review and you mentioned fixing it in f9b3c06 (pinning to 8.2.3), but the fix appears lost after the force push.
| "werelogs": "github:scality/werelogs" | |
| "werelogs": "github:scality/werelogs#8.2.3" |
There was a problem hiding this comment.
aint touching this now, i noticed many repo do the same thing
| "@google-cloud/storage": "^7.12.1", | ||
| "arsenal": "scality/Arsenal#8.1.38", | ||
| "assert": "^2.1.0", | ||
| "async": "2.1.2", |
There was a problem hiding this comment.
async is pinned to 2.1.2 (2016-era). You mentioned updating to ^3.2.6 in f9b3c06 but this also appears reverted after the force push.
| "async": "2.1.2", | |
| "async": "^3.2.6", |
There was a problem hiding this comment.
breaking changes are likely, not touching for now
Issue: ZENKO-5251
This pr is a bit savage, but it's mostly renames and changes in folder structure. Actually really not that long to review.
I recommend just pulling the branch and having a look at the /tests directory
I like this structure, I think it will be easier to maintain packages, we now have a single node 24 version to deal with accross all tests.
With this we move toward have a unique setup for all tests, this will also enable us to have utility functions that can be used across all tests which is what I need for another pr
This is one of the last pr I wanted to do before we can try to have a look (if we want to invest the time 👀 ) at re organizing the setup and installation of Zenko (all the .sh and .py files that are a bit all over the place)
EDIT FRIDAY 24TH APRIL :
Thanks for the review everyone, I apologize I re did some big force push so the comments might be all over the place
TLDR :
Why this pr ?
I think previous comment and diffs speak for themselves but :