feat: make pgCoordinator generally available #8419
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The main feature of this PR is to make pgCoord the default coordinator in Coder Enterprise when HA is enabled. The old haCoordinator can be set using an experiment flag if we run into any problems in prod. It retires the experiment flag we used to use to enable pgCoord.
Because pgCoord only works with a real Postgres DB and Pubsub, the rest of the PR is devoted to fixing up the tests.
Since when we create a test enterprise Coderd we nearly always create a user and add a license, I've made these functions part of the test routine that creates the Coderd. For tests that really need to do these things explicitly, it can be disabled in the options.
Moving license creation into the startup routine allows me to double-check that the test hasn't enabled HA with the dbfake and in-mem Pubsub.
The tests that do actually exercise HA with multiple replicas are now skipped if the DB is not postgres.