You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Restore-DbaDatabase - Stop escaping the caller and resurrect the StopAt tests
Two Stop-Function calls in the end block carried -Continue although no
loop encloses them. When a restore or its verification failed without
-EnableException, the continue unwound out of the command and consumed
an iteration of whatever loop the caller was running in - a caller
restoring in a foreach silently skipped their next instance, and under
Pester it corrupted the test runner, surfacing as "Cannot bind argument
to parameter ErrorRecord because it is null". That crash is what kept
the StopAt tests undiagnosable since 2020. Both sites now stop and
return.
The StopAt tests themselves were skipped because their static fixture
was broken from its first commit - StopAt_22.trn never made it into the
appveyor-lab repo. They now generate their own chain in BeforeAll: two
transactions named dbatoolstest carry marks, with a timestamp captured
between them, and the assertions follow the layout of the generated
steps table instead of magic values. Two traps encoded in comments:
STOPATMARK references the transaction name, not the WITH MARK
description, and a mark in the last log file recovers the database in
the same statement, so no separate -Recover may follow.
Verified via the lab harness on SQL03\SQL2019: 81 tests, 77 passed,
0 failed, 3 skipped (the Azure contexts), no warnings. Before the
flow-control fix the same file aborted the whole Pester run with the
null-ErrorRecord crash.
(do Restore-DbaDatabase)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The next tests are skipped because they don't work as expected.
879
-
In "$($TestConfig.appveyorlabrepo)\sql2008-backups\StopAt" the backup chain is maybe broken (is file StopAt_22.trn missing?)
880
-
Restore-DbaDatabase writes a warning: Microsoft.Data.SqlClient.SqlError: The log in this backup set begins at LSN 19000000021500001, which is too recent to apply to the database. An earlier log backup that includes LSN 19000000020400004 can be restored.
881
-
Pester does not like this warning, reason currently unknown. But the context and the complete test fail with "System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'ErrorRecord' because it is null".
882
-
Maybe it's because the warning is written to $error but has no ErrorRecord.
883
-
#>
884
-
885
-
Context -Skip "Test restoring with StopAt" {
876
+
Context "Test restoring with StopMark, StopBefore, StopAfterDate and StopAtLsn" {
0 commit comments