Skip to content

Commit

Permalink
connectivity: add bandwidth scenario
Browse files Browse the repository at this point in the history
this commit is temp commit about bandwidth scenario

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
  • Loading branch information
Jack-R-lantern committed Jul 18, 2023
1 parent a902368 commit 44b952d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
8 changes: 8 additions & 0 deletions connectivity/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,14 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, addExtraTests func(*ch
return ct.Run(ctx)
}

// BandWidth Manager Test
if ct.Params().BandWidthManager {
ct.NewTest("bandwidth-manager").WithScenarios(
tests.BandWidthManager(""),
)
return ct.Run(ctx)
}

// Upgrade Test
if ct.Params().IncludeUpgradeTest {
ct.NewTest("post-upgrade").WithScenarios(
Expand Down
41 changes: 41 additions & 0 deletions connectivity/tests/bandwidth.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium

package tests

import (
"context"
"fmt"

"github.com/cilium/cilium-cli/connectivity/check"
)

// BandWidth Manager
func BandWidthManager(n string) check.Scenario {
return &bandWidthManager{
name: n,
}
}

// bandWidthManager implements a Scenario.
type bandWidthManager struct {
name string
}

func (b *bandWidthManager) Name() string {
tn := "bandwidth-manager"
if b.name == "" {
return tn
}
return fmt.Sprintf("%s:%s", tn, b.name)
}

func (b *bandWidthManager) Run(ctx context.Context, t *check.Test) {
for _, c := range t.Context().PerfClientPods() {
c := c
for _, server := range t.Context().PerfServerPod() {
action := t.NewAction(b, "bandwidth", &c, server, check.IPFamilyV4)
action.Run(func(a *check.Action) {})
}
}
}

0 comments on commit 44b952d

Please sign in to comment.