Skip to content

Commit 89cd7e3

Browse files
committed
remove mockable exit var as it is no longer needed
Signed-off-by: jesus m. rodriguez <jmrodri@gmail.com>
1 parent cf3e292 commit 89cd7e3

File tree

2 files changed

+0
-12
lines changed

2 files changed

+0
-12
lines changed

pkg/validate/result.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ func (r *Result) prepare() error {
133133
return nil
134134
}
135135

136-
// Mockable exit function for tests.
137-
var exit = os.Exit
138-
139136
// PrintWithFormat prints output to w in format, and exits if some object in output
140137
// is not in a passing state.
141138
func (r *Result) PrintWithFormat(format string) (failed bool, err error) {

pkg/validate/result_test.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,10 @@ var _ = Describe("Output Result", func() {
152152
var w *bytes.Buffer
153153
var output []byte
154154
var resJSON Result
155-
var exitCode int
156-
exit = func(code int) {
157-
exitCode = code
158-
}
159155
const warnText = "example of a warning"
160156
const errorText = "example of an error"
161157

162158
BeforeEach(func() {
163-
exitCode = 0
164159
w = &bytes.Buffer{}
165160
resJSON = Result{}
166161
})
@@ -177,7 +172,6 @@ var _ = Describe("Output Result", func() {
177172
Expect(resJSON.Outputs).To(HaveLen(1))
178173
Expect(resJSON.Outputs[0].Type).To(Equal("warning"))
179174
Expect(resJSON.Outputs[0].Message).To(Equal(warnText))
180-
Expect(exitCode).To(Equal(0))
181175
})
182176

183177
It("prints an error", func() {
@@ -193,7 +187,6 @@ var _ = Describe("Output Result", func() {
193187
Expect(resJSON.Outputs).To(HaveLen(1))
194188
Expect(resJSON.Outputs[0].Type).To(Equal("error"))
195189
Expect(resJSON.Outputs[0].Message).To(Equal(errorText))
196-
Expect(exitCode).To(Equal(0))
197190
})
198191
})
199192

@@ -209,7 +202,6 @@ var _ = Describe("Output Result", func() {
209202
line := string(lines[0])
210203
Expect(line).To(ContainSubstring("level=warning"), line)
211204
Expect(line).To(ContainSubstring(`msg="example of a warning"`), line)
212-
Expect(exitCode).To(Equal(0))
213205
})
214206

215207
It("prints an error", func() {
@@ -224,7 +216,6 @@ var _ = Describe("Output Result", func() {
224216
fmt.Println(line)
225217
Expect(line).To(ContainSubstring("level=error"), line)
226218
Expect(line).To(ContainSubstring(`msg="example of an error"`), line)
227-
Expect(exitCode).To(Equal(0))
228219
})
229220
})
230221

0 commit comments

Comments
 (0)