-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integration test for upgrades (#239)
- Loading branch information
1 parent
7f04e16
commit d12a0d3
Showing
6 changed files
with
128 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- a/config/unicorn.conf.rb | ||
+++ b/config/unicorn.conf.rb | ||
@@ -52,6 +52,15 @@ check_client_connection false | ||
|
||
initialized = false | ||
before_fork do |server, worker| | ||
+ Signal.trap 'TERM' do | ||
+ puts 'Unicorn master intercepting TERM and sending myself QUIT after 5s instead' | ||
+ Thread.new do | ||
+ sleep 15 | ||
+ puts 'Send QUIT signal to master' | ||
+ Process.kill 'QUIT', Process.pid | ||
+ end | ||
+ end | ||
+ | ||
unless initialized | ||
Discourse.preload_rails! | ||
|
||
@@ -266,6 +275,9 @@ before_fork do |server, worker| | ||
end | ||
|
||
after_fork do |server, worker| | ||
+ Signal.trap 'TERM' do | ||
+ puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT' | ||
+ end | ||
DiscourseEvent.trigger(:web_fork_started) | ||
Discourse.after_fork | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,7 +152,8 @@ async def app_fixture( | |
trust=True, | ||
config={"profile": "testing"}, | ||
) | ||
await model.wait_for_idle(apps=[postgres_app.name], status="active") | ||
async with ops_test.fast_forward(): | ||
await model.wait_for_idle(apps=[postgres_app.name], status="active") | ||
|
||
redis_app = await model.deploy("redis-k8s", series="jammy", channel="latest/edge") | ||
await model.wait_for_idle(apps=[redis_app.name], status="active") | ||
|
@@ -234,7 +235,7 @@ async def setup_saml_config(app: Application, model: Model): | |
@pytest_asyncio.fixture(scope="module", name="admin_credentials") | ||
async def admin_credentials_fixture(app: Application) -> types.Credentials: | ||
"""Admin user credentials.""" | ||
email = "[email protected]" | ||
email = f"admin-user{secrets.randbits(32)}@test.internal" | ||
password = secrets.token_urlsafe(16) | ||
discourse_unit: Unit = app.units[0] | ||
action: Action = await discourse_unit.run_action( | ||
|
@@ -277,6 +278,7 @@ async def admin_api_key_fixture( | |
) | ||
# pylint doesn't see the "ok" member | ||
assert res.status_code == requests.codes.ok, res.text # pylint: disable=no-member | ||
assert "error" not in res.json() | ||
# Create global key | ||
res = sess.post( | ||
f"{discourse_address}/admin/api/keys", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters