Skip to content

Should KubernetesMockServer.reset() also reset DefaultMockServer.lastRequest* #6750

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

Closed
gsmet opened this issue Dec 23, 2024 · 3 comments
Closed
Assignees
Labels
bug component/kubernetes-server-mock Deals with the kubernetes-server-mock directory mainly
Milestone

Comments

@gsmet
Copy link

gsmet commented Dec 23, 2024

Is your enhancement related to a problem? Please describe

In

public void reset() {
clearExpectations();
onStart();
unsupportedPatterns.clear();
if (this.dispatcher instanceof Resetable) {
((Resetable) this.dispatcher).reset();
}
}
, we don't reset the fields that are in DefaultMockServer and especially these three:
private final Map<ServerRequest, Queue<ServerResponse>> responses;
private final AtomicInteger lastRequestCount;
private final AtomicReference<RecordedRequest> lastRequest;
(but there might be others that make sense) .

It can be problematic when you actually try to check that no request have been sent with getLastRequest() after a reset() and some operations and you end up with the request sent pre-reset().

Describe the solution you'd like

Ideally, I would like DefaultMockServer to be reset when KubernetesMockServer is reset.

Describe alternatives you've considered

No response

Additional context

It looks like it comes out of the blue but I noticed it while doing some enhancements on sbomer and it got in the way.

@manusa
Copy link
Member

manusa commented Dec 24, 2024

Good catch, this does seem like a bug.

@manusa manusa added bug component/kubernetes-server-mock Deals with the kubernetes-server-mock directory mainly labels Dec 24, 2024
Copy link

stale bot commented Mar 25, 2025

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

@stale stale bot added the status/stale label Mar 25, 2025
@manusa manusa moved this to Planned in Eclipse JKube Mar 25, 2025
@manusa manusa moved this from Planned to In Progress in Eclipse JKube Apr 8, 2025
@manusa manusa moved this from In Progress to Review in Eclipse JKube Apr 8, 2025
@manusa manusa self-assigned this Apr 8, 2025
@manusa manusa added this to the 7.2.0 milestone Apr 15, 2025
@manusa
Copy link
Member

manusa commented Apr 15, 2025

Fixed in #6994

@manusa manusa closed this as completed Apr 15, 2025
@github-project-automation github-project-automation bot moved this from Review to Done in Eclipse JKube Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component/kubernetes-server-mock Deals with the kubernetes-server-mock directory mainly
Projects
None yet
Development

No branches or pull requests

2 participants