Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
channel: remove unused functions
Browse files Browse the repository at this point in the history
newChannel function was re-implemented, some functions
are no more needed.

Signed-off-by: Julio Montes <[email protected]>
  • Loading branch information
Julio Montes committed Aug 8, 2018
1 parent f6486e7 commit 4f70b1c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 58 deletions.
26 changes: 0 additions & 26 deletions channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,6 @@ func isAFVSockSupported() (bool, error) {
return true, nil
}

func vSockPathExist() (bool, error) {
if _, err := os.Stat(vSockDevPath); err != nil {
if os.IsNotExist(err) {
return false, nil
}

return false, err
}

return true, nil
}

func findVirtualSerialPath(serialName string) (string, error) {
dir, err := os.Open(virtIOPath)
if err != nil {
Expand Down Expand Up @@ -270,17 +258,3 @@ func findVirtualSerialPath(serialName string) (string, error) {

return "", grpcStatus.Errorf(codes.NotFound, "Could not find virtio port %s", serialName)
}

func openSerialChannel() (*os.File, error) {
serialPath, err := findVirtualSerialPath(serialChannelName)
if err != nil {
return nil, err
}

file, err := os.OpenFile(serialPath, os.O_RDWR, os.ModeDevice)
if err != nil {
return nil, err
}

return file, nil
}
32 changes: 0 additions & 32 deletions channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,6 @@ import (
"github.com/stretchr/testify/assert"
)

func TestVSockPathExistTrue(t *testing.T) {
tmpFile, err := ioutil.TempFile("", "test")
assert.Nil(t, err, "%v", err)
fileName := tmpFile.Name()
defer tmpFile.Close()
defer os.Remove(fileName)

vSockDevPath = fileName

result, err := vSockPathExist()
assert.Nil(t, err, "%v", err)

assert.True(t, result, "VSOCK should be found")
}

func TestVSockPathExistFalse(t *testing.T) {
tmpFile, err := ioutil.TempFile("", "test")
assert.Nil(t, err, "%v", err)

fileName := tmpFile.Name()
tmpFile.Close()
err = os.Remove(fileName)
assert.Nil(t, err, "%v", err)

vSockDevPath = fileName

result, err := vSockPathExist()
assert.Nil(t, err, "%v", err)

assert.False(t, result, "VSOCK should not be found")
}

func TestSetupVSockChannel(t *testing.T) {
c := &vSockChannel{}

Expand Down

0 comments on commit 4f70b1c

Please sign in to comment.