Page MenuHomePhabricator

Increase test coverage for GeoIP2 information [M]
Closed, ResolvedPublic

Description

User testing is going to be difficult, since we don't currently have all of MaxMind's data files available to the Beta Cluster, or even in production. To make up for this, we should be rigorous with our unit test coverage.

This task is for ensuring that our unit tests cover our usage of the geoip2 Reader API and the Model classes' APIs (e.g. City.php, Asn.php, etc). This may involve refactoring GeoIp2InfoRetriever.

We may also be able to make use of Maxmind's test databases for integration tests.

Event Timeline

Tchanders renamed this task from Increase unit test coverage for GeoIP2 information to Increase test coverage for GeoIP2 information.Dec 23 2020, 7:29 PM
Tchanders updated the task description. (Show Details)

A good first start would be to either:

  1. Make MediaWiki\Extensions\IPInfo\InfoRetriever\GeoIP2InfoRetriever::getReader() protected
  2. Extract a ReaderFactory class that we inject into GeoIP2InfoRetriever at construction time

In either case, we can then make assertions about which readers are being requested and what GeoIP2InfoRetriever returns when the requested reader behaves a particular way.


This is an involved task but is a good one to familiarise yourself with (unit) testing and PHPUnit.

ARamirez_WMF renamed this task from Increase test coverage for GeoIP2 information to Increase test coverage for GeoIP2 information [M].Oct 6 2021, 4:34 PM
ARamirez_WMF removed the point value 3 for this task.

Change 731259 had a related patch set uploaded (by TsepoThoabala; author: TsepoThoabala):

[mediawiki/extensions/IPInfo@master] Increase test coverage for GeoIP2 information

https://gerrit.wikimedia.org/r/731259

Change 731260 had a related patch set uploaded (by TsepoThoabala; author: TsepoThoabala):

[mediawiki/extensions/IPInfo@master] Increase test coverage for GeoIP2 information

https://gerrit.wikimedia.org/r/731260

Change 731259 abandoned by TsepoThoabala:

[mediawiki/extensions/IPInfo@master] Increase test coverage for GeoIP2 information

Reason:

Old local commit.

https://gerrit.wikimedia.org/r/731259

Change 731936 had a related patch set uploaded (by TsepoThoabala; author: TsepoThoabala):

[mediawiki/extensions/IPInfo@master] Increase test coverage for GeoIP2 information

https://gerrit.wikimedia.org/r/731936

Change 731260 abandoned by TsepoThoabala:

[mediawiki/extensions/IPInfo@master] Increase test coverage for GeoIP2 information

Reason:

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/IPInfo/+/731936/

https://gerrit.wikimedia.org/r/731260

Change 731936 merged by jenkins-bot:

[mediawiki/extensions/IPInfo@master] Increase test coverage for GeoIP2 information

https://gerrit.wikimedia.org/r/731936