8000 [pull] main from miniflux:main by pull[bot] · Pull Request #348 · suhaoGe/miniflux · GitHub
[go: up one dir, main page]

Skip to content

[pull] main from miniflux:main - #348

Merged
pull[bot] merged 5 commits into
suhaoGe:mainfrom
miniflux:main
Jul 17, 2026
Merged

pull[bot] merged 5 commits into
suhaoGe:mainfrom
miniflux:main

Conversation

@pull
@pull pull Bot commented Jul 17, 2026 •
Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

jvoisin and others added 5 commits July 16, 2026 19:21
Every integration tests in api_integration_test.go run sequentially against a
live server and are network-bound, taking around one minutes on my machine.

Each test is already isolated: it creates its own random-username user
and operates through that user's own client, with feeds/categories/
entries scoped per user. The shared admin client is only used read-only
or on error-path tests that create no durable state, and no test asserts

8000
global counts, so the suite is safe to parallelize.

Add t.Parallel() to every test. No t.Setenv/Chdir or t.Run subtests are
present, so nothing conflicts with parallel execution.

It speeds things up from ~60s to ~7s on my machine. I ran the full testsuite a
handful of times just to be sure™, but didn't get any flakiness.
TestRequestBuilder_TimeoutConfiguration dominated the whole test suite
at ~2s. The handler slept a fixed 2s, and httptest.Server.Close() blocks
until in-flight handlers finish, so the package always paid the full
sleep even though the client timed out at 1s.

Block the handler on <-r.Context().Done() instead: when the client times
out and drops the connection, the request context is cancelled and the
handler returns immediately, so Close() no longer waits. Shrink the
timeout to 100ms as well.
Every integration talking to a JSON API hand-rolled the same dance:
json.Marshal the payload, build an *http.Request, set the Content-Type and
User-Agent headers, then run it through NewClientWithOptions. This is
near-identical copy-paste, so any change done to how requests are done had to
be repeated in each one.

This commit introduces a small request builder in internal/http/client and
route every integration through it:

```
client.NewRequestBuilder(endpoint).
	WithMethod(http.MethodPost).
	WithJSON(payload).
	WithHeaders(extraHeaders).
	Do()
```

Centralizing the logic also evens out disparities that had crept in between
integrations:

- private networks are now blocked everywhere, honoring
  INTEGRATION_ALLOW_PRIVATE_NETWORKS; notion previously did not block them;
- request errors are wrapped consistently with %w instead of a mix of %v/%w;
- the per-integration defaultClientTimeout constant is replaced by a single
  shared default in the client package;
- the Content-Type and Miniflux User-Agent headers are always set.

Reviewed-By: gudvinr
@pull pull Bot locked and limited conversation to collaborators Jul 17, 2026
@pull pull Bot added the ⤵️ pull label Jul 17, 2026
@pull
pull Bot merged commit 56eb812 into suhaoGe:main Jul 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0