File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
src/Oracle/Validate/Requests/TestRun
test/Oracle/Validate/Requests/TestRun Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ validateCreateTestRun
104
104
testRunState
105
105
106
106
data TestRunRejection
107
- = UnacceptableDuration
107
+ = UnacceptableDuration Int Int
108
108
| UnacceptableCommit
109
109
| UnacceptableTryIndex
110
110
| UnacceptableRole
@@ -117,8 +117,8 @@ data TestRunRejection
117
117
deriving (Eq , Show )
118
118
119
119
instance Monad m => ToJSON m TestRunRejection where
120
- toJSON UnacceptableDuration =
121
- stringJSON " unacceptable duration"
120
+ toJSON ( UnacceptableDuration minDuration maxDuration) =
121
+ stringJSON $ " unacceptable duration. Expecting duration to be between " <> show minDuration <> " and " <> show maxDuration
122
122
toJSON UnacceptableCommit =
123
123
stringJSON " unacceptable commit"
124
124
toJSON UnacceptableTryIndex =
@@ -141,7 +141,8 @@ instance Monad m => ToJSON m TestRunRejection where
141
141
checkDuration
142
142
:: TestRunValidationConfig -> Duration -> Maybe TestRunRejection
143
143
checkDuration TestRunValidationConfig {maxDuration, minDuration} (Duration n)
144
- | n < minDuration || n > maxDuration = Just UnacceptableDuration
144
+ | n < minDuration || n > maxDuration =
145
+ Just $ UnacceptableDuration minDuration maxDuration
145
146
| otherwise = Nothing
146
147
147
148
checkRole
Original file line number Diff line number Diff line change @@ -249,9 +249,11 @@ spec = do
249
249
(mkValidation mockMPFS noValidation)
250
250
testRun
251
251
testRunState
252
- onConditionHaveReason mresult UnacceptableDuration
253
- $ duration < minDuration testConfig
254
- || duration > maxDuration testConfig
252
+ let expectedMinDuration = minDuration testConfig
253
+ let expectedMaxDuration = maxDuration testConfig
254
+ onConditionHaveReason mresult (UnacceptableDuration expectedMinDuration expectedMaxDuration)
255
+ $ duration < expectedMinDuration
256
+ || duration > expectedMaxDuration
255
257
256
258
it " reports unacceptable role" $ egenProperty $ do
257
259
testConfig <- testConfigEGen
You can’t perform that action at this time.
0 commit comments