Skip to content

Commit 24b0bf9

Browse files
h0nIgsqueed
authored andcommitted
make test working again
Signed-off-by: h0nIg <[email protected]>
1 parent d44bbf2 commit 24b0bf9

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

integration/integration_linux_test.go

+23-8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"bytes"
1818
"fmt"
1919
"io"
20+
"log"
2021
"math/rand"
2122
"net"
2223
"os"
@@ -60,6 +61,13 @@ var _ = Describe("Basic PTP using cnitool", func() {
6061
netConfPath, err := filepath.Abs("./testdata")
6162
Expect(err).NotTo(HaveOccurred())
6263

64+
// Flush ipam stores to avoid conflicts
65+
err = os.RemoveAll("/tmp/chained-ptp-bandwidth-test")
66+
Expect(err).NotTo(HaveOccurred())
67+
68+
err = os.RemoveAll("/tmp/basic-ptp-test")
69+
Expect(err).NotTo(HaveOccurred())
70+
6371
env = TestEnv([]string{
6472
"CNI_PATH=" + cniPath,
6573
"NETCONFPATH=" + netConfPath,
@@ -82,6 +90,7 @@ var _ = Describe("Basic PTP using cnitool", func() {
8290
env.runInNS(hostNS, cnitoolBin, "add", netName, contNS.LongName())
8391

8492
addrOutput := env.runInNS(contNS, "ip", "addr")
93+
8594
Expect(addrOutput).To(ContainSubstring(expectedIPPrefix))
8695

8796
env.runInNS(hostNS, cnitoolBin, "del", netName, contNS.LongName())
@@ -145,9 +154,13 @@ var _ = Describe("Basic PTP using cnitool", func() {
145154

146155
chainedBridgeBandwidthEnv.runInNS(hostNS, cnitoolBin, "del", "network-chain-test", contNS1.LongName())
147156
basicBridgeEnv.runInNS(hostNS, cnitoolBin, "del", "network-chain-test", contNS2.LongName())
157+
158+
contNS1.Del()
159+
contNS2.Del()
160+
hostNS.Del()
148161
})
149162

150-
Measure("limits traffic only on the restricted bandwidth veth device", func(b Benchmarker) {
163+
It("limits traffic only on the restricted bandwidth veth device", func() {
151164
ipRegexp := regexp.MustCompile(`10\.1[12]\.2\.\d{1,3}`)
152165

153166
By(fmt.Sprintf("adding %s to %s\n\n", "chained-bridge-bandwidth", contNS1.ShortName()))
@@ -172,17 +185,19 @@ var _ = Describe("Basic PTP using cnitool", func() {
172185
// balanced by run time.
173186

174187
By(fmt.Sprintf("sending tcp traffic to the chained, bridged, traffic shaped container on ip address '%s:%d'\n\n", chainedBridgeIP, chainedBridgeBandwidthPort))
175-
runtimeWithLimit := b.Time("with chained bridge and bandwidth plugins", func() {
176-
makeTCPClientInNS(hostNS.ShortName(), chainedBridgeIP, chainedBridgeBandwidthPort, packetInBytes)
177-
})
188+
start := time.Now()
189+
makeTCPClientInNS(hostNS.ShortName(), chainedBridgeIP, chainedBridgeBandwidthPort, packetInBytes)
190+
runtimeWithLimit := time.Since(start)
191+
log.Printf("Runtime with qos limit %.2f seconds", runtimeWithLimit.Seconds())
178192

179193
By(fmt.Sprintf("sending tcp traffic to the basic bridged container on ip address '%s:%d'\n\n", basicBridgeIP, basicBridgePort))
180-
runtimeWithoutLimit := b.Time("with basic bridged plugin", func() {
181-
makeTCPClientInNS(hostNS.ShortName(), basicBridgeIP, basicBridgePort, packetInBytes)
182-
})
194+
start = time.Now()
195+
makeTCPClientInNS(hostNS.ShortName(), basicBridgeIP, basicBridgePort, packetInBytes)
196+
runtimeWithoutLimit := time.Since(start)
197+
log.Printf("Runtime without qos limit %.2f seconds", runtimeWithoutLimit.Seconds())
183198

184199
Expect(runtimeWithLimit).To(BeNumerically(">", runtimeWithoutLimit+1000*time.Millisecond))
185-
}, 1)
200+
})
186201
})
187202
})
188203

integration/testdata/basic-ptp.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"mtu": 512,
77
"ipam": {
88
"type": "host-local",
9-
"subnet": "10.1.2.0/24"
9+
"subnet": "10.1.2.0/24",
10+
"dataDir": "/tmp/basic-ptp-test"
1011
}
1112
}

integration/testdata/chained-ptp-bandwidth.conflist

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"mtu": 512,
99
"ipam": {
1010
"type": "host-local",
11-
"subnet": "10.9.2.0/24"
11+
"subnet": "10.9.2.0/24",
12+
"dataDir": "/tmp/chained-ptp-bandwidth-test"
1213
}
1314
},
1415
{

0 commit comments

Comments
 (0)