fix: allow 10 seconds to shutdown, fixing shutdown error (#204)
* Allow 15 seconds to shut down v2.0.0 and above crashes with message "Error during shutdowncontext deadline exceeded" and exit code 1 upon SIGINT being received. v1.2.1 seems to be unaffected. * Add bats test * Reduce to 10 seconds, define directly Co-Authored-By: andytson-inviqa <andytson-inviqa@users.noreply.github.com> * style: gofmt -s * chore: bump golang to 1.17 and fix golangci Co-authored-by: andytson-inviqa <andytson-inviqa@users.noreply.github.com> Co-authored-by: Enrico Stahn <enrico.stahn@gmail.com>
This commit is contained in:
parent
98e0072b39
commit
ea4a929fa9
4 changed files with 8 additions and 3 deletions
2
Makefile
2
Makefile
|
@ -20,7 +20,7 @@ test-coverage-html: ## Create a code coverage report in HTML
|
|||
go tool cover -html .cover/cover.out
|
||||
|
||||
test-e2e:
|
||||
bats tests/e2e.bats
|
||||
bats test/e2e.bats
|
||||
|
||||
lint: ## Run linters
|
||||
golangci-lint run
|
||||
|
|
|
@ -200,7 +200,7 @@ brew install docker-compose bats-core kaos/shell/bats-assert kaos/shell/bats-sup
|
|||
After the components are installed run the E2E tests:
|
||||
|
||||
```bash
|
||||
make tests-e2e
|
||||
make test-e2e
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
|
|
@ -102,7 +102,7 @@ to quickly create a Cobra application.`,
|
|||
<-c
|
||||
|
||||
// Create a deadline to wait for.
|
||||
var wait time.Duration
|
||||
wait := time.Second * 10
|
||||
ctx, cancel := context.WithTimeout(context.Background(), wait)
|
||||
defer cancel()
|
||||
// Doesn't block if no connections, but will otherwise wait
|
||||
|
|
|
@ -32,3 +32,8 @@ teardown() {
|
|||
assert_output --partial 'phpfpm_up{pool="www",scrape_uri="tcp://phpfpm2:9000/status"} 1'
|
||||
assert_output --partial 'phpfpm_up{pool="www",scrape_uri="tcp://phpfpm3:9000/status"} 1'
|
||||
}
|
||||
|
||||
@test "Should exit cleanly" {
|
||||
run docker-compose -f ./test/docker-compose-e2e.yml stop exporter
|
||||
docker-compose -f ./test/docker-compose-e2e.yml ps exporter | grep -q "Exit 0"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue