forked from moby/libnetwork
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request moby#138 from fmzhen/test-dev
Add some tests
- Loading branch information
Showing
2 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package bridge | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/docker/libnetwork/netutils" | ||
) | ||
|
||
func getPorts() []netutils.TransportPort { | ||
return []netutils.TransportPort{ | ||
netutils.TransportPort{Proto: netutils.TCP, Port: uint16(5000)}, | ||
netutils.TransportPort{Proto: netutils.UDP, Port: uint16(400)}, | ||
netutils.TransportPort{Proto: netutils.TCP, Port: uint16(600)}, | ||
} | ||
} | ||
|
||
func TestLinkNew(t *testing.T) { | ||
ports := getPorts() | ||
|
||
link := newLink("172.0.17.3", "172.0.17.2", ports, "docker0") | ||
|
||
if link == nil { | ||
t.FailNow() | ||
} | ||
if link.parentIP != "172.0.17.3" { | ||
t.Fail() | ||
} | ||
if link.childIP != "172.0.17.2" { | ||
t.Fail() | ||
} | ||
for i, p := range link.ports { | ||
if p != ports[i] { | ||
t.Fail() | ||
} | ||
} | ||
if link.bridge != "docker0" { | ||
t.Fail() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters