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

Ensure unit tests do not touch any files under data, use debug instead of pry #260

Merged
merged 6 commits into from
Feb 28, 2024

Conversation

ngiger
Copy link
Collaborator

@ngiger ngiger commented Feb 27, 2024

I invested a day or so to improve running the unit tests, as last week I stumbled several times over the fact, that the github unit tests were okay after my push, but failed after creating an pull request.
The following improvements went in

  • Unittest do no longer touch any file under data, but use the data4tests directory
  • Added src/util/workdir to
    • defined WORK_DIR as as data when running normally and as data4tests when Minitest are defined
    • define as some constants depending on WORK_DIR
    • define PROJECT_ROOT and RESOURCES_DIR for a few cases, where we must access file in the git checkout
  • Removed various FileUtil.rm_rf(WORK_DIR) in minitests teardown
  • Added various FileUtil.rm_rf(WORK_DIR) in minitests setup to ensure that plugins get a clean state
  • Replace pry by debug everywhere (as the debug gem is now good enough and part of the Ruby std library)
  • Replaced ARCHIVE_PATH by WORK_DIR
  • Reworked 7 unit test to make them pass instead of skipping them

Tested, also the following jobs

  • jobs/import_swissmedic reparse 43454 45199 48914 49537 66762 53662 53663 57141 56079 5170
  • import_daily

@zdavatz
Copy link
Owner

zdavatz commented Feb 27, 2024

Will this also work with job/import_bsv and jobs/import_swissmedic?

@ngiger
Copy link
Collaborator Author

ngiger commented Feb 27, 2024

As I did not change any unit test and was careful when changing files under src, I am very confident, that all jobs still run. Import_daily and import_swissmedic were run just be 100% sure.
Started job/import_bsv, when it is finish I will run jobs/import_swissmedic too and report the result later here.

@ngiger
Copy link
Collaborator Author

ngiger commented Feb 28, 2024

The two imports finished here.

jobs/import_swissmedic? one mail with the following error in it

Plugin: ODDB::SwissregPlugin
Error: DRb::DRbRemoteError
Message: 500 => Net::HTTPInternalServerError for https://www.swissreg.ch/srclient/faces/jsp/start.jsp -- unhandled response (Mechanize::ResponseCodeError)
Backtrace:

I think we can ignore it, as probably the swissreg server was unavailable

@zdavatz zdavatz merged commit 0e04ebe into zdavatz:master Feb 28, 2024
1 check passed
@zdavatz
Copy link
Owner

zdavatz commented Feb 28, 2024

to make this PR work, a "bundle install" was necessary.

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.

2 participants