linera-io/linera-protocol

Split `test_simple_user_operation` unit test into smaller unit tests

Chiusa

#1484 aperta il 12 gen 2024

 (0 commenti) (0 reazioni) (0 assegnatari)Rust (2354 fork)batch import
good first issuerefactortesting

Metriche repository

Star
 (32.149 stelle)
Metriche merge PR
 (Merge medio 2g 22h) (111 PR mergiate in 30 g)

Descrizione

Motivation

The test_simple_user_operation is an integration test that covers a few different functionalities, like:

  • Handling an operation
  • Forwarding authentication
  • Using the runtime storage
  • Performing a cross-application call
  • Using a session
  • Performing a query

Partly this was because it relied on a custom TestApplication type before #1482 was merged replacing it with a more customizable MockApplication. With the MockApplication it is now possible to split the test into simpler tests that are more like unit tests, which would help with regressions by making it simpler to isolate the issues.

Proposal

Split the test into a few smaller tests. One suggestion is to have at least:

  • a test for handling an operation that uses the runtime storage
  • a test that performs a query
  • a test that performs a cross-application call
  • a test to ensure authentication is forwarded correctly

New tests can also be added, like for example:

  • a test that performs a cross-application query
  • a test that calls a session more than once

Guida contributor