Remove httpclient.Client interface #6726
Labels
component/ci
Issue related to kubeapps ci system
kind/enhancement
An issue that reports an enhancement for an implemented feature
Summary
Remove the
httpclient.Client
interface that Kubeapps uses to implement fake clients in tests.Background and rationale
Early on in Kubeapps' history, the
httpclient.Client
interface was added it seems solely so that test implementations of that interface could be used in tests (with dummy responses).But this leaks into the actual code, with us passing our own
httpclient.Client
implementations around which are not standardhttp.Client
structs, and so can't be used as such.I'm currently working on #6706 and as part of that am needing to integrate with the ORAS-go library (which we've wanted to do anyway), but to do so, need to use and pass a standard
http.Client
.Description
Go has an excellent
httptest
library (not sure if wasn't known about at the time the original Kubeapps tests were written) which removes the need for a fake client, as it instead creates a fake server and you can use your real client, so there is no need for ourhttpclient.Client
interface anymore either.We should refactor to use that instead
Acceptance criteria
Tests pass without the interface and we remove all use of it.
Additional context
I'm just creating this issue because I started working on this today, but didn't get it finished, so just dumping the rationale for what I'm doing.
The text was updated successfully, but these errors were encountered: