Skip to content

Commit f08c6d3

Browse files
model and fail skipped test steps
1 parent fb50b0e commit f08c6d3

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎checks/local.go‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,23 @@ func EvaluateCLIResults(cliData api.CLIData, results []api.CLIStepResult) *api.S
3636
for i, step := range cliData.Steps {
3737
actual := results[i]
3838

39+
variants := 0
40+
if actual.CLICommandResult != nil {
41+
variants++
42+
}
43+
if actual.HTTPRequestResult != nil {
44+
variants++
45+
}
46+
if actual.DependencyFailure != nil {
47+
variants++
48+
}
49+
if variants != 1 {
50+
return localFailure(i, -1, "invalid step result: expected exactly one result variant")
51+
}
52+
if actual.DependencyFailure != nil {
53+
return localFailure(i, -1, "step skipped: unavailable variables: "+strings.Join(actual.DependencyFailure.Names, ", "))
54+
}
55+
3956
if step.CLICommand != nil && actual.CLICommandResult != nil {
4057
verificationErr := evaluateCLICommandTests(i, *step.CLICommand, *actual.CLICommandResult)
4158
if verificationErr != nil {

‎client/lessons.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,14 @@ func FetchNextCLILesson() (*NextCLILesson, error) {
198198
return &data, nil
199199
}
200200

201+
type DependencyFailure struct {
202+
Names []string
203+
}
204+
201205
type CLIStepResult struct {
202206
CLICommandResult *CLICommandResult
203207
HTTPRequestResult *HTTPRequestResult
208+
DependencyFailure *DependencyFailure `json:",omitempty"`
204209
}
205210

206211
type CLICommandResult struct {

0 commit comments

Comments
 (0)