Skip to content

test: improve ssz tests consistency - #6776

Merged
wemeetagain merged 2 commits into
ChainSafe:electra-forkfrom
jeluard:jeluard/more-consistent-ssz-tests
May 16, 2024
Merged

test: improve ssz tests consistency#6776
wemeetagain merged 2 commits into
ChainSafe:electra-forkfrom
jeluard:jeluard/more-consistent-ssz-tests

Conversation

@jeluard

@jeluard jeluard commented May 14, 2024

Copy link
Copy Markdown
Contributor

Motivation

Make sure all tests always run

Description

Do not throw an error when an SSZ type is missing, but rather fail a test.
This let subsequent generated tests run not matter what, ensuring the tests count is consistent.

@jeluard
jeluard requested a review from a team as a code owner May 14, 2024 13:51
(ssz.altair as Types)[typeName] ||
(ssz.phase0 as Types)[typeName];
if (!sszType) {
throw Error(`No type for ${typeName}`);

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.

doesn't this just result in strange errors downstream if we don't throw here and exit the test run?

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.

Makes sense. I updated so that when sszType is null, associated tests are not run at all; also improved the error message to be more meaningfull.
Compared to the original Error based approach, a missing SSZ type will not prevent further tests to be run (the Error would short-circuit the logic)

@nflaig nflaig left a comment

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.

Still not sure this improves the situation, could you provide the output of running the ssz_static tests with a missing ssz type before vs. after your changes

@jeluard

jeluard commented May 15, 2024

Copy link
Copy Markdown
Contributor Author

The main thing that it improves, besides better error message giving some context, is that further tests are not short-circuited.
Currently all tests related to types defined after the missing one will not be generated/Executed as the Error short-circuit the whole dynamic test generation.
With this change, a single test fail related to the missing types, and all tests are run for further types (if they are existing).

@nflaig

nflaig commented May 15, 2024

Copy link
Copy Markdown
Member

besides better error message giving some context, is that further tests are not short-circuited

I understand that but can you provide a before vs. after example

@wemeetagain wemeetagain left a comment

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.

Makes sense to me.
The test count is still variable, but at least one missing ssz type won't cause an unknown number of unrelated ssz type tests from being suppressed.

@wemeetagain
wemeetagain merged commit 68ded3d into ChainSafe:electra-fork May 16, 2024
g11tech pushed a commit that referenced this pull request May 24, 2024
* test: improve ssz tests consistency

* chore: address comments
g11tech pushed a commit to g11tech/lodestar that referenced this pull request Jun 19, 2024
* test: improve ssz tests consistency

* chore: address comments
g11tech pushed a commit that referenced this pull request Jun 25, 2024
* test: improve ssz tests consistency

* chore: address comments
g11tech pushed a commit that referenced this pull request Jun 25, 2024
* test: improve ssz tests consistency

* chore: address comments
g11tech pushed a commit that referenced this pull request Jul 1, 2024
* test: improve ssz tests consistency

* chore: address comments
g11tech pushed a commit that referenced this pull request Jul 30, 2024
* test: improve ssz tests consistency

* chore: address comments
g11tech pushed a commit that referenced this pull request Jul 31, 2024
* test: improve ssz tests consistency

* chore: address comments
g11tech pushed a commit that referenced this pull request Aug 2, 2024
* test: improve ssz tests consistency

* chore: address comments
g11tech pushed a commit that referenced this pull request Aug 9, 2024
* test: improve ssz tests consistency

* chore: address comments
g11tech pushed a commit that referenced this pull request Aug 9, 2024
* test: improve ssz tests consistency

* chore: address comments
g11tech pushed a commit that referenced this pull request Aug 23, 2024
* test: improve ssz tests consistency

* chore: address comments
g11tech pushed a commit that referenced this pull request Aug 27, 2024
* test: improve ssz tests consistency

* chore: address comments
philknows pushed a commit that referenced this pull request Sep 3, 2024
* test: improve ssz tests consistency

* chore: address comments
@wemeetagain

Copy link
Copy Markdown
Member

馃帀 This PR is included in v1.22.0 馃帀

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