Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions Darling/Darling.Tests/DarlingStoreUpgradeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2582,7 +2582,13 @@ public async Task UpgradeInPlace_OldMajorStoreWithRealData_UpgradesAndKeepsEvery

var password = DarlingSecrets.Unprotect(
File.ReadAllText(DarlingManagedPostgres.CredentialPathFor(dataDirectory)).Trim());
var oldConnection = DarlingManagedPostgres.BuildConnectionString(config.Port, password);
/* Pooling=false: this connection string is used against a server this test itself stops and
restarts (StopWithRuntimeAsync/StartWithRuntimeAsync below). A pooled Npgsql connection handed
back on the same host/port/user after a restart is a physical socket opened against the OLD
server's lifetime, which the stop already killed — its first use fails with a forcibly-closed
connection. */
var oldConnection = new NpgsqlConnectionStringBuilder(
DarlingManagedPostgres.BuildConnectionString(config.Port, password)) { Pooling = false }.ConnectionString;

/* ---- 2. Measure the store BEFORE, through the old binaries. An ALTER SYSTEM value here (#4253)
is the operator tuning the upgrade must not silently discard — written straight to
Expand Down Expand Up @@ -2787,7 +2793,13 @@ quietly drop the only run of the upgrade nearly every field host takes. When the

var password = DarlingSecrets.Unprotect(
File.ReadAllText(DarlingManagedPostgres.CredentialPathFor(dataDirectory)).Trim());
var oldConnection = DarlingManagedPostgres.BuildConnectionString(config.Port, password);
/* Pooling=false: this connection string is used against a server this test itself stops and
restarts (StopWithRuntimeAsync/StartWithRuntimeAsync below). A pooled Npgsql connection handed
back on the same host/port/user after a restart is a physical socket opened against the OLD
server's lifetime, which the stop already killed — its first use fails with a forcibly-closed
connection. */
var oldConnection = new NpgsqlConnectionStringBuilder(
DarlingManagedPostgres.BuildConnectionString(config.Port, password)) { Pooling = false }.ConnectionString;

/* ---- 2. Measure BEFORE, through the old binaries. ---- */
await StartWithRuntimeAsync(runtimeRoot, dataDirectory, config.Port, timeout.Token);
Expand Down Expand Up @@ -2951,7 +2963,13 @@ public async Task RuntimeAdvance_SameMajor_AnUpdateThatCannotRun_OpensOnTheCarri

var password = DarlingSecrets.Unprotect(
File.ReadAllText(DarlingManagedPostgres.CredentialPathFor(dataDirectory)).Trim());
var oldConnection = DarlingManagedPostgres.BuildConnectionString(config.Port, password);
/* Pooling=false: this connection string is used against a server this test itself stops and
restarts (StopWithRuntimeAsync/StartWithRuntimeAsync below). A pooled Npgsql connection handed
back on the same host/port/user after a restart is a physical socket opened against the OLD
server's lifetime, which the stop already killed — its first use fails with a forcibly-closed
connection. */
var oldConnection = new NpgsqlConnectionStringBuilder(
DarlingManagedPostgres.BuildConnectionString(config.Port, password)) { Pooling = false }.ConnectionString;

await StartWithRuntimeAsync(runtimeRoot, dataDirectory, config.Port, timeout.Token);
var before = await MeasureStoreAsync(oldConnection, timeout.Token);
Expand Down
Loading