Skip to content

Run ctst locally#2319

Open
SylvainSenechal wants to merge 4 commits intodevelopment/2.14from
improvement/ZENKO-5180
Open

Run ctst locally#2319
SylvainSenechal wants to merge 4 commits intodevelopment/2.14from
improvement/ZENKO-5180

Conversation

@SylvainSenechal
Copy link
Contributor

ISSUE: ZENKO-5180

Run ctst inside Codespace :

  • Update ./run.sh file
  • Use cli-testing as a library
    Some other refactoring

@bert-e
Copy link
Contributor

bert-e commented Feb 11, 2026

Hello sylvainsenechal,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval
/bypass_build_status Bypass the build and test status
/bypass_commit_size Bypass the check on the size of the changeset TBA
/bypass_incompatible_branch Bypass the check on the source branch prefix
/bypass_jira_check Bypass the Jira issue check
/bypass_peer_approval Bypass the pull request peers' approval
/bypass_leader_approval Bypass the pull request leaders' approval
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request TBA
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@SylvainSenechal
Copy link
Contributor Author

I will clean my commits after reviews

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to minimize the utilisation of global env variable that are used only once, or sometimes even useless, there is more work to do on this topic but this will be for other pr

--env=AZURE_BLOB_URL=$AZURE_BACKEND_ENDPOINT \
--env=AZURE_QUEUE_URL=$AZURE_BACKEND_QUEUE_ENDPOINT \
--env=VERBOSE=1 \
--env=SDK=true \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cli testing can be run in sdk mode, or CLI mode.

This shouldn't have impact, because actually this env used to be set in the Dockerfile of the E2E_IMAGE.
I put it here instead, because imo putting it in the Dockerfile was kinda hidding this parameter, and we are already defining all the other envs variable here

]
}
}' -- ./run "$COMMAND" $WORLD_PARAMETERS --parallel $PARALLEL_RUNS --retry $RETRIES --retry-tag-filter @Flaky --format junit:$JUNIT_REPORT_PATH "$@"
}' -- yarn cucumber-js \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo much better, before it was hard to see, but a lot of things were happening behind the ./run commands, which wasn't even defined in Zenko, but in Cli-testing.

