Skip to content

Commit

Permalink
Merge pull request #174 from dexhorthy/fixtest
Browse files Browse the repository at this point in the history
fix tests
  • Loading branch information
dexhorthy authored Apr 6, 2021
2 parents 52b0c65 + 0033166 commit 50baa59
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions cli/test/kots_app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,31 +93,11 @@ var _ = Describe("kots apps", func() {
req.NotEmpty(stdout.String(), "Expected stdout output")

req.Equal(stdout.String(),
`ID NAME SCHEDULER
`+ app.ID +` ` + app.Name + ` kots
`ID NAME SLUG SCHEDULER
`+ app.ID +` ` + app.Name + ` ` + app.Slug + ` kots
`)
})
})
Context("replicated app create", func() {
It("should create an app", func() {
newName := mustToken(8)
var stdout bytes.Buffer
var stderr bytes.Buffer

rootCmd := cmd.GetRootCmd()
rootCmd.SetArgs([]string{"app", "create", newName})

err = cmd.Execute(rootCmd, nil, &stdout, &stderr)
req.NoError(err)

req.Empty(stderr.String(), "Expected no stderr output")
req.NotEmpty(stdout.String(), "Expected stdout output")

req.Contains(stdout.String(), app.ID)
req.Contains(stdout.String(), app.Name)
req.Contains(stdout.String(), "kots")
})
})

Context("replicated app delete", func() {
It("should delete an app", func() {
Expand All @@ -131,9 +111,16 @@ var _ = Describe("kots apps", func() {
rootCmd.SetArgs([]string{"app", "create", newName})
err = cmd.Execute(rootCmd, nil, &stdout, &stderr)
req.NoError(err)
req.Empty(stderr.String(), "Expected no stderr output")
req.NotEmpty(stdout.String(), "Expected stdout output")

appSlug := strings.ToLower(newName) // maybe?

req.Contains(stdout.String(), newName)
req.Contains(stdout.String(), appSlug)
req.Contains(stdout.String(), "kots")


stdout.Truncate(0)
rootCmd = cmd.GetRootCmd()
rootCmd.SetArgs([]string{"app", "delete", appSlug, "--force"})
Expand Down

0 comments on commit 50baa59

Please sign in to comment.