linera-io/linera-protocol

Split `test_simple_user_operation` unit test into smaller unit tests

Fermée

#1 484 ouverte le 12 janv. 2024

 (0 commentaire) (0 réaction) (0 personne assignée)Rust (2 354 forks)batch import
good first issuerefactortesting

Métriques du dépôt

Stars
 (32 149 étoiles)
Métriques de merge PR
 (Merge moyen 2j 22h) (111 PRs mergées en 30 j)

Description

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

Guide contributeur