Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templating for generating random ports (part 2) #445

Merged
merged 1 commit into from
Nov 15, 2016

Conversation

JosephGJ
Copy link
Contributor

@JosephGJ JosephGJ commented Nov 9, 2016

PR #441 merged before necessary changes made.

Changes:

  • time.Since() function used
  • templating errors returns
  • return statement edited

to test
go test -v ./cmd/amp/cli

for testing timing changes, modify stack.yml first command amp stack up to a failing case, as it can test the retry and timeout fields, then run.
go test -v ./cmd/amp/cli

endTime := time.Now().UnixNano() / 1000000
if cmdSpec.Timeout != 0 && endTime-startTime >= cmdSpec.Timeout {
endTime := time.Since(startTime)
if cmdSpec.Timeout != 0 && int64(endTime/time.Millisecond) >= cmdSpec.Timeout {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See this example on how to use a channel for executing code after a timeout to kill the process and synchronize on the success or failure path before returning.

@@ -117,16 +117,15 @@ func runTestSpec(t *testing.T, test *TestSpec) (err error) {

for _, cmdSpec := range test.Commands {
var tmplString []string
startTime := time.Now().UnixNano() / 1000000
startTime := time.Now()

for i = -1; i < cmdSpec.Retry; i++ {
err = nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can move err to the loop initializer (if you really need it).

@JosephGJ JosephGJ force-pushed the cli-test-port-randomiser branch 2 times, most recently from 56c36a8 to 2333d89 Compare November 14, 2016 18:52
* Implementation of contexts for timeouts

* Refactoring to include #451 changes
@JosephGJ JosephGJ force-pushed the cli-test-port-randomiser branch from 2333d89 to 6b17753 Compare November 14, 2016 22:17
@bquenin bquenin merged commit 35d7ef9 into master Nov 15, 2016
@bquenin bquenin deleted the cli-test-port-randomiser branch November 15, 2016 13:19
@ndegory ndegory changed the title Requested Changes from PR #441 Templating for generating random ports (part 2) Dec 12, 2016
@ndegory ndegory added this to the 0.4.0 milestone Dec 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants