Skip to content

Commit

Permalink
Adding test to main
Browse files Browse the repository at this point in the history
  • Loading branch information
cardil committed Oct 4, 2019
1 parent 5723c58 commit f616a43
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = tab
indent_size = 2
indent_size = 2

[{*.yml, *.yaml}]
indent_style = space
indent_size = 2
15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
---
language: go
sudo: false
dist: trusty
go:
- 1.13.x
- 1.13.x
script:
- make clean binary
- sonar-scanner
- make clean binary
- sonar-scanner
branches:
only:
- master
- develop
- "/^v\\d/"
- master
- develop
- "/^v\\d/"
notifications:
email: onchange
addons:
sonarcloud:
organization: "wavesoftware"
token:
secure: "V+dI4AgutA5XbYXgXnf1pbgG49dZE34Yz5FlM5OjMNKCagMhM3C/t0bYJrM02GUw5oI29c3APgh0TbVLKQTUL/WOSMkRli2IikUaX6gJNI1ClL/AsikaCwvIWEqDUqoKMS27T1Un4ipXbeeEkjrDVbew8C1zBYEJvDQY463GiAy/kwQ/llL40wBttmy1Wflags12sjKBfxVPmmyO8BbOeu/zYca9g48EOD0xcQVGVRvZqoOP3SwXETaU0+7F2pKd3qZbjnbpH+aJL6hI+UIAQB3iv2vWTHscMczilRmPRO7vueBC1SB41X42fG1LqQJ0vkxgMSVKftatGykrmJcrNWubK2bpczRF4sf9RhdugkE3pPR5KnstHl0VVSII4IFsQnkgPTl+2PFdPW8qxdiW4p9YI1S3iYydO3POqBcksbOj+QTbkSAxy5z6DnOoVUMZnEUAIVnyP/hfzSMTr8Q8YgFdZuuZcUMzo04Fr1ZJhboOFCo6ZMx+WcOlRd56u1KVohwhQ/gu7TalbKUMfoLwsRwNaCRiXXAmum94NLHIDK50PQwnA3DJc4JznZIVqY4SllSdWjA0fCLgSGD6rU7p9XC8/7DLyrzc1hEsKgf7UYi5bxwUPZAmH6M33XM0EaKeaZaeCtD5y5ITpg2Q0H1qeJUx/0kbWT69J2H6BYPjLUA="
secure: "V+dI4AgutA5XbYXgXnf1pbgG49dZE34Yz5FlM5OjMNKCagMhM3C/t0bYJrM02GUw5oI29c3APgh0TbVLKQTUL/WOSMkRli2IikUaX6gJNI1ClL/AsikaCwvIWEqDUqoKMS27T1Un4ipXbeeEkjrDVbew8C1zBYEJvDQY463GiAy/kwQ/llL40wBttmy1Wflags12sjKBfxVPmmyO8BbOeu/zYca9g48EOD0xcQVGVRvZqoOP3SwXETaU0+7F2pKd3qZbjnbpH+aJL6hI+UIAQB3iv2vWTHscMczilRmPRO7vueBC1SB41X42fG1LqQJ0vkxgMSVKftatGykrmJcrNWubK2bpczRF4sf9RhdugkE3pPR5KnstHl0VVSII4IFsQnkgPTl+2PFdPW8qxdiW4p9YI1S3iYydO3POqBcksbOj+QTbkSAxy5z6DnOoVUMZnEUAIVnyP/hfzSMTr8Q8YgFdZuuZcUMzo04Fr1ZJhboOFCo6ZMx+WcOlRd56u1KVohwhQ/gu7TalbKUMfoLwsRwNaCRiXXAmum94NLHIDK50PQwnA3DJc4JznZIVqY4SllSdWjA0fCLgSGD6rU7p9XC8/7DLyrzc1hEsKgf7UYi5bxwUPZAmH6M33XM0EaKeaZaeCtD5y5ITpg2Q0H1qeJUx/0kbWT69J2H6BYPjLUA="

6 changes: 5 additions & 1 deletion cmd/installer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import (
"github.com/wavesoftware/serverless-installer/internal/cli"
)

var exit func(int) = func(exitcode int) {
os.Exit(exitcode)
}

func main() {
os.Exit(cli.NewRunner().Run())
exit(cli.NewRunner().Run())
}
28 changes: 28 additions & 0 deletions cmd/installer/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"os"
"testing"

"github.com/stretchr/testify/assert"
)

func TestMain(t *testing.T) {
// given
oldExit := exit
oldArgs := os.Args
defer func() {
exit = oldExit
os.Args = oldArgs
}()
exitcode := ^int(0)
exit = func(received int) {
exitcode = received
}
os.Args = []string{"cmd", "--help"}

// when
main()

assert.Equal(t, 0, exitcode)
}

0 comments on commit f616a43

Please sign in to comment.