mongodb / specifications

Specifications related to MongoDB
http://specifications.readthedocs.io/en/latest
Other
389 stars 242 forks source link

DRIVERS-2644 Downgrade unified test files to the lowest supported schema version #1431

Closed GromNaN closed 1 year ago

GromNaN commented 1 year ago

Fix DRIVERS-2644 This change is necessary for https://github.com/mongodb/mongo-php-library/pull/1090#discussion_r1212163608

Script I made a small PHP script to detect the lowest schema version required for each test file. It can be translated to an other language and run in CI. ```php = 0; $i--) { $newVersion = "1." . $i; if (validateJsonFile($jsonFile, $newVersion)) { $currentVersion = $newVersion; } else { break; } } return $currentVersion; } $jsonFiles = []; $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('source/')); foreach ($iterator as $file) { if ($file->isFile() && $file->getExtension() === 'json' && !str_contains($file->getPathname(), 'source/unified-test-format')) { $jsonFiles[] = $file->getPathname(); } } foreach ($jsonFiles as $jsonFile) { $lowestVersion = getLowestSchemaVersion($jsonFile); if ($lowestVersion) { modifySchemaVersion($jsonFile, $lowestVersion); } } ```
GromNaN commented 1 year ago

Can we merge this PR as is and create a ticket (or use the existing ticket) to work on the CI script later?

ShaneHarvey commented 1 year ago

Sounds good to me.

alcaeus commented 1 year ago

Created DRIVERS-2649 to track adding a script like this to CI.