-
Notifications
You must be signed in to change notification settings - Fork 172
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
Allow resuming and suspending tests by changing a live TestRun
resource
#457
Comments
I am willing to work on this fix, this feature is important to us as we'd like our developers to be able to declare their tests beforehand via GitOps and only start them when appropriate (which we'll achieve using ArgoCD's Custom Resource Actions, adding a |
Hi @LCaparelli, thanks for the issue! I think there is a misunderstanding about expected behaviour. In standalone k6, If someone wants to change that logic, they can set So it seems to me like there's a lack of clarify about expected behaviour here 🤔 Obviously, Could you please describe in greater details your use case? I.e. what you were trying to achieve exactly and why changing |
Just for completeness sake. If one sets |
Hey @yorugac thanks for taking some time to go over this, I appreciate it! You're correct that I initially misunderstood the default, I realized that while implementing #458. I think this misunderstanding doesn't change my report though: regardless of what I set to |
In an attempt to further clarify: we do start the runner with the |
Hi @LCaparelli,
Yes, right now starter always runs and unpauses the test, if there is anything to unpause in the first place. For simplicity's sake, let's disregard starter pod for now and focus only on the expected behaviour of the test run. In case of But I have an impression that your use case might need something totally different. For example, you mentioned ArgoCD before: that implies some kind of manual control over test execution from the outside app. I.e. do you need to delay the execution of the test until some external action? If so, how should that look like from your perspective? Via modification of |
That's exactly it! I think my misunderstanding of this field is deeper than I thought. My understanding is that if In light of that, what I thought was a bugfix might actually be a feat request.
Precisely, we would like to optionally start the test as paused, in which case
That's much more generic than we need for our use-case right now, but thanks for pointing it out! There seems to be a few can of worms there, as to "How to deal with a change in this field consistently? Should we even allow modifying this field? If so, when should we allow it to be modified?". One of these problems also appear here: what happens if the user changes At the risk of giving unwelcome advice, I think it might be a good idea to map what fields might support updating based on use-cases as they appear, such as this one. Trying to tackle update support for the entire API all at once sounds very complex, and concrete use-cases add much needed clarification to the decision-making. Back to the matter at hand though, do you think this feat request would be a welcome one? Should I further illustrate our use-case to justify it? I'm also open to a quick, sync call or even just chatting on Slack to iron out the noise. Thanks again for your time! |
Anecdotally, I was not the only one to assume |
@LCaparelli, indeed, this is a feature request 😄
I think it is a valid feature request, at this point of time. As you noted, this is not the first time we receive a similar request recently. OTOH, a move to allow edits of CRD is a big one for this project, and I don't think it'll be possible to add this in the near future. I.e. other issues have higher priority, IMHO. Could you please adjust the description of the issue to reflect the core problem (starting test run by edit of CRD) better? Then we can just refer to this issue with our discussion as a "feature request" instead of writing a new one. On implementation. Someone might be relying on current behaviour of Another potential point of contention is adding mutability requirement in general. Can there be GitOps setups that would need some other type of control over |
Hey @yorugac, sorry for the long pause in discussion, PTO.
Agreed, and it nicely fits into the Which brings me to a new suggestion of implementation: just propagate Because we're delegating to Any thoughts on this approach?
This point isn't very clear to me. I couldn't think of an example setup where we can declarative configure whether a I think I have enough to start changing my PR, but this final point needs some elaboration for me to grok it, thanks! |
spec.paused
produces --paused
flag on runner, but initializer always unpause it regardlessTestRun
resource
Hi @LCaparelli, NP, it'd be great if you're able to work on this!
The Job's Regarding accidental costly tests: it's possible to terminate them with the deletion of TestRun CR.
I was basically thinking about setups where mutation of a resource is forbidden 😄 Then it is possible that the solution is not in |
Funny how things happen. Folks at our org just requested this feature. They would like both:
I'll open a separate issue for that, but there are still folks who would rather rely on a more interactive approach, so it sounds like the |
Hi @LCaparelli, apologies for the delay; I missed the last message in my notifications 😞
I agree with you: the feature request for delays should be a separate issue (btw, a "pure" CronJob-like scheduling should be possible with a CronJob, it's described here). This issue is then about adding |
Yes, I would! Chaotic few weeks, I'll adjust it soon. Thanks for checking in @yorugac |
This feature request was initially described as a bugfix due to a misunderstanding of the
spec.paused
field.Initial report
Brief summary
While the operator correctly propagates the configuration as part of the flags for the
runner
:k6-operator/pkg/resources/jobs/runner.go
Lines 61 to 68 in 0f3957c
It makes no checks prior to creating the starter:
k6-operator/controllers/testrun_controller.go
Lines 193 to 197 in 0f3957c
Neither functions above make any checks regarding
spec.paused
AFAICT.Since the starter job always unpauses the the runner:
k6-operator/pkg/resources/containers/curl_start.go
Lines 15 to 30 in 0f3957c
We end up with
spec.paused
being ignored (technically, partially ignored because the--paused
flag does get added to the runner arguments, but in practice it always unpauses due to how the starter behaves).Suggested implementation
We might solve this by just adding an
if
statement when the status is"created"
, guarding theStartJobs
function:Of course, this implies that changing
spec.paused
after the test has started continues to have no effect, but that seems sensible to me.k6-operator version or image
0.0.16
Helm chart version (if applicable)
No response
TestRun / PrivateLoadZone YAML
Anything with spec.paused set to
'true'
.Other environment details (if applicable)
No response
Steps to reproduce the problem
TestRun
withspec.paused
set to'true'
Expected behaviour
Runner does not start the test before I set
spec.paused
to'false'
ornull
.Actual behaviour
Starter behaves exactly as if
spec.paused
was set to'false'
ornull
, and immediately starts the runner.Feature Description
It would be nice if we could edit a live
TestRun
resource to suspend or resume it, similarly to what Kubernetes does withJobs
.Suggested Solution (optional)
Add a
spec.suspend
field that controls whether to run the starter job or not.Already existing or connected issues / PRs (optional)
No response
The text was updated successfully, but these errors were encountered: