From 702519f9797d6ffef359892066dde15ade2c0f10 Mon Sep 17 00:00:00 2001 From: James Rosewell Date: Sat, 14 Nov 2026 18:55:45 +0000 Subject: [PATCH] Wait for the shared store read before asserting on it in the shared choice test --- Browser51Did/PmpAcceptanceTests.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Browser51Did/PmpAcceptanceTests.cs b/Browser51Did/PmpAcceptanceTests.cs index f917303..3cf3396 100644 --- a/Browser51Did/PmpAcceptanceTests.cs +++ b/Browser51Did/PmpAcceptanceTests.cs @@ -230,16 +230,20 @@ private void SharedChoice(string browser) visitor.WaitForPmp(); visitor.WaitForClientRounds(1); - var read = visitor.SharedStoreRequests() - .FirstOrDefault(r => r.Method == "GET" && r.Done); - Assert.IsNotNull( - read, - "PMP must ask the shared store what this visitor " - + "already chose. It made no such call. The requests were: " + // The read can still be in flight when the first client round ends, + // because the two calls are separate and a remote cloud answers + // them in its own time. + Harness.Until( + () => visitor.SharedStoreRequests() + .Any(r => r.Method == "GET" && r.Done), + "PMP asked the shared store what this visitor already chose in " + + $"{browser}. The requests were: " + string.Join(" || ", visitor.Requests().Select(r => r.ToString()))); + var read = visitor.SharedStoreRequests() + .First(r => r.Method == "GET" && r.Done); Assert.IsTrue( - read!.Response.Contains("standard", StringComparison.Ordinal), + read.Response.Contains("standard", StringComparison.Ordinal), "the shared store must answer with the choice made on the other " + $"site. It answered: {Truncate(read.Response)}");