1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-11-24 07:04:51 +02:00

[#7267] added tests.ApiScenario.DisableTestAppCleanup optional field

This commit is contained in:
Gani Georgiev
2025-10-23 11:12:00 +03:00
parent 5a8eae7089
commit 7b52d0b56a
2 changed files with 16 additions and 2 deletions

View File

@@ -1,9 +1,11 @@
## v0.30.5 (WIP)
## v0.31.0 (WIP)
- Visualize presentable multiple `relation` fields ([#7260](https://github.com/pocketbase/pocketbase/issues/7260)).
- Support Ed25519 in the optional OIDC id_token signature validation ([#7252](https://github.com/pocketbase/pocketbase/issues/7252); thanks @shynome).
- Added `tests.ApiScenario.DisableTestAppCleanup` optional field to skip the auto test app cleanup and leave it up to the developers ([#7267](https://github.com/pocketbase/pocketbase/discussions/7267)).
## v0.30.4

View File

@@ -48,6 +48,14 @@ type ApiScenario struct {
// A zero or negative value means that there will be no timeout.
Timeout time.Duration
// DisableTestAppCleanup disables the builtin TestApp cleanup at
// the end of the ApiScenario execution.
//
// This option works only when explicit TestAppFactory is specified
// and means that the developer is responsible to do the necessary
// after test cleanup on their own (e.g. by manually calling testApp.Cleanup()).
DisableTestAppCleanup bool
// expectations
// ---------------------------------------------------------------
@@ -172,7 +180,11 @@ func (scenario *ApiScenario) test(t testing.TB) {
t.Fatalf("Failed to initialize the test app instance: %v", testAppErr)
}
}
// https://github.com/pocketbase/pocketbase/discussions/7267
if scenario.TestAppFactory == nil || !scenario.DisableTestAppCleanup {
defer testApp.Cleanup()
}
baseRouter, err := apis.NewRouter(testApp)
if err != nil {