Skip to content

Commit

Permalink
Merge pull request #55 from shipwright-io/sascha-fix-timeout-handling
Browse files Browse the repository at this point in the history
Do not set timeout to 0s
  • Loading branch information
openshift-merge-robot authored Oct 8, 2021
2 parents 7e33efe + 7d2f69b commit ec81d6f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/shp/flags/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,7 @@ func SanitizeBuildSpec(b *buildv1alpha1.BuildSpec) {
b.Builder = nil
}
}
if b.Timeout != nil && b.Timeout.Duration == 0 {
b.Timeout = nil
}
}
6 changes: 6 additions & 0 deletions pkg/shp/flags/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ func TestSanitizeBuildSpec(t *testing.T) {
name: "should not clean-up complete objects",
in: completeBuildSpec,
out: completeBuildSpec,
}, {
name: "should clean-up 0s duration",
in: buildv1alpha1.BuildSpec{Timeout: &metav1.Duration{
Duration: time.Duration(0),
}},
out: buildv1alpha1.BuildSpec{Timeout: nil},
}}

for _, tt := range testCases {
Expand Down
3 changes: 3 additions & 0 deletions pkg/shp/flags/buildrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@ func SanitizeBuildRunSpec(br *buildv1alpha1.BuildRunSpec) {
br.Output = nil
}
}
if br.Timeout != nil && br.Timeout.Duration == 0 {
br.Timeout = nil
}
}
6 changes: 6 additions & 0 deletions pkg/shp/flags/buildrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ func TestSanitizeBuildRunSpec(t *testing.T) {
name: "should not clean-up complete objects",
in: completeBuildRunSpec,
out: completeBuildRunSpec,
}, {
name: "should clean-up 0s duration",
in: buildv1alpha1.BuildRunSpec{Timeout: &metav1.Duration{
Duration: time.Duration(0),
}},
out: buildv1alpha1.BuildRunSpec{Timeout: nil},
}}

for _, tt := range testCases {
Expand Down

0 comments on commit ec81d6f

Please sign in to comment.