Skip to content

Commit

Permalink
Adding CLI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cardil committed Oct 4, 2019
1 parent 4b7323f commit 771914f
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Installer for Openshift Serverless
==================================

[![Build Status](https://travis-ci.com/wavesoftware/serverless-installer.svg?branch=master)](https://travis-ci.com/wavesoftware/serverless-installer)

Installer will create a usable installation of Openshift's Serverless Platform.

## Usage
Expand All @@ -13,4 +15,4 @@ This command will deploy a serverless platform on currently configured cluster.

```bash
serverless-installer script
```
```
4 changes: 4 additions & 0 deletions cmd/installer/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ func TestMain(t *testing.T) {

assert.Equal(t, 0, exitcode)
}

func TestExit(t *testing.T) {
exit(0)
}
19 changes: 19 additions & 0 deletions internal/cli/interactive/factory_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package interactive

import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/wavesoftware/serverless-installer/internal/domain/contract"
)

func TestCreate(t *testing.T) {
// given
answers := contract.LocationAwareAnswers{}

// when
screen := Create(&answers)

// then
assert.NotNil(t, screen)
}
3 changes: 1 addition & 2 deletions internal/cli/runner.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cli

import (
"fmt"
"os"

"github.com/mkideal/cli"
Expand Down Expand Up @@ -41,7 +40,7 @@ func (r runner) Run() int {
cli.Tree(help),
cli.Tree(deploy),
).Run(r.args[1:]); err != nil {
fmt.Fprintln(os.Stderr, err)
logrus.Fatalf("CLI system couldnt parse args: %v. Exiting!", err)
return 1
}
return 0
Expand Down
15 changes: 15 additions & 0 deletions internal/cli/runner_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package cli

import (
"testing"

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

func TestBasicRunnerFactory(t *testing.T) {
// when
runner := NewRunner()

// then
assert.NotNil(t, runner)
}
5 changes: 5 additions & 0 deletions internal/domain/contract/answers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ func TestStruct(t *testing.T) {
// then
assert.NotNil(t, answers)
}

func TestFilename(t *testing.T) {
// then
assert.NotEmpty(t, AnswersFilename)
}

0 comments on commit 771914f

Please sign in to comment.