Here, we are now just naturally using cucumber syntax to run cucumber tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what I was talking about when I said I struggled to deal with cli-testing auth. It only worked when I added the ~/.netrc thing, which kinda looks smelly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which command failed in which context (codespace, ci, inside docker image...) ?

  • we need to use the GIT_ACCESS_TOKEN to have access to other repos (instead of GitHub usual reds, which are restricted the current repo + public repos)
  • the git config above is already a trick to inject the GIT_ACCESS_TOKEN in git urls (so we don't need to modify the url in every place it is used: package.json, ...)
  • netrc is an alternative to configure git auth, which should not be needed if the git config are made (but maybe we miss some, etc...)

@@ -667,7 +663,7 @@
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also nicer, bye bye """"""""""""", and now we can clearly see which tags are triggered (yeah cucumber allows to use multiple tags with and/or syntax)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the equivalent of what we had in Cli-testing too : https://github.com/scality/cli-testing/blob/development/1.3/Dockerfile

I kept it mostly the same, but defined it here, so that cli-testing is used as a library, and not something where we store dockerfiles, commands, configs for Zenko.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many packages here can be updated to a higher version, but let's keep it for another pr

# certain tests based on their @version tag.
VERSION=$(cat ../../VERSION | grep -Po 'VERSION="\K[^"]*')
POD_NAME="ctst-end2end"
WORLD_PARAMETERS="$(jq -c <<EOF
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where we still have frictions : The current setup is basically enough to run tests locally, but these tests needs a lot of env variables that are passed as "world parameter". Here, I used a few that I defined manually to make one test work.

Later gonna work on using kube client to get secrets directly at the beginning of the tests, this will give us 2 things :

  • Reduce setup needed to run test locally
  • Reduce and refactor the number of things happening in .sh setup files. Final objective is also to have variables defined only once at the same place

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems now we are running as a regular node program: so it should work as well without docker/pod?
→ maybe some tests (and world) need to be adapted, but we should try to investigate what changes it would require (which commands to tweak, ...). Esp. we already need special tricks to run kubectl commands, so it may actually simplify stuff...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we may get there eventually, this should be doable, but probably lots of variables related to endpoint needs to change with port forward

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed this is not for this PR

port forward

in most case we use (or should use) the ingress : so no port forward...
we may however need to tweak etc/host or some other trick for DNS resolution, though

@scality scality deleted a comment from bert-e Feb 11, 2026
@SylvainSenechal SylvainSenechal marked this pull request as ready for review February 11, 2026 18:04
@SylvainSenechal SylvainSenechal force-pushed the improvement/ZENKO-5180 branch 3 times, most recently from 56485d6 to a71ddc4 Compare February 11, 2026 21:24
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which command failed in which context (codespace, ci, inside docker image...) ?

  • we need to use the GIT_ACCESS_TOKEN to have access to other repos (instead of GitHub usual reds, which are restricted the current repo + public repos)
  • the git config above is already a trick to inject the GIT_ACCESS_TOKEN in git urls (so we don't need to modify the url in every place it is used: package.json, ...)
  • netrc is an alternative to configure git auth, which should not be needed if the git config are made (but maybe we miss some, etc...)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

latest does not work since we have multiple branches : so should always be rebuilt (maybe use an image tag which is unique to the branch, but not sure how to build images & tag them so it is practical...)

# certain tests based on their @version tag.
VERSION=$(cat ../../VERSION | grep -Po 'VERSION="\K[^"]*')
POD_NAME="ctst-end2end"
WORLD_PARAMETERS="$(jq -c <<EOF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems now we are running as a regular node program: so it should work as well without docker/pod?
→ maybe some tests (and world) need to be adapted, but we should try to investigate what changes it would require (which commands to tweak, ...). Esp. we already need special tricks to run kubectl commands, so it may actually simplify stuff...

Copy link
Contributor

@francoisferrand francoisferrand Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of passing specifically "tags", we could just forward"all" arguments to yarn, with "$@" : so the script is a "transparent" wrapper, and more flexible (if we need to pass extra cucumber params, for exemple to run a single test or multiple tags...)

may be a bit more tricky with the optional image though, may need to add more (bash) argument parsing, either to support running like this ./run-ctst-locally.sh [image] [-- <extra params>] or to use a flag ./run-ctst-locally.sh [-i <image>] <extra params>...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried something but it got a little bit dirty with the parsing of the image indeed.
I did make a change so that we can now use natural Cucumber tags expression though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just run.sh?
(since it may be used not just locally -we could/should use it in CI, to avoid having multiple code-path- and already in ctst folder)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I strongly agree to avoid several .sh script. Also to make sure everything will continue to work, I think we should find a way to test that in the CI ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of run.sh, it's too short and grepping "run" returns thousands of results. Actually this is the reason i originally got confused, because in run-e2e-ctst, the pods was executing run, and it took me some time to realize it was the cli-testing run, and not this file. I'm not fixed on this specific name, but I think it's nice to have a more identifiable name, the current name, or "run-cucumber-tests.sh" for example leaves no room for ambiguity.

Also, more importantly, there is indeed an objective which would be that local tests and github ci tests are run using the same same file, but at the moment there isn't done, as there are still some difference between the 2 files. I think eventually we will do it, and when it happens we can think again about the naming

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My goal was mainly to avoid duplicate logic. I'm fine to iterate later, we should track that in a JIRA and in the epic and add some comments and the beginning of each 🙏

@SylvainSenechal SylvainSenechal force-pushed the improvement/ZENKO-5180 branch 2 times, most recently from 497a7db to faea5c8 Compare February 12, 2026 14:26

# 2. Load into kind and reset the pod
kind load docker-image ctst-local:dev
kubectl delete pod ctst-end2end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would it be created already?
is it created automatically on devcontainer startup?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the comment. Basically, only needed if the pod was already created before with a different image

ARG DRCTL_TAG=latest

FROM ghcr.io/scality/sorbet:$SORBET_TAG AS sorbet
FROM ghcr.io/scality/zenko-drctl:$DRCTL_TAG AS drctl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for later (more when we want to run CTST tests outside of k8s) : maybe we do not actually need these binaries, we could run them directly in pods...

(typically, esp. for Sorbet, this is often how it is done: kubectl exec into sorbetctl container...)

format: [
'progress-bar',
'@cucumber/pretty-formatter',
'json:reports/cucumber-report.json',
Copy link
Contributor

@francoisferrand francoisferrand Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this generate a JUnit report? (needed for the overall Zenko workflow, to report failed tests summary)

it is the "stock" reporter, or the one implemented in cli-testing ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay I reviewed this last comment : my code changes do not modify the existing logic, in run-e2e-ctst, cucumber is ran with the same previous parameter (-- format junitxxxx) to generate the report.

What I checked though, is if this report was exported to the artifact, and I found it was not.
So I updated one of the action file to export the report to the artifact, and also found that the xml report is not really human readable, so I also exported an html version (while keeping the first format). Also bumped the action action-junit-report from v4 to v6

Copy link
Contributor

@francoisferrand francoisferrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except maybe for the https://github.com/scality/Zenko/pull/2319/changes#r2813543342 question : need to make sure we don't "break" failed tests reporting via JUnit test report

COPY package.json ./
COPY yarn.lock ./

RUN --mount=type=secret,id=GIT_AUTH_TOKEN \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this will work in CI and codespace, but fail when running locally if SSH is used to auth with GitHub.
So (eventually, if we still use this image) we will need to further improve this to support both GIT_AUTH_TOKEN and SSH... e.g. something like adding the 2 mounts (if possible...), and replacing the URL depending on what we get...

@SylvainSenechal SylvainSenechal force-pushed the improvement/ZENKO-5180 branch 11 times, most recently from 2271c1f to 25586b6 Compare February 16, 2026 20:36
@scality scality deleted a comment from bert-e Feb 17, 2026
@scality scality deleted a comment from bert-e Feb 17, 2026
@bert-e
Copy link
Contributor

bert-e commented Feb 17, 2026

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

Copy link
Contributor

@DarkIsDude DarkIsDude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me we are good. Some small comments. If you have a re-review, just retrigger the flow. Thanks for your work !


```bash
# 1. Build the CTST image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

```bash
cd tests/ctst
./run-ctst-locally.sh @getObject
./run-ctst-locally.sh "@PreMerge and not @Flaky" # Use quotes for complex expressions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
./run-ctst-locally.sh "@PreMerge and not @Flaky" # Use quotes for complex expressions
./run-ctst-locally.sh "@PreMerge and not @Flaky"

You have the same letter. I think it's pretty a standard for bash command and it's not needed to explain it ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My goal was mainly to avoid duplicate logic. I'm fine to iterate later, we should track that in a JIRA and in the epic and add some comments and the beginning of each 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments