private/testplanet: configurable timeout

Testplanet limits the execution of a single test case to 3 minutes.

This change adds a Timeout field to the Testplanet's config, so test
cases can configure their timeout. This is helpful when executing larger
3rd party test suite on top of Testplanet.

Change-Id: Ibbf7c5ffdc0a9e723e7e28b885eac084f04c6ca1
This commit is contained in:
Kaloyan Raev 2022-04-11 14:16:47 +03:00
parent 99ec4c8869
commit de6852510f
2 changed files with 6 additions and 1 deletions

View File

@ -63,6 +63,7 @@ type Config struct {
Name string
Host string
NonParallel bool
Timeout time.Duration
}
// DatabaseConfig defines connection strings for database.

View File

@ -46,7 +46,11 @@ func Run(t *testing.T, config Config, test func(t *testing.T, ctx *testcontext.C
defer pprof.SetGoroutineLabels(parent)
parent = pprof.WithLabels(parent, pprof.Labels("test", t.Name()))
ctx := testcontext.NewWithContext(parent, t)
timeout := config.Timeout
if timeout == 0 {
timeout = testcontext.DefaultTimeout
}
ctx := testcontext.NewWithContextAndTimeout(parent, t, timeout)
defer ctx.Cleanup()
planet, err := NewCustom(ctx, log, planetConfig, satelliteDB)