Skip to content

Commit

Permalink
Update the run containers to be a generic list of containers. (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanlin31 authored Feb 7, 2022
1 parent e481794 commit 2bdd8fb
Show file tree
Hide file tree
Showing 35 changed files with 3,539 additions and 719 deletions.
51 changes: 9 additions & 42 deletions api/v1/loadtest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,39 +79,6 @@ type Build struct {
Env []corev1.EnvVar `json:"env,omitempty"`
}

// Run defines expectations regarding the runtime environment for the
// test component itself.
type Run struct {
// Image is the name of the container image that provides the
// runtime for the test component.
//
// This field is optional when a Language is specified on the
// Component. For example, a developer may specify a "python3"
// client. This field will be implicitly set to the most recent
// supported python3 image.
// +optional
Image *string `json:"image,omitempty"`

// Command is the path to the executable that will run the component
// of the test. When unset, the entrypoint of the container image
// will be used.
// +optional
Command []string `json:"command,omitempty"`

// Args provide command line arguments to the command.
// +optional
Args []string `json:"args,omitempty"`

// Env are environment variables that should be set within the
// running container.
// +optional
Env []corev1.EnvVar `json:"env,omitempty"`

// VolumeMounts permit sharing directories across containers.
// +optional
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
}

// Driver defines a component that orchestrates the server and clients in the
// test.
type Driver struct {
Expand Down Expand Up @@ -159,9 +126,9 @@ type Driver struct {
// +optional
Build *Build `json:"build,omitempty"`

// Run describes the run container, which is the runtime of the driver for
// the actual test.
Run Run `json:"run"`
// Run describes a list of run containers. The container for the test driver is always
// the first container on the list.
Run []corev1.Container `json:"run"`
}

// Server defines a component that receives traffic from a set of client
Expand Down Expand Up @@ -211,9 +178,9 @@ type Server struct {
// +optional
Build *Build `json:"build,omitempty"`

// Run describes the run container, which is the runtime of the server for
// the actual test.
Run Run `json:"run"`
// Run describes a list of run containers. The container for the test server is always
// the first container on the list.
Run []corev1.Container `json:"run"`
}

// Client defines a component that sends traffic to a server component.
Expand Down Expand Up @@ -265,9 +232,9 @@ type Client struct {
// +optional
Build *Build `json:"build,omitempty"`

// Run describes the run container, which is the runtime of the client for
// the actual test.
Run Run `json:"run"`
// Run describes a list of run containers. The container for the test client is always
// the first container on the list.
Run []corev1.Container `json:"run"`
}

// Results defines where and how test results and artifacts should be
Expand Down
68 changes: 21 additions & 47 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions cmd/client_test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ func main() {
Command: []string{"go"},
Args: []string{"build", "-o", "/src/workspace/bin/worker", "./benchmark/worker"},
},
Run: grpcv1.Run{
Run: []corev1.Container{{
Command: []string{"/src/workspace/bin/worker"},
},
}},
},
},
Clients: []grpcv1.Client{
Expand All @@ -130,9 +130,9 @@ func main() {
Command: []string{"go"},
Args: []string{"build", "-o", "/src/workspace/bin/worker", "./benchmark/worker"},
},
Run: grpcv1.Run{
Run: []corev1.Container{{
Command: []string{"/src/workspace/bin/worker"},
},
}},
},
},
TimeoutSeconds: 900,
Expand Down
5 changes: 3 additions & 2 deletions config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ const (
RoleLabel = "loadtest-role"

// RunContainerName holds the name of the main container where the test is
// executed.
RunContainerName = "run"
// executed. The runtime for the test may contain multiple run containers.
// The main container is always the first container on the list.
RunContainerName = "main"

// ScenariosFileEnv specifies the name of an env variable that specifies the
// path to a JSON file with scenarios.
Expand Down
Loading

0 comments on commit 2bdd8fb

Please sign in to comment.