Skip to content

Commit

Permalink
tests: make location_conf_churn more robust (#8271)
Browse files Browse the repository at this point in the history
## Problem

This test directly manages locations on pageservers and configuration of
an endpoint. However, it did not switch off the parts of the storage
controller that attempt to do the same: occasionally, the test would
fail in a strange way such as a compute failing to accept a
reconfiguration request.

## Summary of changes

- Wire up the storage controller's compute notification hook to a no-op
handler
- Configure the tenant's scheduling policy to Stop.
  • Loading branch information
jcsp authored Jul 5, 2024
1 parent 6876f0d commit 5aae806
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion test_runner/regress/test_pageserver_secondary.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from fixtures.remote_storage import LocalFsStorage, RemoteStorageKind, S3Storage, s3_storage
from fixtures.utils import wait_until
from fixtures.workload import Workload
from werkzeug.wrappers.request import Request
from werkzeug.wrappers.response import Response

# A tenant configuration that is convenient for generating uploads and deletions
# without a large amount of postgres traffic.
Expand Down Expand Up @@ -59,7 +61,7 @@ def evict_random_layers(


@pytest.mark.parametrize("seed", [1, 2, 3])
def test_location_conf_churn(neon_env_builder: NeonEnvBuilder, seed: int):
def test_location_conf_churn(neon_env_builder: NeonEnvBuilder, make_httpserver, seed: int):
"""
Issue many location configuration changes, ensure that tenants
remain readable & we don't get any unexpected errors. We should
Expand All @@ -73,6 +75,20 @@ def test_location_conf_churn(neon_env_builder: NeonEnvBuilder, seed: int):
neon_env_builder.enable_pageserver_remote_storage(
remote_storage_kind=s3_storage(),
)
neon_env_builder.control_plane_compute_hook_api = (
f"http://{make_httpserver.host}:{make_httpserver.port}/notify-attach"
)

def ignore_notify(request: Request):
# This test does all its own compute configuration (by passing explicit pageserver ID to Workload functions),
# so we send controller notifications to /dev/null to prevent it fighting the test for control of the compute.
log.info(f"Ignoring storage controller compute notification: {request.json}")
return Response(status=200)

make_httpserver.expect_request("/notify-attach", method="PUT").respond_with_handler(
ignore_notify
)

env = neon_env_builder.init_start(initial_tenant_conf=TENANT_CONF)

pageservers = env.pageservers
Expand All @@ -99,6 +115,15 @@ def test_location_conf_churn(neon_env_builder: NeonEnvBuilder, seed: int):
workload.init(env.pageservers[0].id)
workload.write_rows(256, env.pageservers[0].id)

# Discourage the storage controller from interfering with the changes we will make directly on the pageserver
env.storage_controller.tenant_policy_update(
tenant_id,
{
"scheduling": "Stop",
},
)
env.storage_controller.allowed_errors.append(".*Scheduling is disabled by policy Stop.*")

# We use a fixed seed to make the test reproducible: we want a randomly
# chosen order, but not to change the order every time we run the test.
rng = random.Random(seed)
Expand Down

1 comment on commit 5aae806

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3111 tests run: 2982 passed, 2 failed, 127 skipped (full report)


Failures on Postgres 14

  • test_sharding_autosplit[github-actions-selfhosted]: release
  • test_storage_controller_many_tenants[github-actions-selfhosted]: release
# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_sharding_autosplit[release-pg14-github-actions-selfhosted] or test_storage_controller_many_tenants[release-pg14-github-actions-selfhosted]"

Code coverage* (full report)

  • functions: 32.6% (6932 of 21268 functions)
  • lines: 50.0% (54447 of 108884 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
5aae806 at 2024-07-05T11:29:53.077Z :recycle:

Please sign in to comment.