Skip to content

Use gun in tests - #6098

Open
nickva wants to merge 1 commit into
mainfrom
gun-for-tests
Open

Use gun in tests#6098
nickva wants to merge 1 commit into
mainfrom
gun-for-tests

Conversation

@nickva

@nickva nickva commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Since we have gun and it's proven its worth in nouveau let's use for tests as well. The bigger idea is to use for replication but let's make a smaller step first and see how it fares in unit and elixir tests.

To help with unit tests created a simpler compatibility couch_gun module. It accepted some of the existing options and shapes of headers and auth parameters we already use everywhere. This helps avoid rewriting a whole lot of tests in one go. Dependency-wise we just have to ensure gun is started but otherwise it's already present there for nouveau so we don't need to bring anything new in, which is nice.

Elixir tests used httpotion based on ibrowse. That client is deprecated we have been getting "httpotion is unmaintained" warnings for a while now (this was another reason to attempt this PR). Since httpotion was based on ibrowse we had to create a similar "helper" as for unit tests, just to handle some expected APIs from the callers. In many ways gun provides a nicer abstraction to streaming, so we could also simplify some of the worker start/stop and direct or pid:once hacks. Dependency-wise we don't have to do anything gun and cowlib are already present we can just clean up httpotion and ibrowse from elixir deps.

@nickva
nickva force-pushed the gun-for-tests branch 2 times, most recently from ab17723 to 26c8ba6 Compare August 21, 2026 22:13
Comment thread src/couch/src/test_request.erl Outdated
Since we have gun and it's proven its worth in nouveau let's use for tests as
well. The bigger idea is to use for replication but let's make a smaller step
first and see how it fares in unit and elixir tests.

To help with unit tests created a simpler compatibility couch_gun module. It
accepted some of the existing options and shapes of headers and auth parameters
we already use everywhere. This helps avoid rewriting a whole lot of tests in
one go. Dependency-wise we just have to ensure gun is started but otherwise
it's already present there for nouveau so we don't need to bring anything new
in, which is nice.

Elixir tests used httpotion based on ibrowse. That client is deprecated we have
been getting "httpotion is unmaintained" warnings for a while now (this was
another reason to attempt this PR). Since httpotion was based on ibrowse we had
to create a similar "helper" as for unit tests, just to handle some expected
APIs from the callers. In many ways gun provides a nicer abstraction to
streaming, so we could also simplify some of the worker start/stop and direct
or pid:once hacks. Dependency-wise we don't have to do anything gun and cowlib
are already present we can just clean up httpotion and ibrowse from elixir
deps.
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