This week, I added database setup and maintenance to the Go version of Sayembara’s registration service. I also completed practice runs for bulk registrations and these new functions, comparing their results with C++. These runs gave me evidence of what matched and helped me find a problem that the unit tests had not shown.
Preparing New Database Settings
I ported createTenant, which prepares a new registration database with its initial settings, templates and signing keys. The keys are used to sign the registration codes printed on participants’ slips. I included Go versions of the templates, so a new database receives files that the Go service can use.
The unit tests passed, and the practice run confirmed that the expected settings and files were created. This covered the setup needed before a new database can be configured for registrations.
Checking Bulk Registrations
I tested the bulk order work completed last week using my own test orders, so the customer emails came to me. A bulk order contains a spreadsheet of participants, which the service turns into separate orders in WooCommerce, the website’s shop system.
I ran Go and C++ on the same CSV text files, Excel workbooks and OpenDocument spreadsheets, and the valid files produced matching child orders. For a file with an invalid column heading, both versions recorded the error, notified the buyer and put the order on hold.
I also followed a child order through to its registration entry, confirmation email and PDF slip, and the outputs matched in the cases checked.
Database Compaction
I added compaction, the database maintenance step that reclaims space left by older document versions. The Go service now checks whether compaction is needed before starting it, and avoids starting another run while one is already active.
The practice run showed that Go and C++ both reduced the database file size. Additional checks confirmed that the service continued handling incoming database changes during compaction.
Fixing a Problem Found in the Full Run
During testing, I found that creating a database while Go was already running could stop the service. I corrected where it starts reading the new database’s updates and added an error check, so the next run completed the setup and continued without a crash.
This showed why passing unit tests was only one part of checking the migration. I then prepared the combined pull request description with comparison results and screenshots, so the changes had supporting evidence ready for review.
Next Week’s Plan
Next week, I plan to send the combined changes to my supervisor, Dr. Shawn, for review and address his feedback, and start to think about the UI part of the participant app.
0 Comments