@@ -25,6 +25,7 @@ import (
25
25
26
26
"github.com/mongodb/mongocli/e2e"
27
27
"github.com/stretchr/testify/assert"
28
+ "github.com/stretchr/testify/require"
28
29
atlas "go.mongodb.org/atlas/mongodbatlas"
29
30
)
30
31
@@ -85,10 +86,9 @@ func TestPrivateEndpointsDeprecated(t *testing.T) {
85
86
"-o=json" )
86
87
cmd .Env = os .Environ ()
87
88
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]` , "" )
90
89
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]` , "" )
92
92
var r atlas.PrivateEndpointConnectionDeprecated
93
93
if err = json .Unmarshal ([]byte (newResp ), & r ); a .NoError (err ) {
94
94
id = r .ID
@@ -126,7 +126,7 @@ func TestPrivateEndpointsDeprecated(t *testing.T) {
126
126
cmd .Env = os .Environ ()
127
127
resp , err := cmd .CombinedOutput ()
128
128
a := assert .New (t )
129
- a .NoError (err , string (resp ))
129
+ require .NoError (t , err , string (resp ))
130
130
newResp := strings .ReplaceAll (string (resp ), `Command "describe" is deprecated, Please use mongocli atlas privateEndpoints aws describe <ID> [--projectId projectId]` , "" )
131
131
var r atlas.PrivateEndpointConnectionDeprecated
132
132
if err = json .Unmarshal ([]byte (newResp ), & r ); a .NoError (err ) {
@@ -144,9 +144,9 @@ func TestPrivateEndpointsDeprecated(t *testing.T) {
144
144
"-o=json" )
145
145
cmd .Env = os .Environ ()
146
146
resp , err := cmd .CombinedOutput ()
147
+ require .NoError (t , err , string (resp ))
147
148
148
149
a := assert .New (t )
149
- a .NoError (err , string (resp ))
150
150
var r []atlas.PrivateEndpointConnectionDeprecated
151
151
newResp := strings .ReplaceAll (string (resp ), `Command "list" is deprecated, Please use mongocli atlas privateEndpoints aws list|ls [--projectId projectId]` , "" )
152
152
if err = json .Unmarshal ([]byte (newResp ), & r ); a .NoError (err ) {
@@ -166,8 +166,9 @@ func TestPrivateEndpointsDeprecated(t *testing.T) {
166
166
cmd .Env = os .Environ ()
167
167
168
168
resp , err := cmd .CombinedOutput ()
169
+ require .NoError (t , err , string (resp ))
170
+
169
171
a := assert .New (t )
170
- a .NoError (err , string (resp ))
171
172
expected := fmt .Sprintf ("Private endpoint '%s' deleted\n " , id )
172
173
a .Contains (string (resp ), expected )
173
174
})
0 commit comments