Skip to content

fix: tests use debug settings#1213

Merged
erights merged 2 commits into
masterfrom
markm-tests-use-debug-setting
Jun 11, 2022
Merged

fix: tests use debug settings#1213
erights merged 2 commits into
masterfrom
markm-tests-use-debug-setting

Conversation

@erights

@erights erights commented Jun 10, 2022

Copy link
Copy Markdown
Contributor

I normally run with

export LOCKDOWN_ERROR_TAMING=unsafe

This caused a failure in a test case comparing error messages, that were made more explanatory with this setting. The problem is that our tests were run with a neutral lockdown call that was letting this setting be set by the environment variable, but the test itself happened to depend on this option being 'safe'. I think our best practice should be that test-*.js ava test files[1] should use the @endo/init/debug.js settings rather than the @endo/init settings. Then the error messages during testing will be more informative without endangering info leakage in production.

[1] aside from those whose purpose is to test the lockdown options, or whose purpose is to test that sensitive info in error messages get properly redacted.

@erights erights requested a review from kriskowal June 10, 2022 17:40
@erights erights self-assigned this Jun 10, 2022
{
message:
"checkBundle cannot bundle without the property 'endoZipBase64Sha512', which must be a string, got (a string)",
'checkBundle cannot bundle without the property \'endoZipBase64Sha512\', which must be a string, got "undefined"',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the case causing the failure.

@erights

erights commented Jun 10, 2022

Copy link
Copy Markdown
Contributor Author

I left one @endo/init unchanged because it is in packages/init and so might be testing init itself. I'm not sure. That is test-async-hooks.js. I suspect this should be changed as well. Please let me know if I should change it as well.

@erights

erights commented Jun 10, 2022

Copy link
Copy Markdown
Contributor Author

I left one @endo/init unchanged because it is in packages/init and so might be testing init itself. I'm not sure. That is test-async-hooks.js. I suspect this should be changed as well. Please let me know if I should change it as well.

I have since changed my mind, and the PR no longer makes a special case for test-async-hooks.js. However, I still want feedback on this before merging.

// Use a package self-reference to go through the "exports" resolution
// eslint-disable-next-line import/no-extraneous-dependencies
import '@endo/init';
import '@endo/init/debug.js';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewers, since this is in packages/init, I'd like feedback on whether this change is appropriate before merging.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I defer to @mhofman’s opinion on this test.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If debug transitively imports pre throught the package.json module map, i think it's ok

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it, it should since it's a public entry point itself.

@kriskowal kriskowal requested a review from mhofman June 11, 2022 00:27
@erights erights force-pushed the markm-tests-use-debug-setting branch from 0c0beb3 to 563d020 Compare June 11, 2022 01:55
@erights erights merged commit c92e02a into master Jun 11, 2022
@erights erights deleted the markm-tests-use-debug-setting branch June 11, 2022 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants