gpbackup
gpbackup copied to clipboard
Rework e2e tests to reset cluster state between each test
This PR reworks test setup/teardown by resetting cluster state in a controlled way prior to each test.
Every test was responsible for cleaning up after itself, to varying degrees of success. In some cases, multiple connections were trying to create/drop global objects concurrently, and a couple were doing things they shouldn't be in utility mode. This would result in unpredictable ordering of DDL statements, occasionally causing contention that resulted in failed tests.
Since the e2e tests are each independent, instead reset the cluster state before each one. This is quick since none of the tests are heavy. This resolves the intermittent issues with hanging tests. Also has the side effect of cleaning up the code significantly by removing a ton of defer statements running within each test
TODO: The gpdb{4,5,6}_objects files in end_to_end/resources are only used by 2 tests, but there are object conflicts when trying to load gpdb4_objects.sql alongside test_tables_ddl.sql. For now, comment out the conflicting objects. These SQL files should be merged together into a single file if possible, the current SQL files actually masked a bug with parallel restore of ALTER TABLE..EXCHANGE PARTITION, which will be fixed in a separate PR.