Skip to content

Commit 91ec891

Browse files
author
Vaughn Dice
authored
Merge pull request #346 from vdice/updates-for-csdk-113
ref(*): adjust error message expectations
2 parents 0421594 + 91dda51 commit 91ec891

File tree

7 files changed

+20
-13
lines changed

7 files changed

+20
-13
lines changed

tests/apps_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var _ = Describe("deis apps", func() {
5353

5454
Specify("that user cannot get information about that app", func() {
5555
sess, err := cmd.Start("deis info -a %s", &user, bogusAppName)
56-
Eventually(sess.Err).Should(Say(util.PrependError(deis.ErrNotFound)))
56+
Eventually(sess.Err).Should(Say(util.PrependError(apps.ErrNoAppMatch)))
5757
Expect(err).NotTo(HaveOccurred())
5858
Eventually(sess).Should(Exit(1))
5959
})
@@ -67,15 +67,15 @@ var _ = Describe("deis apps", func() {
6767

6868
Specify("that user cannot open that app", func() {
6969
sess, err := cmd.Start("deis open -a %s", &user, bogusAppName)
70-
Eventually(sess.Err).Should(Say(util.PrependError(deis.ErrNotFound)))
70+
Eventually(sess.Err).Should(Say(util.PrependError(apps.ErrNoAppMatch)))
7171
Expect(err).NotTo(HaveOccurred())
7272
Eventually(sess).Should(Exit(1))
7373
})
7474

7575
Specify("that user cannot run a command in that app's environment", func() {
7676
sess, err := cmd.Start("deis apps:run -a %s echo Hello, 世界", &user, bogusAppName)
7777
Eventually(sess).Should(Say("Running 'echo Hello, 世界'..."))
78-
Eventually(sess.Err).Should(Say(util.PrependError(deis.ErrNotFound)))
78+
Eventually(sess.Err).Should(Say(util.PrependError(apps.ErrNoAppMatch)))
7979
Expect(err).NotTo(HaveOccurred())
8080
Eventually(sess).ShouldNot(Exit(0))
8181
})

tests/builds_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package tests
22

33
import (
4-
deis "github.com/deis/controller-sdk-go"
54
"github.com/deis/workflow-e2e/tests/cmd"
65
"github.com/deis/workflow-e2e/tests/cmd/apps"
76
"github.com/deis/workflow-e2e/tests/cmd/auth"
@@ -38,7 +37,7 @@ var _ = Describe("deis builds", func() {
3837

3938
Specify("that user cannot create a build for that app", func() {
4039
sess, err := cmd.Start("deis builds:create -a %s %s", &user, bogusAppName, builds.ExampleImage)
41-
Eventually(sess.Err).Should(Say(util.PrependError(deis.ErrNotFound)))
40+
Eventually(sess.Err).Should(Say(util.PrependError(apps.ErrNoAppMatch)))
4241
Expect(err).NotTo(HaveOccurred())
4342
Eventually(sess).Should(Exit(1))
4443
})

tests/certs_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ var _ = Describe("deis certs", func() {
7878

7979
Specify("that user cannot get info on a non-existent cert", func() {
8080
sess, err := cmd.Start("deis certs:info %s", &user, nonExistentCertName)
81-
Eventually(sess.Err).Should(Say(util.PrependError(deis.ErrNotFound)))
81+
Eventually(sess.Err).Should(Say(util.PrependError(certs.ErrNoCertMatch)))
8282
Expect(err).NotTo(HaveOccurred())
8383
Eventually(sess).Should(Exit(1))
8484
})
8585

8686
Specify("that user cannot remove a non-existent cert", func() {
8787
sess, err := cmd.Start("deis certs:remove %s", &user, nonExistentCertName)
88-
Eventually(sess.Err).Should(Say(util.PrependError(deis.ErrNotFound)))
88+
Eventually(sess.Err).Should(Say(util.PrependError(certs.ErrNoCertMatch)))
8989
Expect(err).NotTo(HaveOccurred())
9090
Eventually(sess).Should(Exit(1))
9191
})
@@ -117,14 +117,14 @@ var _ = Describe("deis certs", func() {
117117

118118
Specify("that user cannot attach a non-existent cert to that domain", func() {
119119
sess, err := cmd.Start("deis certs:attach %s %s", &user, nonExistentCertName, domain)
120-
Eventually(sess.Err).Should(Say(util.PrependError(deis.ErrNotFound)))
120+
Eventually(sess.Err).Should(Say(util.PrependError(certs.ErrNoCertMatch)))
121121
Expect(err).NotTo(HaveOccurred())
122122
Eventually(sess).Should(Exit(1))
123123
})
124124

125125
Specify("that user cannot detatch a non-existent cert from that domain", func() {
126126
sess, err := cmd.Start("deis certs:detach %s %s", &user, nonExistentCertName, domain)
127-
Eventually(sess.Err).Should(Say(util.PrependError(deis.ErrNotFound)))
127+
Eventually(sess.Err).Should(Say(util.PrependError(certs.ErrNoCertMatch)))
128128
Expect(err).NotTo(HaveOccurred())
129129
Eventually(sess).Should(Exit(1))
130130
})
@@ -147,14 +147,14 @@ var _ = Describe("deis certs", func() {
147147

148148
Specify("that user cannot attach a cert to a non-existent domain", func() {
149149
sess, err := cmd.Start("deis certs:attach %s %s", &user, cert.Name, nonExistentDomain)
150-
Eventually(sess.Err).Should(Say(util.PrependError(deis.ErrNotFound)))
150+
Eventually(sess.Err).Should(Say(util.PrependError(domains.ErrNoDomainMatch)))
151151
Expect(err).NotTo(HaveOccurred())
152152
Eventually(sess).Should(Exit(1))
153153
})
154154

155155
Specify("that user cannot detach a cert from a non-existent domain", func() {
156156
sess, err := cmd.Start("deis certs:detach %s %s", &user, cert.Name, nonExistentDomain)
157-
Eventually(sess.Err).Should(Say(util.PrependError(deis.ErrNotFound)))
157+
Eventually(sess.Err).Should(Say(util.PrependError(domains.ErrNoDomainMatch)))
158158
Expect(err).NotTo(HaveOccurred())
159159
Eventually(sess).Should(Exit(1))
160160
})

tests/cmd/apps/commands.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package apps
22

33
import (
4+
"errors"
45
"fmt"
56
"io/ioutil"
67
"os"
@@ -17,6 +18,8 @@ import (
1718
. "github.com/onsi/gomega/gexec"
1819
)
1920

21+
var ErrNoAppMatch = errors.New("\"No App matches the given query.\"")
22+
2023
// The functions in this file implement SUCCESS CASES for commonly used `deis apps` subcommands.
2124
// This allows each of these to be re-used easily in multiple contexts.
2225

tests/cmd/certs/commands.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package certs
22

33
import (
4+
"errors"
45
"fmt"
56

67
"github.com/deis/workflow-e2e/tests/cmd"
@@ -12,6 +13,8 @@ import (
1213
. "github.com/onsi/gomega/gexec"
1314
)
1415

16+
var ErrNoCertMatch = errors.New("\"No Certificate matches the given query.\"")
17+
1518
// The functions in this file implement SUCCESS CASES for commonly used `deis certs` subcommands.
1619
// This allows each of these to be re-used easily in multiple contexts.
1720

tests/cmd/domains/commands.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package domains
22

33
import (
4+
"errors"
45
"fmt"
56

67
"github.com/deis/workflow-e2e/tests/cmd"
@@ -12,6 +13,8 @@ import (
1213
. "github.com/onsi/gomega/gexec"
1314
)
1415

16+
var ErrNoDomainMatch = errors.New("\"No Domain matches the given query.\"")
17+
1518
// The functions in this file implement SUCCESS CASES for commonly used `deis domains` subcommands.
1619
// This allows each of these to be re-used easily in multiple contexts.
1720

tests/domains_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"net/http"
77
"strconv"
88

9-
deis "github.com/deis/controller-sdk-go"
109
"github.com/deis/workflow-e2e/tests/cmd"
1110
"github.com/deis/workflow-e2e/tests/cmd/apps"
1211
"github.com/deis/workflow-e2e/tests/cmd/auth"
@@ -67,7 +66,7 @@ var _ = Describe("deis domains", func() {
6766

6867
Specify("that user cannot remove a non-existent domain from that app", func() {
6968
sess, err := cmd.Start("deis domains:remove --app=%s %s", &user, app.Name, "non.existent.domain")
70-
Eventually(sess.Err, settings.MaxEventuallyTimeout).Should(Say(util.PrependError(deis.ErrNotFound)))
69+
Eventually(sess.Err, settings.MaxEventuallyTimeout).Should(Say(util.PrependError(domains.ErrNoDomainMatch)))
7170
Expect(err).NotTo(HaveOccurred())
7271
Eventually(sess).Should(Exit(1))
7372
})

0 commit comments

Comments
 (0)