NewEnvironment creates a new repository testing environment and ensures its cleanup at the end of the test.
(tb testing.TB, version format.Version, opts ...Options)
| 263 | |
| 264 | // NewEnvironment creates a new repository testing environment and ensures its cleanup at the end of the test. |
| 265 | func NewEnvironment(tb testing.TB, version format.Version, opts ...Options) (context.Context, *Environment) { |
| 266 | tb.Helper() |
| 267 | |
| 268 | ctx := testlogging.Context(tb) |
| 269 | |
| 270 | var env Environment |
| 271 | |
| 272 | env.setup(tb, version, opts...) |
| 273 | |
| 274 | tb.Cleanup(func() { |
| 275 | env.Close(ctx, tb) |
| 276 | }) |
| 277 | |
| 278 | return ctx, &env |
| 279 | } |