status-go icon indicating copy to clipboard operation
status-go copied to clipboard

Added fix for pinging a remote service in tests

Open Samyoul opened this issue 3 years ago • 2 comments
trafficstars

What's Changed?

I've added httptest.NewServer to serve test assets to the test.

Why make the change?

Because I ran this test the other day and it failed because the service was down, I don't like tests being dependent on external services and network conditions so I did this.

Follow up

I do notice that there are a number of http.Client in the status-go code and I'm suspicious about a few of them, some have no tests.

With *http.Client, With Tests

  • [x] images/decode pings remote services in tests
  • [ ] protocol/urls pings remote services in tests
  • [ ] services/gifs pings remote services in tests
  • [x] services/wallet/on_ramp_tests pings remote services (I did this 🙈)

With *http.Client, No tests

  • ipfs.Downloader{} has a *http.Client - no tests
  • services/wallet/prices.go has a *http.Client - no tests
  • telemetry/Client{} has a *http.Client - no tests
  • services/updates has a *http.Client - no tests

With *http.Client, Uses httptest

  • notifier.Notifier{} has a *http.Client - has tests, uses httptest
  • services/wallet/opensea_test - has tests, uses httptest

Note for QA

This has no expected impact on any e2e tests. The changes here should only impact on status-go tests.

Samyoul avatar Aug 09 '22 15:08 Samyoul

Pull Request Checklist

  • [ ] Have you updated the documentation, if impacted (e.g. docs.status.im)?
  • [ ] Have you tested changes with mobile?
  • [ ] Have you tested changes with desktop?

status-github-bot[bot] avatar Aug 09 '22 15:08 status-github-bot[bot]

Jenkins Builds

Click to see older builds (12)
:grey_question: Commit :hash: Finished (UTC) Duration Platform Result
:heavy_check_mark: 76604e43 #1 2022-08-09 15:36:54 ~2 min linux :package:zip
:heavy_check_mark: 76604e43 #1 2022-08-09 15:37:39 ~3 min ios :package:zip
:heavy_check_mark: 76604e43 #1 2022-08-09 15:39:08 ~4 min android :package:aar
:heavy_check_mark: 9bf368f0 #2 2022-08-09 23:00:15 ~1 min linux :package:zip
:heavy_check_mark: 9bf368f0 #2 2022-08-09 23:00:31 ~2 min ios :package:zip
:heavy_check_mark: 9bf368f0 #2 2022-08-09 23:03:17 ~4 min android :package:aar
:heavy_check_mark: 4be786e3 #3 2022-08-16 10:54:55 ~9 min ios :package:zip
:heavy_check_mark: 4be786e3 #3 2022-08-16 10:58:42 ~13 min linux :package:zip
:heavy_check_mark: 4be786e3 #3 2022-08-16 11:00:04 ~14 min android :package:aar
:heavy_check_mark: 6794ff39 #4 2022-09-09 13:39:19 ~2 min linux :package:zip
:heavy_check_mark: 6794ff39 #4 2022-09-09 13:41:55 ~4 min android :package:aar
:heavy_check_mark: 6794ff39 #4 2022-09-09 13:42:03 ~4 min ios :package:zip
:grey_question: Commit :hash: Finished (UTC) Duration Platform Result
:heavy_check_mark: 5dd1df44 #5 2022-09-09 13:42:27 ~1 min linux :package:zip
:heavy_check_mark: 5dd1df44 #5 2022-09-09 13:44:52 ~2 min android :package:aar
:heavy_check_mark: 5dd1df44 #5 2022-09-09 13:46:49 ~4 min ios :package:zip
:heavy_check_mark: 25e5841d #6 2022-09-09 13:48:00 ~2 min linux :package:zip
:heavy_check_mark: 25e5841d #6 2022-09-09 13:48:39 ~1 min ios :package:zip
:heavy_check_mark: 25e5841d #6 2022-09-09 13:48:43 ~3 min android :package:aar

status-im-auto avatar Aug 09 '22 15:08 status-im-auto