Skip to content

Commit

Permalink
Fix testlab timeout limit exceeded (#12)
Browse files Browse the repository at this point in the history
* validate testlab timeout limit max

* reflect testlab timeout max value

* update description with most recent timeout value

* proper handling of max timeout

- precise validation based on google docs
- fallback instead of failure if value exceeds max

* cr fix: add unit of measurement to var name

* cr fix: misleading function name

* pr fix: sync description with official docs

* pr fix: trim 's' from test timeout

* fix: accept inputs ending in s

* tests for test timeut format validation

* clean up: revert unneeded changes

* make description very clear
  • Loading branch information
lszucs authored and godrei committed Aug 7, 2019
1 parent a30e4b8 commit ccc8b41
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ import (
"github.com/bitrise-tools/go-steputils/tools"
)

const (
maxTimeoutSeconds = 1800
)

// ConfigsModel ...
type ConfigsModel struct {
// api
Expand Down Expand Up @@ -215,8 +219,16 @@ func main() {
testModel.EnvironmentMatrix.IosDeviceList.IosDevices = append(testModel.EnvironmentMatrix.IosDeviceList.IosDevices, &newDevice)
}

timeout := configs.TestTimeout
if val, err := strconv.ParseFloat(timeout, 64); err != nil {
failf("could not parse float from timeout value (%s): %s", timeout, err)
} else if val > float64(maxTimeoutSeconds) {
log.Warnf("timeout value (%f) is greater than available maximum (%f). Maximum will be used instead.", val, maxTimeoutSeconds)
timeout = strconv.Itoa(maxTimeoutSeconds)
}

testModel.TestSpecification = &testing.TestSpecification{
TestTimeout: fmt.Sprintf("%ss", configs.TestTimeout),
TestTimeout: fmt.Sprintf("%ss", timeout),
}

testModel.TestSpecification.IosXcTest = &testing.IosXcTest{}
Expand Down
4 changes: 2 additions & 2 deletions step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ inputs:
category: "Debug"
title: "Test timeout"
summary: |
The max time this test execution can run before it is cancelled. It does not include any time necessary to prepare and clean up the target device. The maximum possible testing time is 3600 seconds.
Max time a test execution is allowed to run before it is automatically canceled. The default value is 900 (15 min). Duration in seconds with up to nine fractional digits. Example: "3.5".
description: |
The max time this test execution can run before it is cancelled. It does not include any time necessary to prepare and clean up the target device. The maximum possible testing time is 3600 seconds.
Max time a test execution is allowed to run before it is automatically canceled. The default value is 900 (15 min). Duration in seconds with up to nine fractional digits. Example: "3.5".
- download_test_results: "false"
opts:
category: "Debug"
Expand Down

0 comments on commit ccc8b41

Please sign in to comment.