diff --git a/.editorconfig b/.editorconfig index aa4cc94..ca0c051 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,4 +9,8 @@ end_of_line = lf insert_final_newline = true charset = utf-8 indent_style = tab -indent_size = 2 \ No newline at end of file +indent_size = 2 + +[{*.yml, *.yaml}] +indent_style = space +indent_size = 2 diff --git a/.travis.yml b/.travis.yml index 90963c4..9ccb723 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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=" diff --git a/cmd/installer/main.go b/cmd/installer/main.go index 3b225a4..4d39a7e 100644 --- a/cmd/installer/main.go +++ b/cmd/installer/main.go @@ -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()) } diff --git a/cmd/installer/main_test.go b/cmd/installer/main_test.go new file mode 100644 index 0000000..00203fe --- /dev/null +++ b/cmd/installer/main_test.go @@ -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) +}