You've already forked pocketbase
mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-11-23 22:55:37 +02:00
[#7267] added tests.ApiScenario.DisableTestAppCleanup optional field
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
14
tests/api.go
14
tests/api.go
@@ -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)
|
||||
}
|
||||
}
|
||||
defer testApp.Cleanup()
|
||||
|
||||
// https://github.com/pocketbase/pocketbase/discussions/7267
|
||||
if scenario.TestAppFactory == nil || !scenario.DisableTestAppCleanup {
|
||||
defer testApp.Cleanup()
|
||||
}
|
||||
|
||||
baseRouter, err := apis.NewRouter(testApp)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user