Closed SPlanzer closed 4 years ago
This is going to be slow. Either when building the docker db container or at test initiation a large amount of data will need to be read into the DB. - This is going to be slow for our needs and slow down development
Cherry picking a subset of the production data may be complex. It will not be overly difficult to ensure data covers all test scenarios but it may be hard to maintain referential integrity across tables.
Creating test data on-the-fly is the most flexible. It allows for us to have the required data available and deployed quicker than other methods.
The gazetteer feature data can be created via the database applications stored procedures to ensure referential integrity is maintained.
example of creating test data
import psycopg2
from psycopg2 import Error
test_data = [
{
"name": "A Hill",
"code": "PLAC",
"geom": "POINT(174.85193754181844 -37.796524856134)",
},
{
"name": "A Islands",
"code": "ISLD",
"geom": "POINT(174.85193754181844 -37.796524856134)",
},
{
"name": "A Lake",
"code": "LAKE",
"geom": "POINT(174.85193754181844 -37.796524856134)",
},
{
"name": "A Glacier",
"code": "GLCR",
"geom": "POINT(174.85193754181844 -37.796524856134)",
},
]
# Connect to DB
try:
ps_connection = psycopg2.connect(
user="gazadmin",
password="gazadmin",
host="127.0.0.1",
port="5432",
database="gazetteer",
)
# Get cursor
cursor = ps_connection.cursor()
for data in test_data:
# Run database applications gaz_createnewfeature procedure
cursor.callproc(
"gazetteer.gaz_createnewfeature",
[data["name"], data["code"], data["geom"]],
)
# Commit
ps_connection.commit()
cursor.close()
ps_connection.close()
except (Exception, psycopg2.DatabaseError) as error:
print("Error while adding a new feature to the database", error)
Sounds like a no-brainer to me. I'm good with dummy test data.
I agree with Bill. Seems we have consensus - closing
Task
We need data for running tests. How are going to get this into the test database (db container) for running automated tests?
Definition of Done
Once there is agreement on the best approach for making data available to automate tests,
Out of Scope
Discussion required
Yip. Input as to the best method for making test data available to automated tests.
Add an Assignee, Epics, Estimate and any relevant Labels.