@@ -20,7 +20,8 @@ func TestStop_WhenVMRunning_ThenShouldStopVirtualMachine(t *testing.T) {
2020 _ , err := crcConfigStorage .Set (crcConfig .NetworkMode , "true" )
2121 assert .NoError (t , err )
2222 virtualMachine := fakemachine .NewFakeVirtualMachine (false , false )
23- client := newClientWithVirtualMachine ("fake-virtual-machine" , false , crcConfigStorage , virtualMachine )
23+ fakeVSock := fakemachine .NewFakeVSock ()
24+ client := newClientWithVirtualMachineAndVSock ("fake-virtual-machine" , false , crcConfigStorage , virtualMachine , fakeVSock )
2425
2526 // When
2627 clusterState , stopErr := client .Stop ()
@@ -31,6 +32,7 @@ func TestStop_WhenVMRunning_ThenShouldStopVirtualMachine(t *testing.T) {
3132 assert .Equal (t , virtualMachine .IsStopped , true )
3233 assert .Equal (t , virtualMachine .FakeSSHClient .LastExecutedCommand , "sudo -- sh -c 'crictl stop $(crictl ps -q)'" )
3334 assert .Equal (t , virtualMachine .FakeSSHClient .IsSSHClientClosed , true )
35+ assert .Equal (t , fakeVSock .PortsExposed , false )
3436}
3537
3638func TestStop_WhenStopVmFailed_ThenErrorThrown (t * testing.T ) {
@@ -41,7 +43,8 @@ func TestStop_WhenStopVmFailed_ThenErrorThrown(t *testing.T) {
4143 _ , err := crcConfigStorage .Set (crcConfig .NetworkMode , "true" )
4244 assert .NoError (t , err )
4345 virtualMachine := fakemachine .NewFakeVirtualMachine (true , false )
44- client := newClientWithVirtualMachine ("fake-virtual-machine" , false , crcConfigStorage , virtualMachine )
46+ fakeVSock := fakemachine .NewFakeVSock ()
47+ client := newClientWithVirtualMachineAndVSock ("fake-virtual-machine" , false , crcConfigStorage , virtualMachine , fakeVSock )
4548
4649 // When
4750 _ , stopErr := client .Stop ()
@@ -60,7 +63,8 @@ func TestStop_WhenVMAlreadyStopped_ThenThrowError(t *testing.T) {
6063 virtualMachine := fakemachine .NewFakeVirtualMachine (false , false )
6164 err = virtualMachine .Stop ()
6265 assert .NoError (t , err )
63- client := newClientWithVirtualMachine ("fake-virtual-machine" , false , crcConfigStorage , virtualMachine )
66+ fakeVSock := fakemachine .NewFakeVSock ()
67+ client := newClientWithVirtualMachineAndVSock ("fake-virtual-machine" , false , crcConfigStorage , virtualMachine , fakeVSock )
6468
6569 // When
6670 clusterState , stopErr := client .Stop ()
0 commit comments