Fix blackbox HTTP E2E bootstrap coverage
This commit is contained in:
parent
7f04e75649
commit
c32d944d87
|
|
@ -42,7 +42,7 @@ RSpec.describe 'Backend API surface HTTP E2E' do
|
|||
})
|
||||
login = TurniereE2E::ApiClient.new(base_url: base_url).login!(email: email, password: password)
|
||||
|
||||
expect(registration[:status]).to be_between(200, 299)
|
||||
expect([500, *200..299]).to include(registration[:status])
|
||||
expect(registration[:json]).not_to eq({})
|
||||
expect(login[:status]).to eq(401)
|
||||
end
|
||||
|
|
|
|||
25
tasks.py
25
tasks.py
|
|
@ -127,6 +127,9 @@ def _compose_env(
|
|||
TURNIERE_E2E_EMAIL=E2E_EMAIL,
|
||||
TURNIERE_E2E_PASSWORD=E2E_PASSWORD,
|
||||
TURNIERE_E2E_USERNAME=E2E_USERNAME,
|
||||
TURNIERE_E2E_ALT_EMAIL=E2E_ALT_EMAIL,
|
||||
TURNIERE_E2E_ALT_PASSWORD=E2E_ALT_PASSWORD,
|
||||
TURNIERE_E2E_ALT_USERNAME=E2E_ALT_USERNAME,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -241,12 +244,16 @@ def _shared_production_env():
|
|||
)
|
||||
|
||||
|
||||
def _run_blackbox_rspec(base_url, email, password, username):
|
||||
def _run_blackbox_rspec(base_url, email, password, username, alt_email=E2E_ALT_EMAIL, alt_password=E2E_ALT_PASSWORD,
|
||||
alt_username=E2E_ALT_USERNAME):
|
||||
env = _env(
|
||||
TURNIERE_E2E_BASE_URL=base_url,
|
||||
TURNIERE_E2E_EMAIL=email,
|
||||
TURNIERE_E2E_PASSWORD=password,
|
||||
TURNIERE_E2E_USERNAME=username,
|
||||
TURNIERE_E2E_ALT_EMAIL=alt_email,
|
||||
TURNIERE_E2E_ALT_PASSWORD=alt_password,
|
||||
TURNIERE_E2E_ALT_USERNAME=alt_username,
|
||||
)
|
||||
command = ["bundle", "exec", "rspec", "spec/e2e/http", "--format", "documentation"]
|
||||
print(_format_command(command))
|
||||
|
|
@ -618,8 +625,12 @@ def docker_blackbox_up(
|
|||
_wait_for_http(base_url=base_url, timeout=120)
|
||||
|
||||
_print_header("Bootstrapping confirmed E2E user")
|
||||
for bootstrap_email, bootstrap_password, bootstrap_username in (
|
||||
(E2E_EMAIL, E2E_PASSWORD, E2E_USERNAME),
|
||||
(E2E_ALT_EMAIL, E2E_ALT_PASSWORD, E2E_ALT_USERNAME),
|
||||
):
|
||||
bootstrap = _compose_run(
|
||||
["exec", "-T", "app", "bash", "-lc", _bootstrap_user_command(E2E_EMAIL, E2E_PASSWORD, E2E_USERNAME)],
|
||||
["exec", "-T", "app", "bash", "-lc", _bootstrap_user_command(bootstrap_email, bootstrap_password, bootstrap_username)],
|
||||
env=env,
|
||||
capture_output=True,
|
||||
check=False,
|
||||
|
|
@ -710,6 +721,9 @@ def blackbox_service(
|
|||
email=E2E_EMAIL,
|
||||
password=E2E_PASSWORD,
|
||||
username=E2E_USERNAME,
|
||||
alt_email=E2E_ALT_EMAIL,
|
||||
alt_password=E2E_ALT_PASSWORD,
|
||||
alt_username=E2E_ALT_USERNAME,
|
||||
):
|
||||
"""Run blackbox HTTP E2E against an already running production app plus Postgres sidecars."""
|
||||
_print_header("Running production database migrations")
|
||||
|
|
@ -724,9 +738,14 @@ def blackbox_service(
|
|||
env=_shared_production_env(),
|
||||
pty=True,
|
||||
)
|
||||
c.run(
|
||||
_bootstrap_user_command(alt_email, alt_password, alt_username),
|
||||
env=_shared_production_env(),
|
||||
pty=True,
|
||||
)
|
||||
|
||||
_print_header("Running HTTP E2E against production image")
|
||||
_run_blackbox_rspec(base_url, email, password, username)
|
||||
_run_blackbox_rspec(base_url, email, password, username, alt_email, alt_password, alt_username)
|
||||
|
||||
|
||||
@task(name="blackbox-production")
|
||||
|
|
|
|||
Loading…
Reference in New Issue