Skip to content

test: remote requests are now replayed #1941

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

quintesse
Copy link
Contributor

This way we don't rely on external services being up or being rate limtied.

@quintesse quintesse requested a review from maxandersen March 6, 2025 16:45
@quintesse quintesse marked this pull request as draft March 7, 2025 10:21
@quintesse
Copy link
Contributor Author

Converted to draft because there are still some things not quite right.

@quintesse quintesse changed the title test: stub Gist (and other) tests test: remote requests are now replayed Mar 7, 2025
@quintesse quintesse force-pushed the test_http_stubs branch 2 times, most recently from bf7d43e to fb21e82 Compare March 7, 2025 23:02
@quintesse
Copy link
Contributor Author

It works, but now the build fails with an OOM exception during the unit tests :-/
I'd need to figure out if we can give the test runner some more memory in the GH action.

@maxandersen
Copy link
Collaborator

why does it need more memory??

@quintesse
Copy link
Contributor Author

I'm guessing because it keeps the requests in memory? Not sure. It doesn't seem that much traffic.

@maxandersen
Copy link
Collaborator

fyi: i fixed the blusky issue - for some reason it kept giving my user invalid handle causing blusky url not to work.

still this pr has merits to explore - just wondered if the trigger was the random blusky errors :)

@quintesse
Copy link
Contributor Author

still this pr has merits to explore - just wondered if the trigger was the random blusky errors :)

The current trigger was indeed this blusky issue :-)
But it had been bothering me for the longest time that the CI randomly fails because of connection errors, server problems, rate limits, etc

@quintesse
Copy link
Contributor Author

I'm not really happy with how WireMock handles record/replay of requests, I'm going to try to see if switching to Hoverfly is a better option.

@quintesse quintesse force-pushed the test_http_stubs branch 2 times, most recently from fca7851 to 762f5ca Compare March 26, 2025 00:52
@quintesse
Copy link
Contributor Author

In the end Hoverfly came with its own set of problems so went back to making WireMock work and it seems I was successful.

@quintesse quintesse marked this pull request as ready for review March 26, 2025 21:34
@quintesse
Copy link
Contributor Author

@maxandersen we should really take a look at merging this, see how often the CI actions fail for example here: #1991 @wfouche had to ask me several times to restart the build.

maxandersen
maxandersen previously approved these changes Apr 19, 2025
Copy link
Collaborator

@maxandersen maxandersen left a comment

Choose a reason for hiding this comment

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

sorry, missed the update. marking as approved and merge when test passes

@maxandersen
Copy link
Collaborator

@quintesse any idea of why this is failing with timeout in tests?

@quintesse
Copy link
Contributor Author

@quintesse any idea of why this is failing with timeout in tests?

It's not timeouts , it's OOM again.

It didn't happen the last couple of times so I didn't make any changes in that respect, but I do have some ideas on how to fix it.

(Basically all requests and their results are kept in memory by WireMock once you initialize it. And because I initialize it at the start of the first test until the last test finishes we might be storing a lot of data in memory. I think I can fix this by simply limiting its "scope", for example to init for each test class, perhaps even for each test. I'll have to see if that slows things down or not)

@quintesse quintesse marked this pull request as draft April 19, 2025 21:44
@quintesse
Copy link
Contributor Author

Marking as Draft for now until I have some time to look at it.

@quintesse quintesse force-pushed the test_http_stubs branch 2 times, most recently from f46363f to 215df63 Compare April 21, 2025 12:17
@quintesse
Copy link
Contributor Author

quintesse commented Apr 22, 2025

Ok, so I again took a look at what was happening and it's basically because some tests cause relatively big downloads. The new Kotlin Export test causes a 80MB download! Which WireMock chokes on. Now while investigating what I could do about that I realized that I'm probably trying to do too much with WireMock, like trying to shove a block into a round hole. Given the fact that I;m only using it as a proxy that writes its requests to disk to be replayed at a later time, I'm seriously considering just writing that myself. It seems easy (famous last words).

Edit: btw, I'm going to fix those exports, they shouldn't be downloading anything.
Edit2: darnit, I remember why they build: it's to get the name of the main class. And for somebody doing the export I guess the download is not a problem, they are working with Groovy/Kotlin anyway. But for the tests it's a bit much. So I guess I'll disable them for now.

@quintesse quintesse force-pushed the test_http_stubs branch 2 times, most recently from 81b14d4 to ab2c985 Compare April 24, 2025 16:33
quintesse added 2 commits May 29, 2025 12:02
Instead of hitting remote servers and possibly getting failed
tests becauase servers are down or becuase wer're getting rate
limited, we now record the responses and replay them.
PS: This is not done for Maven artifacts/MIMA.
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.

2 participants