Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dry-run unittests #1083

Closed
heifner opened this issue Apr 25, 2023 · 1 comment · Fixed by #1489
Closed

Add dry-run unittests #1083

heifner opened this issue Apr 25, 2023 · 1 comment · Fixed by #1489
Assignees
Labels
actionable 👍 lgtm OCI Work exclusive to OCI team tests For issues whose primary purpose is adding or refining tests, or enhancing the testing apparatus.

Comments

@heifner
Copy link
Member

heifner commented Apr 25, 2023

We have no dry-run unittests. See #1081 for an example of an issue that slipped through. Create corresponding dry-run unittests similar to read_only_trx_tests.cpp

Include this test:

BOOST_FIXTURE_TEST_CASE(dry_run_auth_test, read_only_trx_tester) { try {
      set_up_test_contract();

      // verify dry-run transaction allows authorizations, but doesn't verify
      send_db_api_transaction("insert"_n, insert_data, {{"alice"_n, config::active_name}}, transaction_metadata::trx_type::dry_run);
} FC_LOG_AND_RETHROW() }

where send_db_api_transaction has

      } else if ( type == transaction_metadata::trx_type::dry_run ) {
         // sign with some irrelevant sigs which should be allowed
         trx.sign(get_private_key("invalid"_n, "active"), control->get_chain_id());
@heifner heifner added actionable and removed triage labels Apr 25, 2023
@bhazzard bhazzard added CICD Anything dealing with the CI workflow behavior tests For issues whose primary purpose is adding or refining tests, or enhancing the testing apparatus. 👍 lgtm labels Jun 29, 2023
@heifner heifner added OCI Work exclusive to OCI team and removed CICD Anything dealing with the CI workflow behavior labels Aug 8, 2023
@heifner
Copy link
Member Author

heifner commented Aug 10, 2023

As much as possible normal write input transaction and dry-run transactions should produce same/similar errors for similar issues. Specifically lack of authorization should generate same error if possible.

heifner added a commit that referenced this issue Aug 14, 2023
heifner added a commit that referenced this issue Aug 14, 2023
heifner added a commit that referenced this issue Aug 14, 2023
heifner added a commit that referenced this issue Aug 14, 2023
Require dry-run trxs to have authorization and add tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable 👍 lgtm OCI Work exclusive to OCI team tests For issues whose primary purpose is adding or refining tests, or enhancing the testing apparatus.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants