test: pin scan_extractor_version at the start of ev-sensitive tests
Release / build-and-push (push) Successful in 3m20s
Release / build-and-push (push) Successful in 3m20s
The extractor/force-rescan tests assert manifest stamps against the default version (1), but the setting lives in the SHARED dev DB — any prior run (or a manual admin-UI bump) can leave it at 2, failing every stamp assertion through no fault of the code. Each ev-sensitive test now pins the setting to 1 at start and restores 1 on cleanup; proven against a deliberately bumped setting (tests pass, row restored).
This commit is contained in:
1 parent
a42c6d4f75
commit
dd4cf1235c
2 files changed
+15
No files matched your search
@@ -74,6 +74,7 @@ func TestExtractorVersionReextract(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
admin, _ := moveTestAdminID(t, setup)
|
||||
pinExtractorVersionOne(t, setup)
|
||||
libID, folder := createTypedTestLibrary(t, setup, fmt.Sprintf("Test EV Library %d", time.Now().UnixNano()), "ebooks")
|
||||
t.Cleanup(func() { deleteLibraries(t, setup, libID) })
|
||||
|
||||
@@ -142,6 +143,7 @@ func TestExtractorVersionMultifile(t *testing.T) {
|
||||
t.Cleanup(func() { _ = setup.Close() })
|
||||
|
||||
admin, _ := moveTestAdminID(t, setup)
|
||||
pinExtractorVersionOne(t, setup)
|
||||
libID, folder := audioTestLibrary(t, setup, fmt.Sprintf("Test EV Audio %d", time.Now().UnixNano()))
|
||||
t.Cleanup(func() { deleteLibraries(t, setup, libID) })
|
||||
|
||||
|
||||
@@ -28,6 +28,17 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// pinExtractorVersionOne pins the SHARED dev DB's extractor version to
|
||||
// the default 1 for the test's duration. Prior interrupted runs can
|
||||
// leave it bumped (an early test failure aborts before its restore
|
||||
// cleanup registers), and every stamp assertion in these tests assumes
|
||||
// the default. The cleanup restores 1 — the repo's steady state.
|
||||
func pinExtractorVersionOne(t *testing.T, setup *TestServerSetup) {
|
||||
t.Helper()
|
||||
setExtractorVersion(t, setup, 1)
|
||||
t.Cleanup(func() { setExtractorVersion(t, setup, 1) })
|
||||
}
|
||||
|
||||
// forceScanTestFolder runs a FORCE scan over one folder.
|
||||
func forceScanTestFolder(t *testing.T, setup *TestServerSetup, adminID pgtype.UUID, folder string) {
|
||||
t.Helper()
|
||||
@@ -45,6 +56,7 @@ func TestForceRescanMultifileSidecarApply(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
admin, _ := moveTestAdminID(t, setup)
|
||||
pinExtractorVersionOne(t, setup)
|
||||
libID, folder := audioTestLibrary(t, setup, fmt.Sprintf("Test Force Rescan %d", time.Now().UnixNano()))
|
||||
t.Cleanup(func() { deleteLibraries(t, setup, libID) })
|
||||
|
||||
@@ -82,6 +94,7 @@ func TestForceRescanSingleFileSidecarReapply(t *testing.T) {
|
||||
t.Cleanup(func() { _ = setup.Close() })
|
||||
|
||||
admin, _ := moveTestAdminID(t, setup)
|
||||
pinExtractorVersionOne(t, setup)
|
||||
libID, folder := createTypedTestLibrary(t, setup, fmt.Sprintf("Test Force Single %d", time.Now().UnixNano()), "ebooks")
|
||||
t.Cleanup(func() { deleteLibraries(t, setup, libID) })
|
||||
|
||||
|
||||
Reference in new issue
Block a user