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

Refactor CLI tests #386

Merged
merged 1 commit into from
Oct 27, 2016
Merged

Refactor CLI tests #386

merged 1 commit into from
Oct 27, 2016

Conversation

bquenin
Copy link
Contributor

@bquenin bquenin commented Oct 26, 2016

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

$ ./swarm start
$ go test -v github.com/appcelerator/amp/cmd/amp/cli

Copy link
Contributor

@freignat91 freignat91 left a 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++ {
Copy link
Contributor

@JosephGJ JosephGJ Oct 26, 2016

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 

Copy link
Contributor Author

@bquenin bquenin Oct 27, 2016

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.

Copy link
Contributor

@subfuzion subfuzion left a comment

Choose a reason for hiding this comment

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

LGTM

@subfuzion subfuzion merged commit 01fb22a into master Oct 27, 2016
@subfuzion subfuzion deleted the cli-test-refactoring branch October 27, 2016 21:29
@subfuzion subfuzion added this to the 0.3.0 milestone Oct 29, 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.

4 participants