cancel context for each scenario (#514)

* fix(deps): update module github.com/cucumber/gherkin/go/v26 to v26.1.0 (#549)

* Update CI for go1.20 (#552)

* fix(deps): update module github.com/cucumber/gherkin/go/v26 to v26.1.0

* Tidy modules

---------

Co-authored-by: Viacheslav Poturaev <vearutop@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* cancel context for each scenario

* Update suite.go

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Viacheslav Poturaev <vearutop@gmail.com>
Co-authored-by: Viacheslav Poturaev <nanopeni@gmail.com>
Этот коммит содержится в:
Dragan Milic 2023-04-04 01:28:03 +02:00 коммит произвёл GitHub
родитель 472ea2735d
коммит 0dcbfef9be
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -14,6 +14,7 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
## [v0.12.6]
### Changed
- Each scenario is run with a cancellable `context.Context` which is cancelled at the end of the scenario. ([514](https://github.com/cucumber/godog/pull/514) - [draganm](https://github.com/draganm))
- README example is updated with `context.Context` and `go test` usage. ([477](https://github.com/cucumber/godog/pull/477) - [vearutop](https://github.com/vearutop))
- Removed deprecation of `godog.BindFlags`. ([498](https://github.com/cucumber/godog/pull/498) - [vearutop](https://github.com/vearutop))
- Pretty Print when using rules. ([480](https://github.com/cucumber/godog/pull/480) - [dumpsterfireproject](https://github.com/dumpsterfireproject))

Просмотреть файл

@ -447,6 +447,10 @@ func (s *suite) runPickle(pickle *messages.Pickle) (err error) {
ctx = context.Background()
}
ctx, cancel := context.WithCancel(ctx)
defer cancel()
if len(pickle.Steps) == 0 {
pr := models.PickleResult{PickleID: pickle.Id, StartedAt: utils.TimeNowFunc()}
s.storage.MustInsertPickleResult(pr)