Skip to content

Commit

Permalink
Add a test for differing network stats.
Browse files Browse the repository at this point in the history
  • Loading branch information
vmarmol committed Jun 25, 2015
1 parent fc62b8c commit ee119e2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions integration/tests/api/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func TestDockerContainerNetworkStats(t *testing.T) {
defer fm.Cleanup()

// Wait for the container to show up.
containerId := fm.Docker().RunBusybox("ping", "www.google.com")
containerId := fm.Docker().RunBusybox("sh", "-c", "wget www.google.com && ping www.google.com")
waitForContainer(containerId, fm)

request := &info.ContainerInfoRequest{
Expand All @@ -261,7 +261,11 @@ func TestDockerContainerNetworkStats(t *testing.T) {

// Checks for NetworkStats.
stat := containerInfo.Stats[0]
assert.NotEqual(t, 0, stat.Network.TxBytes, "Network tx bytes should not be zero")
assert.NotEqual(t, 0, stat.Network.TxPackets, "Network tx packets should not be zero")
// TODO(vmarmol): Can probably do a better test with two containers pinging each other.
assert := assert.New(t)
assert.NotEqual(0, stat.Network.TxBytes, "Network tx bytes should not be zero")
assert.NotEqual(0, stat.Network.TxPackets, "Network tx packets should not be zero")
assert.NotEqual(0, stat.Network.RxBytes, "Network rx bytes should not be zero")
assert.NotEqual(0, stat.Network.RxPackets, "Network rx packets should not be zero")
assert.NotEqual(stat.Network.RxBytes, stat.Network.TxBytes, "Network tx and rx bytes should not be equal")
assert.NotEqual(stat.Network.RxPackets, stat.Network.TxPackets, "Network tx and rx packets should not be equal")
}

0 comments on commit ee119e2

Please sign in to comment.