-
Notifications
You must be signed in to change notification settings - Fork 28
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
Refactor CLI tests #386
Refactor CLI tests #386
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Tested ok, expected already bad tests
for _, cmdSpec := range commandMap { | ||
cmdString := generateCmdString(cmdSpec) | ||
t.Log(cmdString, "Command passed.") | ||
for i := 0; i < 10; i++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally used a small loop to iterate over the command 10 times. The service create command does not block until the service is built in the swarm.
Tests are currently failing due to this.
--- FAIL: TestCmds (0.22s)
cli_test.go:46: -----------------------------------------------------------------------------------------
cli_test.go:47: Running spec: test_samples/logs-all.yml
cli_test.go:97: Running: amp logs
cli_test.go:46: -----------------------------------------------------------------------------------------
cli_test.go:47: Running spec: test_samples/logs-metadata.yml
cli_test.go:97: Running: amp logs -m
cli_test.go:46: -----------------------------------------------------------------------------------------
cli_test.go:47: Running spec: test_samples/logs-numbered.yml
cli_test.go:97: Running: amp logs -n 10
cli_test.go:46: -----------------------------------------------------------------------------------------
cli_test.go:47: Running spec: test_samples/logs-stack.yml
cli_test.go:97: Running: amp logs --stack stack1
cli_test.go:46: -----------------------------------------------------------------------------------------
cli_test.go:47: Running spec: test_samples/service-create.yml
cli_test.go:97: Running: amp service create appcelerator/pinger --name pinger -p www:90:3000
cli_test.go:46: -----------------------------------------------------------------------------------------
cli_test.go:47: Running spec: test_samples/service-curl.yml
cli_test.go:97: Running: curl localhost:90/ping
cli_test.go:49: miss matched expected output: % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 90: Connection refused
FAIL
exit status 1
FAIL github.com/appcelerator/amp/cmd/amp/cli 0.813s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing a service creation should probably be in a single test spec (not 2 as it is today), and waiting for the service to be up, included in this test spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Related to #370
Note that the tests are not working as they were not working already. I just made some changes to be able to fix them in a subsequent PR.
Verification