Skip to content

Commit f8627e0

Browse files
committed
test: add parsing test case for hvsock
Unfortunately this currently fails because url.Parse is more strict than it used to be: ``` 2022/05/22 15:39:42 Failed to parse hvsock://00000000-0000-0000-0000-000000000000:00001010-FACB-11E6-BD58-64006A7986D3: parse "hvsock://00000000-0000-0000-0000-000000000000:00001010-FACB-11E6-BD58-64006A7986D3": invalid port ":00001010-FACB-11E6-BD58-64006A7986D3" after host exit status 1 FAIL github.com/linuxkit/virtsock/cmd/sock_stress 0.236s ``` Signed-off-by: David Scott <dave@recoil.org>
1 parent e63252b commit f8627e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+19170
-0
lines changed

cmd/sock_stress/main_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package main
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
)
8+
9+
func TestParseHVSock(t *testing.T) {
10+
scheme, sock := parseSockStr("hvsock://00000000-0000-0000-0000-000000000000/00001010-FACB-11E6-BD58-64006A7986D3")
11+
assert.Equal(t, "hvsock", scheme)
12+
assert.Equal(t, "00000000-0000-0000-0000-000000000000:00001010-facb-11e6-bd58-64006a7986d3", sock.String())
13+
}

go.mod

+7
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,12 @@ go 1.17
44

55
require (
66
github.com/pkg/errors v0.8.1-0.20170910134614-2b3a18b5f0fb
7+
github.com/stretchr/testify v1.7.1
78
golang.org/x/sys v0.0.0-20170511214829-9c9d83fe39ed
89
)
10+
11+
require (
12+
github.com/davecgh/go-spew v1.1.0 // indirect
13+
github.com/pmezard/go-difflib v1.0.0 // indirect
14+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
15+
)

go.sum

+10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
2+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
13
github.com/pkg/errors v0.8.1-0.20170910134614-2b3a18b5f0fb h1:CKWls8QOVQs/qmuUuGOeHMpIqSx6f9S72udJ48vEeKo=
24
github.com/pkg/errors v0.8.1-0.20170910134614-2b3a18b5f0fb/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
5+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
6+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
8+
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
9+
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
310
golang.org/x/sys v0.0.0-20170511214829-9c9d83fe39ed h1:zZ09nMxaZ+d+ObsmknNM+RrXWBw+22dzC/Fm62ueXgs=
411
golang.org/x/sys v0.0.0-20170511214829-9c9d83fe39ed/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
12+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
13+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
14+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

vendor/github.com/davecgh/go-spew/LICENSE

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/davecgh/go-spew/spew/bypass.go

+152
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/davecgh/go-spew/spew/bypasssafe.go

+38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)