New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug 1422009: Adjust liveness tests, avoid DB query in middleware #4579

Merged
merged 3 commits into from Dec 4, 2017

Conversation

Projects
None yet
3 participants
@jwhitlock
Member

jwhitlock commented Nov 30, 2017

After a long day of looking into Kubernetes liveness and readiness probes, we decided to keep database connection tests in the readiness views for a bit longer (closing PR #4578), and instead adjust the probe settings in Kubernetes (mozmeao/infra#665). There are some changes that we still want to apply.

  • Refactor the health probe tests, to show that the database is not needed for several tests
  • Detect health probe URLs in the DocumentZoneMiddleware, and exit early to avoid the (cached) database query.

safwanrahman and others added some commits Nov 30, 2017

bug 1422009: Skip zone check for locale-less slugs
LANGUAGE_URL_IGNORED_PATHS do not redirect to /en-US/ or other, and we
know they will not be in a zone. This includes the Kubernetes liveness
and readiness probe endpoints, where we want to avoid a possible extra
database request.

@jwhitlock jwhitlock requested review from jgmize and escattone Nov 30, 2017

@escattone escattone self-assigned this Nov 30, 2017

@escattone

This looks great to me, thanks @jwhitlock!

['get', 'head', 'put', 'post', 'delete', 'options'])
def test_liveness(db, client, http_method):
@pytest.mark.parametrize('http_method', ['put', 'post', 'delete', 'options'])
@pytest.mark.parametrize('endpoint', ['health.liveness', 'health.readiness'])

This comment has been minimized.

@escattone

escattone Nov 30, 2017

Member

❤️ Nice little refactor to use stacked pytest.mark.parametrize decorators. I've got to remember to do this more often when it makes sense!

@escattone

escattone Nov 30, 2017

Member

❤️ Nice little refactor to use stacked pytest.mark.parametrize decorators. I've got to remember to do this more often when it makes sense!

@jwhitlock jwhitlock merged commit 365848e into mozilla:master Dec 4, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jwhitlock jwhitlock deleted the jwhitlock:k8s-probes-1422009 branch Dec 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment