linkedin / rest.li

Rest.li is a REST+JSON framework for building robust, scalable service architectures using dynamic discovery and simple asynchronous APIs.
rest.li
Other
2.51k stars 546 forks source link

Increase verbosity of testExtensionSchemaValidation tests #1010

Closed SpencerKwok closed 3 months ago

SpencerKwok commented 4 months ago

Summary

When testExtensionSchemaValidation tests fail, the reason behind those failures are not logged. This PR replaces Assert with SoftAssert to always output the reason for failure in the unit tests. Below are some example outputs:

Before change:

Failure message for com.linkedin.restli.tools.data.TestExtensionSchemaValidationCmdLineApp > testExtensionSchemaValidation[0](validCase, true, null):
    The following asserts failed:
        expected [true] but found [false]

After change:

Failure message for com.linkedin.restli.tools.data.TestExtensionSchemaValidationCmdLineApp > testExtensionSchemaValidation[0](validCase, true, null):
    The following asserts failed:
        expected [true] but found [false],
        expected [null] but found [versionSuffix value: 'V3' does not match the versionSuffix value which was defined in resourceKey/grpcService annotation]

In addition, this PR updates ValidateExtensionSchemaTask to output schema validation errors to the build log.

More information can be found at SI-40347.

Tests

I manually modified valid test cases to be invalid and invalid test cases to be valid to check for error message improvements.