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

Fix TestSuicideByHeldItem and TestSuicideByHeldItemSpreadDamage #33030

Merged

Conversation

FluffMe
Copy link
Contributor

@FluffMe FluffMe commented Oct 27, 2024

About the PR

When Content.Shared.Atmos.Atmospherics.LowPressureDamage is set to anything other than 1 or 0 TestSuicideByHeldItem and TestSuicideByHeldItemSpreadDamage fail assertions of damage done.

With LowPressureDamage = 4

  Failed TestSuicideByHeldItemSpreadDamage [475 ms]
  Error Message:
     Assert.That(damageableComp.Damage.DamageDict["Slash"], Is.EqualTo(lethalDamageThreshold / 2))
  Expected: 100
  But was:  99
  Failed TestSuicideByHeldItem [955 ms]
  Error Message:
     Assert.That(damageableComp.Damage.DamageDict["Slash"], Is.EqualTo(lethalDamageThreshold))
  Expected: 200
  But was:  198

The tests are fine with Atmospherics.LowPressureDamage = 1 due to rounding up to next integer (199.5->200) which is why this issue was not spotted sooner.

I've noticed that tests fail only on full or expanded test runs.
Example: --filter SuicideCommandTests passes, --filter Commands fails.
The test player must take a tick of barotrauma damage at some point.

Healing all damage before running the command and the damage assertions fixes the issue.

Special thanks to @SlamBamActionman for tracking down the bug.

Why / Balance

Bug fix. Needed downstream due to changed low pressure damage.

Technical details

DamageableSystem.SetAllDamage() to 0 before running the commands and asserting the damage.

Media

N/A

Requirements

Breaking changes

N/A

Changelog
Not player facing

@lzk228
Copy link
Contributor

lzk228 commented Oct 27, 2024

god bless you

@Plykiya
Copy link
Contributor

Plykiya commented Oct 27, 2024

thanks for fixing my jank test

@SlamBamActionman SlamBamActionman added the S: Approved Status: Reviewed and approved by at least one maintainer; a PR may require another approval. label Oct 27, 2024
Copy link
Member

@slarticodefast slarticodefast left a comment

Choose a reason for hiding this comment

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

Code looks good, thanks for the fix!

@slarticodefast slarticodefast merged commit 08d0077 into space-wizards:master Oct 28, 2024
12 checks passed
@FluffMe FluffMe deleted the upstream/fix-suicide-tests branch October 28, 2024 16:20
iaada pushed a commit to iaada/space-station-14 that referenced this pull request Nov 9, 2024
Doctor-Cpu pushed a commit to Doctor-Cpu/space-station-14 that referenced this pull request Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: Approved Status: Reviewed and approved by at least one maintainer; a PR may require another approval.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants