Skip to content

Commit

Permalink
add tolerations to the plz tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-lunsford-even committed Aug 1, 2024
1 parent baeb281 commit 3e0aa87
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/testrun/plz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package testrun

import (
"fmt"
"log"
"testing"

"github.com/go-test/deep"
Expand Down Expand Up @@ -69,6 +70,14 @@ func Test_NewPLZTestRun(t *testing.T) {
corev1.ResourceCPU: resource.MustParse("200m"),
corev1.ResourceMemory: resource.MustParse("1G"),
}
tolerations = []corev1.Toleration{
{
Key: "someKey",
Operator: corev1.TolerationOpEqual,
Value: "someValue",
Effect: corev1.TaintEffectNoSchedule,
},
}
someTestRunID = 6543
someRunnerImage = "grafana/k6:0.52.0"
someInstances = 10
Expand All @@ -95,8 +104,10 @@ func Test_NewPLZTestRun(t *testing.T) {
optionalFieldsTestRun.Namespace = someNS
optionalFieldsTestRun.Spec.Runner.ServiceAccountName = someSA
optionalFieldsTestRun.Spec.Runner.NodeSelector = someNodeSelector
optionalFieldsTestRun.Spec.Runner.Tolerations = tolerations
optionalFieldsTestRun.Spec.Starter.ServiceAccountName = someSA
optionalFieldsTestRun.Spec.Starter.NodeSelector = someNodeSelector
optionalFieldsTestRun.Spec.Starter.Tolerations = tolerations

cloudFieldsTestRun = requiredFieldsTestRun // build up on top of required field case
cloudFieldsTestRun.ObjectMeta.Name = TestName(fmt.Sprintf("%d", someTestRunID))
Expand Down Expand Up @@ -166,6 +177,7 @@ func Test_NewPLZTestRun(t *testing.T) {
Resources: corev1.ResourceRequirements{
Limits: resourceLimits,
},
Tolerations: tolerations,
ServiceAccountName: someSA,
NodeSelector: someNodeSelector,
},
Expand Down Expand Up @@ -225,6 +237,7 @@ func Test_NewPLZTestRun(t *testing.T) {
t.Parallel()
got := NewPLZTestRun(testCase.plz, testCase.cloudData, testCase.ingestUrl)
if diff := deep.Equal(got, testCase.expected); diff != nil {
log.Println(testCase.name)
t.Errorf("NewPLZTestRun returned unexpected data, diff: %s", diff)
}
})
Expand Down

0 comments on commit 3e0aa87

Please sign in to comment.