fix(site-runtime): batch native-alarm deletes into the coalesced flush transaction; docs for scripts/cache/scheduler (review 2026-10-21 01/SR-P2)
This commit is contained in:
+17
@@ -95,6 +95,23 @@ public class NativeAlarmStateStoreTests : IAsyncLifetime, IDisposable
|
||||
Assert.Equal("Tank01.Lo", rows[0].SourceReference);
|
||||
}
|
||||
|
||||
/// <summary>Upserts and deletes apply together in one batch (review 2026-10-21 01/SR-P2).</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task ApplyChanges_UpsertsAndDeletesInOneBatch()
|
||||
{
|
||||
await _storage.UpsertNativeAlarmAsync("inst", "Src", "A", "{}", DateTimeOffset.UnixEpoch);
|
||||
await _storage.UpsertNativeAlarmAsync("inst", "Src", "B", "{}", DateTimeOffset.UnixEpoch);
|
||||
await _storage.UpsertNativeAlarmAsync("inst", "Src", "C", "{}", DateTimeOffset.UnixEpoch);
|
||||
|
||||
await _storage.ApplyNativeAlarmChangesAsync("inst", "Src",
|
||||
[("D", "{\"n\":1}", null, DateTimeOffset.UnixEpoch)],
|
||||
["A", "B"]);
|
||||
|
||||
var refs = (await _storage.GetNativeAlarmsAsync("inst", "Src")).Select(r => r.SourceReference).OrderBy(x => x).ToArray();
|
||||
Assert.Equal(new[] { "C", "D" }, refs);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that clearing an instance removes all of its sources and leaves other instances untouched.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user