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

test(ci): require some core tests #2966

Closed
outSH opened this issue Dec 27, 2023 · 4 comments · Fixed by #3013
Closed

test(ci): require some core tests #2966

outSH opened this issue Dec 27, 2023 · 4 comments · Fixed by #3013
Assignees
Labels
enhancement New feature or request Tests Anything related to tests be that automatic or manual, integration or unit, etc.
Milestone

Comments

@outSH
Copy link
Contributor

outSH commented Dec 27, 2023

I'd like to require certain tests to always pass before PR can be merged. The list is small to require only tests with no false-nagative results and no complex setup (i.e. no functional test suites). My proposition (in addition to already enabled weaver tests) would be:

  • Commit Lint / commitlint (pull_request)
  • Lint PR / Validate PR title (pull_request_target)
  • Cactus_CI / DCI-Lint (pull_request)
  • Cactus_CI / build-dev (pull_request)
  • Cactus_CI / yarn_lint (pull_request)
  • Cactus_CI / yarn_codegen (pull_request)
  • Cactus_CI / yarn_custom_checks (pull_request)
  • Cactus_CI / yarn_tools_validate_bundle_names (pull_request)
  • Cactus_CI / cactus-common (pull_request)
  • Cactus_CI / cactus-core (pull_request)
  • Cactus_CI / cactus-core-api (pull_request)

@petermetz @takeutak @izuru0 @jagpreetsinghsasan @VRamakrishna @sandeepnRES please let me know what you think.

@outSH outSH added enhancement New feature or request Tests Anything related to tests be that automatic or manual, integration or unit, etc. labels Dec 27, 2023
@petermetz petermetz self-assigned this Jan 24, 2024
@petermetz
Copy link
Contributor

@outSH Thank you for keeping track of these! Most of them are now enabled and set as required so we are making great progress, BUT there is one that I'm still looking into: the cactus-core pkg's tests for some reason pass fine on my local environment but fail in the CI and without any kind of error logged to the console. I'm suspicious that it has to do with the seg fault errors that we've been getting from Jest due to ESM problems, but those were always reproducible locally as well so I'm still investigating. Any ideas are most welcome as well!

@petermetz petermetz added this to the v2.0.0 milestone Jan 24, 2024
@outSH
Copy link
Contributor Author

outSH commented Jan 25, 2024

@petermetz Yeah, I've noticed this some time ago too and it indeed works flawlessly on my machine as well (even though I use roguhly exact same setup as CI!). This test was passing when I've created the list, I think it started failing after https://github.com/hyperledger/cacti/commit/d70488a82e9c1d6958ac3ab0368f3c3bfca378c6#diff-3dc426ffa27f30f292289225a0e941ab0406286a34d200e597748fce0414a90c but I also have no idea what is causing it, ESM problem seem possible

@petermetz
Copy link
Contributor

@outSH That link seems like a solid clue, thank you very much! I'll focus my investigation on that file and the code that it tests!

petermetz added a commit to petermetz/cacti that referenced this issue Feb 6, 2024
The fix was to start statically importing the http helper library we use
in `packages/cactus-core/src/main/typescript/web-services/handle-rest-endpoint-exception.ts`
instead of how it was (dynamic imports at runtime).

1. There have been reports of dynamic imports causing segmentation
faults in the NodeJS process when Jest is involved.
2. It is looking like this bug was another instance of that manifesting
but slightly differently because this time around Jest decided to hide
the stack trace of it as well.
3. Because of `2)` we have no specific evidence of the theory. We can only
say that the change in this commit made the problem go away, but since
there never was any crash logs or stack traces on the CI environment,
this remains a conjecture.
4. Trying to reproduce the issue locally failed even when using the
exact same versions of NodeJS and npm (and all the dependencies of course).
5. Based on `4)` it is likely that the segmentation fault is due to a
race condition in the lower level (C/C++) code of NodeJS and/or Jest.

Fixes hyperledger-cacti#2966

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Feb 6, 2024
This change makes it easier to read and debug some of the assertions of
the test case which are a little convoluted due to the usage of the Jest
spies.

These changes were done as part of another fix but ultimately turned out
to be not a factor for that fix and therefore I thought it bess to separate
the change out onto it's own PR to make it easier to review.

Related to hyperledger-cacti#2966 but this is not the actual fix.

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
@petermetz
Copy link
Contributor

@outSH I've just opened the PR to finish the last one. I can't prove it 100% but I think it's still Jest doing seg faults when we have dynamic imports in the code. My theory is that it only manifests on low core count CPUs with less parallelism and that's why we can't reproduce it at all on local machines.

petermetz added a commit to petermetz/cacti that referenced this issue Feb 7, 2024
The fix was to start statically importing the http helper library we use
in `packages/cactus-core/src/main/typescript/web-services/handle-rest-endpoint-exception.ts`
instead of how it was (dynamic imports at runtime).

1. There have been reports of dynamic imports causing segmentation
faults in the NodeJS process when Jest is involved.
2. It is looking like this bug was another instance of that manifesting
but slightly differently because this time around Jest decided to hide
the stack trace of it as well.
3. Because of `2)` we have no specific evidence of the theory. We can only
say that the change in this commit made the problem go away, but since
there never was any crash logs or stack traces on the CI environment,
this remains a conjecture.
4. Trying to reproduce the issue locally failed even when using the
exact same versions of NodeJS and npm (and all the dependencies of course).
5. Based on `4)` it is likely that the segmentation fault is due to a
race condition in the lower level (C/C++) code of NodeJS and/or Jest.

Fixes hyperledger-cacti#2966

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit that referenced this issue Feb 7, 2024
The fix was to start statically importing the http helper library we use
in `packages/cactus-core/src/main/typescript/web-services/handle-rest-endpoint-exception.ts`
instead of how it was (dynamic imports at runtime).

1. There have been reports of dynamic imports causing segmentation
faults in the NodeJS process when Jest is involved.
2. It is looking like this bug was another instance of that manifesting
but slightly differently because this time around Jest decided to hide
the stack trace of it as well.
3. Because of `2)` we have no specific evidence of the theory. We can only
say that the change in this commit made the problem go away, but since
there never was any crash logs or stack traces on the CI environment,
this remains a conjecture.
4. Trying to reproduce the issue locally failed even when using the
exact same versions of NodeJS and npm (and all the dependencies of course).
5. Based on `4)` it is likely that the segmentation fault is due to a
race condition in the lower level (C/C++) code of NodeJS and/or Jest.

Fixes #2966

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Feb 8, 2024
This change makes it easier to read and debug some of the assertions of
the test case which are a little convoluted due to the usage of the Jest
spies.

These changes were done as part of another fix but ultimately turned out
to be not a factor for that fix and therefore I thought it bess to separate
the change out onto it's own PR to make it easier to review.

Related to hyperledger-cacti#2966 but this is not the actual fix.

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit that referenced this issue Feb 8, 2024
This change makes it easier to read and debug some of the assertions of
the test case which are a little convoluted due to the usage of the Jest
spies.

These changes were done as part of another fix but ultimately turned out
to be not a factor for that fix and therefore I thought it bess to separate
the change out onto it's own PR to make it easier to review.

Related to #2966 but this is not the actual fix.

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Tests Anything related to tests be that automatic or manual, integration or unit, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants