Skip to content

Commit 23420eb

Browse files
authored
Run validation mappings before validating ignored fields (#2389)
Reorder validation performed in system tests to execute validation based on mappings just after the validation based on fields.
1 parent b7445a2 commit 23420eb

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

internal/testrunner/runners/system/tester.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,8 @@ func (r *tester) prepareScenario(ctx context.Context, config *testConfig, stackC
13941394
return hits.size() > 0, nil
13951395
}, 1*time.Second, waitForDataTimeout)
13961396

1397+
// before checking "waitErr" error , it is necessary to check if the service has finished with error
1398+
// to report it as a test case failed
13971399
if service != nil && config.Service != "" && !config.IgnoreServiceError {
13981400
exited, code, err := service.ExitCode(ctx, config.Service)
13991401
if err != nil && !errors.Is(err, servicedeployer.ErrNotSupported) {
@@ -1637,16 +1639,6 @@ func (r *tester) validateTestScenario(ctx context.Context, result *testrunner.Re
16371639
})
16381640
}
16391641

1640-
stackVersion, err := semver.NewVersion(r.stackVersion.Number)
1641-
if err != nil {
1642-
return result.WithErrorf("failed to parse stack version: %w", err)
1643-
}
1644-
1645-
err = validateIgnoredFields(stackVersion, scenario, config)
1646-
if err != nil {
1647-
return result.WithError(err)
1648-
}
1649-
16501642
if r.fieldValidationMethod == mappingsMethod {
16511643
logger.Warn("Validation based on mappings enabled (technical preview)")
16521644
exceptionFields := listExceptionFields(scenario.docs, fieldsValidator)
@@ -1669,6 +1661,16 @@ func (r *tester) validateTestScenario(ctx context.Context, result *testrunner.Re
16691661
}
16701662
}
16711663

1664+
stackVersion, err := semver.NewVersion(r.stackVersion.Number)
1665+
if err != nil {
1666+
return result.WithErrorf("failed to parse stack version: %w", err)
1667+
}
1668+
1669+
err = validateIgnoredFields(stackVersion, scenario, config)
1670+
if err != nil {
1671+
return result.WithError(err)
1672+
}
1673+
16721674
docs := scenario.docs
16731675
if scenario.syntheticEnabled {
16741676
docs, err = fieldsValidator.SanitizeSyntheticSourceDocs(scenario.docs)

0 commit comments

Comments
 (0)