Skip to content

Commit d44bbf2

Browse files
h0nIgsqueed
authored andcommitted
Revert "Merge pull request #921 from oOraph/dev/exclude_subnets_from_traffic_shapping2"
This reverts commit ef076af, reversing changes made to 5974089. Signed-off-by: h0nIg <[email protected]>
1 parent 8ad0361 commit d44bbf2

9 files changed

+610
-2886
lines changed

integration/integration_linux_test.go

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"bytes"
1818
"fmt"
1919
"io"
20-
"log"
2120
"math/rand"
2221
"net"
2322
"os"
@@ -61,13 +60,6 @@ var _ = Describe("Basic PTP using cnitool", func() {
6160
netConfPath, err := filepath.Abs("./testdata")
6261
Expect(err).NotTo(HaveOccurred())
6362

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-
7163
env = TestEnv([]string{
7264
"CNI_PATH=" + cniPath,
7365
"NETCONFPATH=" + netConfPath,
@@ -90,7 +82,6 @@ var _ = Describe("Basic PTP using cnitool", func() {
9082
env.runInNS(hostNS, cnitoolBin, "add", netName, contNS.LongName())
9183

9284
addrOutput := env.runInNS(contNS, "ip", "addr")
93-
9485
Expect(addrOutput).To(ContainSubstring(expectedIPPrefix))
9586

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

155146
chainedBridgeBandwidthEnv.runInNS(hostNS, cnitoolBin, "del", "network-chain-test", contNS1.LongName())
156147
basicBridgeEnv.runInNS(hostNS, cnitoolBin, "del", "network-chain-test", contNS2.LongName())
157-
158-
contNS1.Del()
159-
contNS2.Del()
160-
hostNS.Del()
161148
})
162149

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

166153
By(fmt.Sprintf("adding %s to %s\n\n", "chained-bridge-bandwidth", contNS1.ShortName()))
@@ -181,23 +168,21 @@ var _ = Describe("Basic PTP using cnitool", func() {
181168
By(fmt.Sprintf("starting echo server in %s\n\n", contNS2.ShortName()))
182169
basicBridgePort, basicBridgeSession = startEchoServerInNamespace(contNS2)
183170

184-
packetInBytes := 3000
171+
packetInBytes := 20000 // The shaper needs to 'warm'. Send enough to cause it to throttle,
172+
// balanced by run time.
185173

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

193179
By(fmt.Sprintf("sending tcp traffic to the basic bridged container on ip address '%s:%d'\n\n", basicBridgeIP, basicBridgePort))
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", runtimeWithLimit.Seconds())
180+
runtimeWithoutLimit := b.Time("with basic bridged plugin", func() {
181+
makeTCPClientInNS(hostNS.ShortName(), basicBridgeIP, basicBridgePort, packetInBytes)
182+
})
198183

199184
Expect(runtimeWithLimit).To(BeNumerically(">", runtimeWithoutLimit+1000*time.Millisecond))
200-
})
185+
}, 1)
201186
})
202187
})
203188

integration/testdata/basic-ptp.json

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

integration/testdata/chained-ptp-bandwidth.conflist

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"mtu": 512,
99
"ipam": {
1010
"type": "host-local",
11-
"subnet": "10.9.2.0/24",
12-
"dataDir": "/tmp/chained-ptp-bandwidth-test"
11+
"subnet": "10.9.2.0/24"
1312
}
1413
},
1514
{

0 commit comments

Comments
 (0)