opengisch / pum

Postgres Upgrades Manager
GNU General Public License v2.0
30 stars 7 forks source link

Sort deltas by name within groups #22

Closed elemoine closed 6 years ago

elemoine commented 6 years ago

This PR suggests sorting deltas by name within (version, type) groups.

Currently the order of deltas within a (version, type) group depends on the order of the list returned by listdir. And that order is system-dependent.

So this PR changes the sort key to use (version, type, name) rather than (version, type), making sure that deltas are sorted by their names within (version, type) groups.

I am happy to add tests for this, but I don't know how to run the tests a this point. See https://github.com/opengisch/pum/issues/21.

marioba commented 6 years ago

@elemoine good idea. Let me know when you're ok with the tests.

elemoine commented 6 years ago

Thank you. I'll write tests later today.

elemoine commented 6 years ago

I added tests. The test_upgrader_run test fails without my change to the sort key, and it passes with my change. I also added a number of minor fixes. For example, some files were not closed.

marioba commented 6 years ago

Great, thanks.

marioba commented 6 years ago

Released into version 0.5.10