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

Adds a warning if the Server method of a TestFixture is called before Finalize #2047

Merged
merged 3 commits into from
Jul 26, 2023

Conversation

arjo129
Copy link
Contributor

@arjo129 arjo129 commented Jul 25, 2023

Summary

This PR adds a warning if someone were to call Server() before Finalize. The rationale for this is because I made the mistake of not calling Finalize ina program I was writing. It took me some time to track down the root cause of the problem. I figure if we warn users it should be immediately obvious.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

before `Finalize

This commit adds a warning if someone were to call `Server()` before
`Finalize`. The rationale for this is because I made the mistake of not
calling `Finalize` ina program I was writing. It took me some time to
track down the root cause of the problem. I figure if we warn users it
should be immediately obvious.

Signed-off-by: Arjo Chakravarty <[email protected]>
@arjo129 arjo129 requested a review from mjcarroll as a code owner July 25, 2023 02:56
@github-actions github-actions bot added the 🏰 citadel Ignition Citadel label Jul 25, 2023
@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #2047 (0ad5478) into ign-gazebo3 (e22e381) will increase coverage by 0.03%.
The diff coverage is 100.00%.

❗ Current head 0ad5478 differs from pull request most recent head eb4dc9f. Consider uploading reports for the commit eb4dc9f to get more accurate results

@@               Coverage Diff               @@
##           ign-gazebo3    #2047      +/-   ##
===============================================
+ Coverage        70.73%   70.77%   +0.03%     
===============================================
  Files              262      262              
  Lines            16760    16764       +4     
===============================================
+ Hits             11856    11865       +9     
+ Misses            4904     4899       -5     
Files Changed Coverage Δ
src/TestFixture.cc 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

@@ -210,6 +210,13 @@ TestFixture &TestFixture::OnPostUpdate(std::function<void(
//////////////////////////////////////////////////
std::shared_ptr<Server> TestFixture::Server() const
{
if (!this->dataPtr->finalized)
{
ignwarn << "Fixture has not been finalized, any functions you attempted"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use gzwarn instead to make forward porting easier?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think gzwarn is available in citadel. It might be worth considering back porting the functionality to reduce the maintenance overhead.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not. If we go ahead and do the forward port while it's "fresh" we can minimize some pain

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, sorry. For some reason I thought they were. @mjcarroll would there be an issue if we added those to gz-common3 at some point?

arjo129 added 2 commits July 26, 2023 00:31
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
@arjo129 arjo129 merged commit 56ed4b0 into ign-gazebo3 Jul 26, 2023
@arjo129 arjo129 deleted the arjo/feat/warn_when_using_unfinallized_server branch July 26, 2023 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants