Skip to content

Commit 0f7699e

Browse files
committed
tests: small e2e test improvement
1 parent 535a60b commit 0f7699e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

e2e/atlas/private_endpoint_deprecated_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525

2626
"github.com/mongodb/mongocli/e2e"
2727
"github.com/stretchr/testify/assert"
28+
"github.com/stretchr/testify/require"
2829
atlas "go.mongodb.org/atlas/mongodbatlas"
2930
)
3031

@@ -85,10 +86,9 @@ func TestPrivateEndpointsDeprecated(t *testing.T) {
8586
"-o=json")
8687
cmd.Env = os.Environ()
8788
resp, err := cmd.CombinedOutput()
88-
89-
newResp := strings.ReplaceAll(string(resp), `Command "create" is deprecated, Please use mongocli atlas privateEndpoints aws create [--region region] [--projectId projectId]`, "")
9089
a := assert.New(t)
91-
if a.NoError(err, resp) {
90+
if a.NoError(err, string(resp)) {
91+
newResp := strings.ReplaceAll(string(resp), `Command "create" is deprecated, Please use mongocli atlas privateEndpoints aws create [--region region] [--projectId projectId]`, "")
9292
var r atlas.PrivateEndpointConnectionDeprecated
9393
if err = json.Unmarshal([]byte(newResp), &r); a.NoError(err) {
9494
id = r.ID
@@ -126,7 +126,7 @@ func TestPrivateEndpointsDeprecated(t *testing.T) {
126126
cmd.Env = os.Environ()
127127
resp, err := cmd.CombinedOutput()
128128
a := assert.New(t)
129-
a.NoError(err, string(resp))
129+
require.NoError(t, err, string(resp))
130130
newResp := strings.ReplaceAll(string(resp), `Command "describe" is deprecated, Please use mongocli atlas privateEndpoints aws describe <ID> [--projectId projectId]`, "")
131131
var r atlas.PrivateEndpointConnectionDeprecated
132132
if err = json.Unmarshal([]byte(newResp), &r); a.NoError(err) {
@@ -144,9 +144,9 @@ func TestPrivateEndpointsDeprecated(t *testing.T) {
144144
"-o=json")
145145
cmd.Env = os.Environ()
146146
resp, err := cmd.CombinedOutput()
147+
require.NoError(t, err, string(resp))
147148

148149
a := assert.New(t)
149-
a.NoError(err, string(resp))
150150
var r []atlas.PrivateEndpointConnectionDeprecated
151151
newResp := strings.ReplaceAll(string(resp), `Command "list" is deprecated, Please use mongocli atlas privateEndpoints aws list|ls [--projectId projectId]`, "")
152152
if err = json.Unmarshal([]byte(newResp), &r); a.NoError(err) {
@@ -166,8 +166,9 @@ func TestPrivateEndpointsDeprecated(t *testing.T) {
166166
cmd.Env = os.Environ()
167167

168168
resp, err := cmd.CombinedOutput()
169+
require.NoError(t, err, string(resp))
170+
169171
a := assert.New(t)
170-
a.NoError(err, string(resp))
171172
expected := fmt.Sprintf("Private endpoint '%s' deleted\n", id)
172173
a.Contains(string(resp), expected)
173174
})

0 commit comments

Comments
 (0)