@@ -3,14 +3,16 @@ package test
33import (
44 "bytes"
55 "fmt"
6+ "io/ioutil"
7+ "os"
8+ "strings"
9+
610 . "github.com/onsi/ginkgo"
711 "github.com/replicatedhq/replicated/cli/cmd"
812 "github.com/replicatedhq/replicated/pkg/kotsclient"
913 "github.com/replicatedhq/replicated/pkg/platformclient"
14+ "github.com/replicatedhq/replicated/pkg/types"
1015 "github.com/stretchr/testify/assert"
11- "io/ioutil"
12- "os"
13- "strings"
1416)
1517
1618var _ = Describe ("kots apps" , func () {
@@ -21,9 +23,8 @@ var _ = Describe("kots apps", func() {
2123
2224 httpClient := platformclient .NewHTTPClient (params .APIOrigin , params .APIToken )
2325 kotsRestClient := kotsclient.VendorV3Client {HTTPClient : * httpClient }
24- kotsGraphqlClient := kotsclient .NewGraphQLClient (params .GraphqlOrigin , params .APIToken , params .KurlOrigin )
2526
26- var app * kotsclient. KotsApp
27+ var app * types. KotsAppWithChannels
2728 var tmpdir string
2829
2930 BeforeEach (func () {
@@ -36,7 +37,7 @@ var _ = Describe("kots apps", func() {
3637 })
3738
3839 AfterEach (func () {
39- err := kotsGraphqlClient .DeleteKOTSApp (app .ID )
40+ err := kotsRestClient .DeleteKOTSApp (app .Id )
4041 req .NoError (err )
4142 err = os .RemoveAll (tmpdir )
4243 req .NoError (err )
@@ -73,7 +74,7 @@ var _ = Describe("kots apps", func() {
7374 req .Empty (stderr .String (), "Expected no stderr output" )
7475 req .NotEmpty (stdout .String (), "Expected stdout output" )
7576
76- req .Contains (stdout .String (), app .ID )
77+ req .Contains (stdout .String (), app .Id )
7778 req .Contains (stdout .String (), app .Name )
7879 req .Contains (stdout .String (), "kots" )
7980 })
@@ -93,15 +94,16 @@ var _ = Describe("kots apps", func() {
9394 req .NotEmpty (stdout .String (), "Expected stdout output" )
9495
9596 req .Equal (stdout .String (),
96- `ID NAME SLUG SCHEDULER
97- ` + app .ID + ` ` + app .Name + ` ` + app .Slug + ` kots
97+ `ID NAME SLUG SCHEDULER
98+ ` + app .Id + ` ` + app .Name + ` ` + app .Slug + ` kots
9899` )
99100 })
100101 })
101102
102103 Context ("replicated app delete" , func () {
103104 It ("should delete an app" , func () {
104105 newName := mustToken (8 )
106+ // this test is fragile - if the first character ends up as - , it assumes the token is a flag and fails
105107 newName = strings .ReplaceAll (newName , "_" , "-" )
106108 newName = strings .ReplaceAll (newName , "=" , "-" )
107109 var stdout bytes.Buffer
@@ -120,7 +122,6 @@ var _ = Describe("kots apps", func() {
120122 req .Contains (stdout .String (), appSlug )
121123 req .Contains (stdout .String (), "kots" )
122124
123-
124125 stdout .Truncate (0 )
125126 rootCmd = cmd .GetRootCmd ()
126127 rootCmd .SetArgs ([]string {"app" , "delete" , appSlug , "--force" })
@@ -138,7 +139,7 @@ var _ = Describe("kots apps", func() {
138139
139140 req .NotContains (stdout .String (), appSlug )
140141 req .Equal (stdout .String (),
141- `ID NAME SLUG SCHEDULER
142+ `ID NAME SLUG SCHEDULER
142143` )
143144 })
144145 })
0 commit comments