Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brokenpip3 committed Jun 3, 2024
1 parent 16285a5 commit 45d85e6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions api/v1alpha2/zz_generated.deepcopy.go

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

5 changes: 5 additions & 0 deletions pkg/configuration/base/resources/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ func NewJenkinsMasterPod(objectMeta metav1.ObjectMeta, jenkins *v1alpha2.Jenkins
objectMeta.Name = GetJenkinsMasterPodName(jenkins)
objectMeta.Labels = GetJenkinsMasterPodLabels(*jenkins)

if jenkins.Spec.Master.TerminationGracePeriodSeconds == nil {
defaultGracePeriod := constants.DefaultTerminationGracePeriodSeconds
jenkins.Spec.Master.TerminationGracePeriodSeconds = &defaultGracePeriod
}

return &corev1.Pod{
TypeMeta: buildPodTypeMeta(),
ObjectMeta: objectMeta,
Expand Down
1 change: 1 addition & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ const (
DefaultSlavePortInt32 = int32(50000)
// JavaOpsVariableName is the name of environment variable which consists Jenkins Java options
JavaOpsVariableName = "JAVA_OPTS"
// DefaultTerminationGracePeriodSeconds is the default pod termination period second
DefaultTerminationGracePeriodSeconds = int64(30)
)
5 changes: 3 additions & 2 deletions test/e2e/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ func verifyJenkinsMasterPodAttributes(jenkins *v1alpha2.Jenkins) {
jenkinsPod := getJenkinsMasterPod(jenkins)
jenkins = getJenkins(jenkins.Namespace, jenkins.Name)

defaultGracePeriod := constants.DefaultTerminationGracePeriodSeconds

assertMapContainsElementsFromAnotherMap(jenkins.Spec.Master.Annotations, jenkinsPod.ObjectMeta.Annotations)
Expect(jenkinsPod.Spec.NodeSelector).Should(Equal(jenkins.Spec.Master.NodeSelector))

Expand All @@ -125,8 +127,7 @@ func verifyJenkinsMasterPodAttributes(jenkins *v1alpha2.Jenkins) {

Expect(jenkinsPod.Labels).Should(Equal(resources.GetJenkinsMasterPodLabels(*jenkins)))
Expect(jenkinsPod.Spec.PriorityClassName).Should(Equal(jenkins.Spec.Master.PriorityClassName))

Expect(jenkinsPod.Spec.TerminationGracePeriodSeconds).Should(Equal(jenkins.Spec.Master.TerminationGracePeriodSeconds))
Expect(jenkinsPod.Spec.TerminationGracePeriodSeconds).Should(Equal(&defaultGracePeriod))

for _, actualContainer := range jenkinsPod.Spec.Containers {
if actualContainer.Name == resources.JenkinsMasterContainerName {
Expand Down

0 comments on commit 45d85e6

Please sign in to comment.