-
-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create new commands that would build the docker images and run the e2e tests separately #9630
Comments
@dianabarsan, I would love to hear your thoughts about this idea. Do you think that the approach that I am describing is feasible? Is there something else that I should consider? cc: @jkuester |
I think I already had a branch that did this. I'll share. |
Ok, it's not a branch, because you don't need new commands. All you need to do is:
|
@dianabarsan is there a compelling reason that we need to timestamp the image version? The main benefit I can think of is that it helps ensure we don't locally run the e2e tests against a stale version of the docker image. Is there something else I am missing? The downsides of timestamping the image version include:
IMHO, re-running the e2e tests without rebuilding the images should be a workflow with top-level support. As a developer I am frequently re-running tests while writing them. It would be easier to script this if the image VERSION was deterministic (and not time-stamped). However, even if we keep the time-stamping, I still think it would be valuable to have an npm script that would programatically set the |
Sure, I agree. If we neither timestamp the images NOR rebuild the images every time we run tests, then the risk of running tests over unknown images is really high. How do you even know what's in the image? Do you start the container and inspect it to see what changes are in it? Especially if you run multiple git worktrees and run tests in parallel. This is one argument for timestamping, that if one uses different worktrees (like me), then you will have different images for them - which you can reuse with the VERSION env. Now, the worktrees don't necessarily need a timestamp (though this is most correct), we could use a hash of the local folder path instead to uniquely identify the reusable worktree images. It's a shame there is no "only build if changed" docker command :(
What can be done is:
This way you don't need to fish around get timestamps from generated docker compose files. |
What if .... instead of timestamps we actually used the local checked out branch name? That way the version is deterministic, we can include it in npm scripts and it will also work with different worktrees or when working on multiple branches in parallel?
And these can be our npm commands for local runs. |
Agreed. My vote would be that the behavior of Ultimately it is up to the developer to be aware of the current state of their repo/images, but this seems to offer a good balance of a safe default happy path where everything gets built while allowing for a shortcut when someone knows what they are doing....
This is my thought exactly! Specifically, my proposal is that we update the "ci-webdriver-default": "export VERSION=${VERSION:-$(node ./scripts/build/get-version.js)} wdio run ./tests/e2e/default/wdio.conf.js", This way, when the @tatilepizs what are your thoughts here? |
Thank you both for this discussion, I like the idea of using the branch name for the images, that would help a lot.
Here is the video of the steps: Screen.Recording.2024-11-13.at.11.03.09.am.mov@dianabarsan is there something I am missing? |
It looks like your docker is trying to pull the images and fails? |
This is all I can see:
|
Oh, I think I saw what the problem was, in the video. Your exported variable is "VERISON" not "VERSION" :) |
Oh no 🤦 I am sorry about this. |
Did it work without the typo? |
Yes, it didn't download the images, thank you 😊 I was thinking if there is a way to leave the containers up and running the first time, so the next time, it just uses the containers that are already up and doesn't need to create the containers again, that would be awesome because the tests will be running in just a couple of seconds |
@tatilepizs I used to leave containers running for further testing, but @jkuester pushed a commit that killed them :) |
😅 If I cancel the process, I will have the containers up, but when I run the command
|
😅 💀
This is where I would draw the line and say it is not a good idea to add first-class support for this workflow! 😅 IMHO, you need to drop all the containers and reset things between test runs to better guarantee the reproducibility of test results. The docker images are static and cannot be affected by things that happen during a test run. But the containers are not! It might be possible (or likely?) that the state of the CHT instance in the containers is slightly different after a test run. Then subsequent test runs would not be running with the exact same environment as a fresh run. |
🤔 hmm, you are right Josh, I didn't think about that |
@tatilepizs are you happy with the :
solution? |
Yes, I think it will be a great improvement to the way that we execute the tests |
Describe the issue
When we are creating new e2e tests or debugging the existing ones (and not modifying the
cht-core
code), it is really frustrating that every time we run the e2e tests we need to download and build completely the docker images. It takes around 2 minutes for a test to start running, which is a lot of time when we are debugging, for example, and just need to try small things in each iteration.Describe the improvement you'd like
We would like to create two new commands, one that builds the docker images and one that only executes the wdio e2e tests.
The first command, the one that build the images, would be in charge of deleting always the images associated at the branch (if they exist) and then creating them. if we remove the
${buildTime}
from this line we can use the same images every time that we run the tests using the same branch, and by deleting the images at the beginning we would make sure that we are using the correct images, in case something changes in the cht-core code.The second command would be in charge of only executing the e2e tests, and since everything will be already built, it should just take seconds to start seeing the execution of the test.
We will also leave the command
wdio-local
that would build and execute, just as it is right now.Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: