integration tests and mocking #12
Labels
No labels
Compat/Breaking
Driver
Forgejo
Driver
GitHub
Driver
Gitea
Driver
Heptapod & GitLab
Driver
SourceHut
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
release
v2
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Reference: f3/gof3#12
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
maintaining tests for a growing matrix of forges and versions requires some kind of optimization otherwise it becomes prohibitively expensive over time.
The general idea is similar to what is implemented in Forgejo for GitLab:
The Forgejo code could be used in gof3 as well, unless there is a package that does the same in a better way?
Good fit
Not a good fit
Does not allow for capturing & storing requests, mocks have to be programmatically defined
Hoverfly is mature and well maintained. It runs as an independent server alongside tests.
it works nicely but there is an issue with random name generation (token, users etc.) because it changes the URLs and fails to match the recorded HTTP requests. Changing that to non random numbers the recorded HTTP requests are found as if the server was present and the test completes successfully.
with a few adjustments (PR incoming) it works. However, running the full test suite in a single stateful capture is brittle and needlessly so. Instead each test that relies on a service running should start by initializing and new stateful capture or loading one and save the result on completion for later use.
I think it would be best to have a per-test control of the capture / simulation. Something like:
defer hoverfly.Run("MyCaptureName")()which would:
$(pwd)/hoverfly/MyCaptureName.jsonand set thehttp_proxyenvironment variable$(pwd)/hoverfly/MyCaptureName.jsonand set thehttp_proxyenvironment variableThis is working fine and it is simple 👍 The problem now is that selectively doing that for the compliance suite is currently not possible because it goes like this:
For instance if compliance tests for milestones are to be captured while anything involving git HTTP requests is to be excluded, one would have to change the code in two places. It does not looks like this two stages test method is a requirement. It should be possible to only create the minimal set of resources to run a given test instead of having it depend on a large fixture containing resources that won't play any role in the test itself.
Making each test independent in this way means that the sum of their execution is going to be more costly because each of the will want to create fixtures in their own way instead of sharing them with other tests. But that also has two benefits:
See https://code.forgejo.org/f3/gof3/pulls/16/files