Originally the DSNs and connectors were stored as variables and a function returning new sql.DBs based on those variables were called by tests.
To make it easier to add new tests and to remove the boilerplate code a RegisterDSN function is being supplied instead. The RegisterDSN method generates one function (or two if a connector function is passed), which is stored with a name in a map. These functions return a newly created sql.DB.
Tests now iterate over this map and call the functions instead.
This makes the tests for different connection more extensible - e.g. to also test against a remote ASE the caller now only registers an additional DSN with the information of the remote ASE, where before more boilerplate code and variables would have to be introduced.
Description
Originally the DSNs and connectors were stored as variables and a function returning new
sql.DB
s based on those variables were called by tests.To make it easier to add new tests and to remove the boilerplate code a
RegisterDSN
function is being supplied instead. TheRegisterDSN
method generates one function (or two if a connector function is passed), which is stored with a name in a map. These functions return a newly createdsql.DB
. Tests now iterate over this map and call the functions instead.This makes the tests for different connection more extensible - e.g. to also test against a remote ASE the caller now only registers an additional DSN with the information of the remote ASE, where before more boilerplate code and variables would have to be introduced.
How was the patch tested?
Linter, unit- and integration tests.