Skip to content

Commit

Permalink
Cleanup the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
wanlin31 committed Feb 5, 2022
1 parent e674fb6 commit 3c1063f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 29 deletions.
12 changes: 6 additions & 6 deletions api/v1/loadtest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ type Driver struct {
// +optional
Build *Build `json:"build,omitempty"`

// Run describes a list of run container, where the first container is the
// runtime of the driver for the actual test.
// 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"`
}

Expand Down Expand Up @@ -178,8 +178,8 @@ type Server struct {
// +optional
Build *Build `json:"build,omitempty"`

// Run describes a list of run containers, which is the runtime of the server for
// the actual test.
// 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"`
}

Expand Down Expand Up @@ -232,8 +232,8 @@ type Client struct {
// +optional
Build *Build `json:"build,omitempty"`

// Run describes a list of run container, , which is the runtime of the client for
// the actual test.
// 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"`
}

Expand Down
6 changes: 1 addition & 5 deletions config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const (
// RunContainerName holds the name of the main container where the test is
// executed. The runtime for the test may contain multiple run containers.
// The main container is always the first container on the list.
RunContainerName = "run"
RunContainerName = "main"

// ScenariosFileEnv specifies the name of an env variable that specifies the
// path to a JSON file with scenarios.
Expand All @@ -123,10 +123,6 @@ const (
// the init containers and containers for a driver or worker pod.
WorkspaceVolumeName = "workspace"

// WorkerContainerName holds the name of the worker container where the test is
// executed.
WorkerContainerName = "worker"

// KillAfterEnv specifies the name of the env variable that sets the allowed response time for a pod after timeout.
KillAfterEnv = "KILL_AFTER"

Expand Down
13 changes: 6 additions & 7 deletions config/crd/bases/e2etest.grpc.io_loadtests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ spec:
will choose a pool based on defaults.
type: string
run:
description: Run describes a list of run container, , which
is the runtime of the client for the actual test.
description: Run describes a list of run containers. The container
for the test client is always the first container on the list.
items:
description: A single application container that you want
to run within a pod.
Expand Down Expand Up @@ -1579,9 +1579,8 @@ spec:
choose a pool based on defaults.
type: string
run:
description: Run describes a list of run container, where the
first container is the runtime of the driver for the actual
test.
description: Run describes a list of run containers. The container
for the test driver is always the first container on the list.
items:
description: A single application container that you want to
run within a pod.
Expand Down Expand Up @@ -2910,8 +2909,8 @@ spec:
will choose a pool based on defaults.
type: string
run:
description: Run describes a list of run containers, which is
the runtime of the server for the actual test.
description: Run describes a list of run containers. The container
for the test server is always the first container on the list.
items:
description: A single application container that you want
to run within a pod.
Expand Down
4 changes: 2 additions & 2 deletions config/samples/go_example_loadtest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
language: go
name: '0'
run:
- name: "run"
- name: "main"
args:
- -c
- |
Expand Down Expand Up @@ -118,7 +118,7 @@ spec:
language: go
name: '0'
run:
- name: "run"
- name: "main"
args:
- -c
- |
Expand Down
3 changes: 2 additions & 1 deletion containers/init/ready/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
. "github.com/onsi/gomega"

grpcv1 "github.com/grpc/test-infra/api/v1"
"github.com/grpc/test-infra/config"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -54,7 +55,7 @@ func newTestPod(role string) corev1.Pod {
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "run",
Name: config.RunContainerName,
Ports: []corev1.ContainerPort{
{
Name: "driver",
Expand Down
12 changes: 4 additions & 8 deletions podbuilder/podbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func New(defaults *config.Defaults, test *grpcv1.LoadTest) *PodBuilder {
return &PodBuilder{
test: test,
defaults: defaults,
run: []corev1.Container{{}},
run: []corev1.Container{},
}
}

Expand All @@ -134,7 +134,7 @@ func (pb *PodBuilder) PodForClient(client *grpcv1.Client) (*corev1.Pod, error) {
pb.pool = safeStrUnwrap(client.Pool)
pb.clone = client.Clone
pb.build = client.Build
pb.run[0] = client.Run[0]
pb.run = client.Run

pod := pb.newPod()

Expand Down Expand Up @@ -170,9 +170,7 @@ func (pb *PodBuilder) PodForDriver(driver *grpcv1.Driver) (*corev1.Pod, error) {
pb.pool = safeStrUnwrap(driver.Pool)
pb.clone = driver.Clone
pb.build = driver.Build
// Pods are build after setting the default, so at least one container
// in the driver.Run has been set.
pb.run[0] = driver.Run[0]
pb.run = driver.Run

pod := pb.newPod()

Expand Down Expand Up @@ -236,9 +234,7 @@ func (pb *PodBuilder) PodForServer(server *grpcv1.Server) (*corev1.Pod, error) {
pb.pool = safeStrUnwrap(server.Pool)
pb.clone = server.Clone
pb.build = server.Build
// Pods are build after setting the default, so at least one container
// in the server.Run has been set.
pb.run[0] = server.Run[0]
pb.run = server.Run

pod := pb.newPod()

Expand Down

0 comments on commit 3c1063f

Please sign in to comment.