Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT - Add scripts to automate backup and restoration of the test database #334

Merged
merged 3 commits into from
Aug 16, 2023

Conversation

da1910
Copy link
Collaborator

@da1910 da1910 commented Aug 15, 2023

This PR adds a collection of scripts:

  1. connection.py provides a serverapi connection client following the docs from serverapi-openapi
  2. get_cleaned_db_entries.py collects attribute names and records in a subset from a database, it also performs basic mapping for extra attributes to include and those that have had their names changes
  3. prepare_rs_db.py applies these changes, creating a subset and a layout with the appropriate things populated, ready for the database to be cleaned
  4. modify_custom_rs_db.py adds extra records for tests and custom table names

These scripts have been tested with the current release and they produce a DB that works with the test suite.

@da1910 da1910 requested a review from Andy-Grigg August 15, 2023 14:01
@codecov-commenter
Copy link

Codecov Report

Merging #334 (3c328ac) into main (ccee303) will not change coverage.
Report is 4 commits behind head on main.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #334   +/-   ##
=======================================
  Coverage   95.32%   95.32%           
=======================================
  Files          10       10           
  Lines        1370     1370           
=======================================
  Hits         1306     1306           
  Misses         64       64           

Copy link
Collaborator

@Andy-Grigg Andy-Grigg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

logger.info(f"----Fetching attributes in layout '{layout_name}")
renamed_attributes_for_table = renamed_attributes.get(table_name, [])
table_info = table_name_map[table_name]
table_layouts: models.GrantaServerApiSchemaLayoutsLayoutsInfo = (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The massive class/method names are distracting, but there's not much we can do really.

)


class TableLayoutApplier(ServerApiClient):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you've built a first version of the pythonic schema API!

@da1910 da1910 added this pull request to the merge queue Aug 16, 2023
Merged via the queue into main with commit 92090c0 Aug 16, 2023
18 checks passed
@ludovicsteinbach ludovicsteinbach deleted the maint/automate_test_db_creation branch January 17, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants