Skip to content

Commit

Permalink
fixtures: add fixtures for building pods without probes
Browse files Browse the repository at this point in the history
  • Loading branch information
roobre committed Sep 14, 2023
1 parent 28fc3e6 commit 4e7747e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions e2e/disruptors/pod_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func Test_PodDisruptor(t *testing.T) {
}{
{
title: "Inject Http error 500",
pod: fixtures.BuildHttpbinPod(),
pod: fixtures.BuildHttpbinPodWithoutProbes(),
service: fixtures.BuildHttpbinService(),
port: 80,
injector: func(d disruptors.PodDisruptor) error {
Expand Down Expand Up @@ -223,7 +223,7 @@ func Test_PodDisruptor(t *testing.T) {
err = deploy.ExposeApp(
k8s,
namespace,
fixtures.BuildHttpbinPod(),
fixtures.BuildHttpbinPodWithoutProbes(), // Probes generate requests, invalidating the test.
service,
intstr.FromInt(80),
30*time.Second,
Expand Down
2 changes: 1 addition & 1 deletion e2e/disruptors/service_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func Test_ServiceDisruptor(t *testing.T) {
}{
{
title: "Inject Http error 500",
pod: fixtures.BuildHttpbinPod(),
pod: fixtures.BuildHttpbinPodWithoutProbes(),
service: fixtures.BuildHttpbinService(),
port: 80,
injector: func(d disruptors.ServiceDisruptor) error {
Expand Down
14 changes: 14 additions & 0 deletions pkg/testutils/e2e/fixtures/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ func BuildHttpbinPod() corev1.Pod {
Build()
}

func BuildHttpbinPodWithoutProbes() corev1.Pod {

Check warning on line 26 in pkg/testutils/e2e/fixtures/fixtures.go

View workflow job for this annotation

GitHub Actions / run-linter

exported: exported function BuildHttpbinPodWithoutProbes should have comment or be unexported (revive)
pod := BuildHttpbinPod()
pod.Spec.Containers[0].ReadinessProbe = nil

return pod
}

// BuildGrpcpbinPod returns the definition for deploying grpcbin as a Pod
func BuildGrpcpbinPod() corev1.Pod {
c := builders.NewContainerBuilder("grpcbin").
Expand Down Expand Up @@ -97,6 +104,13 @@ func BuildNginxPod() corev1.Pod {
Build()
}

func BuildNginxPodWithoutPobes() corev1.Pod {

Check warning on line 107 in pkg/testutils/e2e/fixtures/fixtures.go

View workflow job for this annotation

GitHub Actions / run-linter

exported: exported function BuildNginxPodWithoutPobes should have comment or be unexported (revive)
pod := BuildNginxPod()
pod.Spec.Containers[0].ReadinessProbe = nil

return pod
}

// BuildNginxService returns the definition of a Service that exposes the nginx pod(s)
func BuildNginxService() corev1.Service {
return builders.NewServiceBuilder("nginx").
Expand Down

0 comments on commit 4e7747e

Please sign in to comment.