Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/virtwork/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func runE(cmd *cobra.Command, args []string) error {
)
}

roles := []string{"server", "client"}
roles := multiVM.Roles()
perRole := vmCount / len(roles)
for _, role := range roles {
userdata, err := multiVM.UserdataForRole(role, cfg.Namespace)
Expand Down
5 changes: 5 additions & 0 deletions internal/workloads/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ func (w *NetworkWorkload) VMCount() int {
return count * 2
}

// Roles returns the supported VM roles for this multi-VM workload.
func (w *NetworkWorkload) Roles() []string {
return []string{"server", "client"}
}

// RequiresService returns true — the client needs a ClusterIP Service to reach
// the server by DNS.
func (w *NetworkWorkload) RequiresService() bool {
Expand Down
5 changes: 5 additions & 0 deletions internal/workloads/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ var _ = Describe("NetworkWorkload", func() {
Expect(w.RequiresService()).To(BeTrue())
})

It("should return server and client roles", func() {
roles := w.Roles()
Expect(roles).To(Equal([]string{"server", "client"}))
})

It("should produce server userdata with iperf3 -s", func() {
result, err := w.UserdataForRole("server", "virtwork")
Expect(err).NotTo(HaveOccurred())
Expand Down
5 changes: 5 additions & 0 deletions internal/workloads/tps.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ func (w *TPSWorkload) VMCount() int {
return count * 2
}

// Roles returns the supported VM roles for this multi-VM workload.
func (w *TPSWorkload) Roles() []string {
return []string{"server", "client"}
}

// RequiresService returns true — the client needs a ClusterIP Service to reach
// the server by DNS.
func (w *TPSWorkload) RequiresService() bool {
Expand Down
1 change: 1 addition & 0 deletions internal/workloads/workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type Workload interface {
// interface to call UserdataForRole() for each VM role.
type MultiVMWorkload interface {
Workload
Roles() []string
UserdataForRole(role string, namespace string) (string, error)
}

Expand Down
Loading