Skip to content

Prune branches with unexpected mocks #1889

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

Merged
merged 12 commits into from
Mar 13, 2023
Merged

Conversation

EgorkaKulikov
Copy link
Collaborator

@EgorkaKulikov EgorkaKulikov commented Mar 3, 2023

Description

Fixes # (1560)

We need to stop symbolic execution if we called forceMock function and Do not mock strategy is used.
One of possible scenarios is when there are no implementations of an interface in project while NO_MOCKS strategy is selected.

To obtain this, some branch pruning is introduced.
Job cancellations are removed from mock listeners.

How to test

Automated tests

Corrected test: testMockInterfaceWithoutImplementorsWithNoMocksStrategy
Added test: testMockInterfaceWithoutImplementorsWithMockingStrategy

Manual tests

Scenario from issue.

Self-check list

  • I've set the proper labels for my PR (at least, for category and component).
  • PR title and description are clear and intelligible.
  • I've added enough comments to my code, particularly in hard-to-understand areas.
  • The functionality I've repaired, changed or added is covered with automated tests.
  • Manual tests have been provided optionally.
  • The documentation for the functionality I've been working on is up-to-date.

@EgorkaKulikov EgorkaKulikov added comp-symbolic-engine Issue is related to the symbolic execution engine ctg-bug-fix PR is fixing a bug labels Mar 3, 2023
@EgorkaKulikov EgorkaKulikov marked this pull request as draft March 3, 2023 10:23
@EgorkaKulikov EgorkaKulikov changed the title Listen that mock occured in forceMock method Prune branches with unexpected mocks (e.g. interface without impl mocks in DO_NOT_MOCK mode) Mar 6, 2023
@EgorkaKulikov EgorkaKulikov force-pushed the egor/force_mock_correction branch from abb9bf9 to ac8e68a Compare March 6, 2023 10:11
@EgorkaKulikov EgorkaKulikov marked this pull request as ready for review March 6, 2023 10:14
@EgorkaKulikov EgorkaKulikov changed the title Prune branches with unexpected mocks (e.g. interface without impl mocks in DO_NOT_MOCK mode) Prune branches with unexpected mocks Mar 6, 2023
Copy link
Member

@Damtev Damtev left a comment

Choose a reason for hiding this comment

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

There are some suspicious parts

@EgorkaKulikov EgorkaKulikov force-pushed the egor/force_mock_correction branch from a82d310 to a696c82 Compare March 7, 2023 08:06
@EgorkaKulikov EgorkaKulikov force-pushed the egor/force_mock_correction branch from 032a31a to efe2b62 Compare March 9, 2023 21:05
Copy link
Member

@CaelmBleidd CaelmBleidd left a comment

Choose a reason for hiding this comment

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

LGTM

@EgorkaKulikov EgorkaKulikov merged commit 511f13e into main Mar 13, 2023
@EgorkaKulikov EgorkaKulikov deleted the egor/force_mock_correction branch March 13, 2023 08:13
@EgorkaKulikov EgorkaKulikov linked an issue Mar 13, 2023 that may be closed by this pull request
denis-fokin pushed a commit that referenced this pull request Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-symbolic-engine Issue is related to the symbolic execution engine ctg-bug-fix PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UtBot mocks interface even when Do not mock is selected
3 participants