5
5
"strings"
6
6
"testing"
7
7
8
+ "github.com/equinix/equinix-sdk-go/services/metalv1"
8
9
root "github.com/equinix/metal-cli/internal/cli"
9
10
outputPkg "github.com/equinix/metal-cli/internal/outputs"
10
11
"github.com/equinix/metal-cli/internal/vrf"
@@ -113,10 +114,6 @@ func TestCli_Vrf_Route(t *testing.T) {
113
114
},
114
115
want : & cobra.Command {},
115
116
cmdFunc : func (t * testing.T , c * cobra.Command ) {
116
- // Actually user have to wait for 5 min to updae the VRF-routes. This test case is skipped intentionally
117
- if true {
118
- t .Skip ("Skipping this test because someCondition is true" )
119
- }
120
117
root := c .Root ()
121
118
122
119
projName := "metal-cli-" + randName + "-vrf-list-test"
@@ -128,19 +125,19 @@ func TestCli_Vrf_Route(t *testing.T) {
128
125
129
126
ipReservation := helper .CreateTestVrfIpRequest (t , projectId .GetId (), vrf .GetId ())
130
127
_ = helper .CreateTestVrfGateway (t , projectId .GetId (), ipReservation .VrfIpReservation .GetId (), vlan .GetId ())
131
- _ = helper .CreateTestVrfRoute (t , vrf .GetId ())
128
+ route : = helper .CreateTestVrfRoute (t , vrf .GetId ())
132
129
133
- if vlan .GetId () != "" && vrf .GetId () != "" {
134
- root .SetArgs ([]string {subCommand , "update-route" , "-i" , vrf .GetId (), "-t" , "foobar" })
130
+ _ := helper .WaitForVrfRouteState (t , route .GetId (), metalv1 .VRFROUTESTATUS_ACTIVE )
135
131
136
- out := helper . ExecuteAndCaptureOutput ( t , root )
132
+ root . SetArgs ([] string { subCommand , "update-route" , "-i" , route . GetId (), "-t" , "foobar" } )
137
133
138
- if ! strings .Contains (string (out [:]), "TYPE" ) &&
139
- ! strings .Contains (string (out [:]), "static" ) &&
140
- ! strings .Contains (string (out [:]), "PREFIX" ) &&
141
- ! strings .Contains (string (out [:]), "0.0.0.0/0" ) {
142
- t .Error ("expected output should include TYPE static PREFIX and 0.0.0.0/0, in the out string " )
143
- }
134
+ out := helper .ExecuteAndCaptureOutput (t , root )
135
+
136
+ if ! strings .Contains (string (out [:]), "TYPE" ) &&
137
+ ! strings .Contains (string (out [:]), "static" ) &&
138
+ ! strings .Contains (string (out [:]), "PREFIX" ) &&
139
+ ! strings .Contains (string (out [:]), "0.0.0.0/0" ) {
140
+ t .Error ("expected output should include TYPE static PREFIX and 0.0.0.0/0, in the out string " )
144
141
}
145
142
}
146
143
},
0 commit comments