You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by to...@apache.org on 2021/06/30 03:12:35 UTC
[apisix] branch master updated: test: make t/chaos/kill-chaos.t
stable (#4503)
This is an automated email from the ASF dual-hosted git repository.
tokers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new d0bc723 test: make t/chaos/kill-chaos.t stable (#4503)
d0bc723 is described below
commit d0bc7238c912259e325f45ad6caea039d24e4292
Author: Shuyang Wu <wo...@gmail.com>
AuthorDate: Tue Jun 29 23:12:25 2021 -0400
test: make t/chaos/kill-chaos.t stable (#4503)
Signed-off-by: yiyiyimu <wo...@gmail.com>
---
t/chaos/kill-etcd_test.go | 6 +++---
t/chaos/utils.go | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/t/chaos/kill-etcd_test.go b/t/chaos/kill-etcd_test.go
index 62a4578..44bd9d5 100644
--- a/t/chaos/kill-etcd_test.go
+++ b/t/chaos/kill-etcd_test.go
@@ -79,13 +79,13 @@ func TestGetSuccessWhenEtcdKilled(t *testing.T) {
go func() {
for {
go getRoute(eSilent, http.StatusOK)
- time.Sleep(500 * time.Millisecond)
+ time.Sleep(100 * time.Millisecond)
}
}()
// wait 1 seconds to let first route access returns
time.Sleep(1 * time.Second)
- bandwidthBefore, durationBefore := getIngressBandwidthPerSecond(e, g)
+ bandwidthBefore, durationBefore := getEgressBandwidthPerSecond(e, g)
bpsBefore := bandwidthBefore / durationBefore
g.Expect(bpsBefore).NotTo(BeZero())
@@ -116,7 +116,7 @@ func TestGetSuccessWhenEtcdKilled(t *testing.T) {
g.Expect(strings.Contains(errorLog, "failed to fetch data from etcd")).To(BeTrue())
})
- bandwidthAfter, durationAfter := getIngressBandwidthPerSecond(e, g)
+ bandwidthAfter, durationAfter := getEgressBandwidthPerSecond(e, g)
bpsAfter := bandwidthAfter / durationAfter
t.Run("ingress bandwidth per second not change much", func(t *testing.T) {
t.Logf("bandwidth before: %f, after: %f", bandwidthBefore, bandwidthAfter)
diff --git a/t/chaos/utils.go b/t/chaos/utils.go
index 6dadf7f..b226e79 100644
--- a/t/chaos/utils.go
+++ b/t/chaos/utils.go
@@ -158,8 +158,8 @@ func getPrometheusMetric(e *httpexpect.Expect, g *WithT, key string) string {
return targetSlice[1]
}
-func getIngressBandwidthPerSecond(e *httpexpect.Expect, g *WithT) (float64, float64) {
- key := "apisix_bandwidth{type=\"ingress\","
+func getEgressBandwidthPerSecond(e *httpexpect.Expect, g *WithT) (float64, float64) {
+ key := "apisix_bandwidth{type=\"egress\","
bandWidthString := getPrometheusMetric(e, g, key)
bandWidthStart, err := strconv.ParseFloat(bandWidthString, 64)
g.Expect(err).To(BeNil())
@@ -167,7 +167,7 @@ func getIngressBandwidthPerSecond(e *httpexpect.Expect, g *WithT) (float64, floa
// so need to calculate the duration
timeStart := time.Now()
- time.Sleep(5 * time.Second)
+ time.Sleep(10 * time.Second)
bandWidthString = getPrometheusMetric(e, g, key)
bandWidthEnd, err := strconv.ParseFloat(bandWidthString, 64)
g.Expect(err).To(BeNil())