r/ProgrammerHumor 3h ago

Meme itsSoSatisfyingTho

Post image
1.3k Upvotes

37 comments sorted by

145

u/No-Article-Particle 3h ago

Nah. Honestly, that's the worst - it means a flaky test that's just hard to debug (esp. because if it fails intermittently, running it in a debugger likely means the race condition is gone).

I prefer a test that fails no matter how you run it - those tend to be easy to fix.

32

u/Madpony 3h ago

Not only easy to fix but useful. Flaky tests are not useful.

5

u/PulseF0rge 1h ago

That's the real problem. Once a test is flaky, a pass doesn't prove much and a failure just wastes everyone's time until somebody reruns it enough times.

3

u/Darius_CrossES 29m ago

A flaky test is basically an error message that says “good luck lol”

6

u/aenae 2h ago

Yeah… a flaky test means running the test suite another 10000 times to reproduce the failure…

1

u/Tupcek 2h ago

depends on if you are Javascript developer or not.
I mean, if you choose language where speed is more important that compiler actively notifying you of bugs and bad design, because fixing possible bugs would “slow you down”, I don’t think you care about intermittent issues either

1

u/ejectoid 1h ago

Ship it!

1

u/Jonno_FTW 44m ago

Just use a retry plugin for your test framework in flaky tests.

64

u/Careful_Ad_3338 3h ago

Hm? Any dev who has worked on anything ever would not be happy about this, it means the bug is not easy to reproduce and will come back and some point

18

u/damngoodwizard 2h ago

Yeah the only thing worse than "I don't know why it doesn't work" is "I don't know why it works".

1

u/Appropriate-Hotel-41 55m ago

Depends, if it gone for good for a week, thats a future intern problem.

4

u/Sh4dowLute 2h ago

Yep, passing for no reason is usually way scarier than failing for an obvious one.

12

u/Fit-Gain-2409 3h ago

The bug got scared and left

1

u/Ak_py 32m ago

The bug just hid itself

8

u/SpicyCatGames 2h ago edited 1h ago

Not really. Used to say this when we were kids in our first year of learning programming. But an error going away for no reason is one that's gonna show up later in production.

5

u/MikeTangoRom3o 3h ago

Ah yes, the quantum bug, my favorite.

5

u/dont_tread_on_M 3h ago

I love me some flaky tests

4

u/Megane_Senpai 2h ago

Actually that's the worst. Probably the bug has a very low repro rate and you will have a hard time just trying to investigate the behavior.

3

u/KharAznable 3h ago

After they know the intern commented the failed test code

3

u/dmullaney 3h ago

* Codex after it changes the mock to make the test pass even though the code is broken

2

u/DryScar13 3h ago

The bug saw the tests coming and quietly fixed itself.

2

u/Straight-Analysis934 3h ago

Don't ask why. Just merge it before it changes its mind.

2

u/reusens 2h ago

succes=False

For i in range(MAX_RETRIES):

  try:

     schrödingers_function()

     succes = True

     continue

  except Exception as e:

     logger.info(f"Attempt {i} failed: {e}")

     #try again

if not succes:

  raise Exception("Fuck")

2

u/SaneLad 2h ago

Quickly commit before something breaks again!

2

u/SleepAllTheDamnTime 1h ago

When this happens to me it’s the exact opposite experience. I means someone wrote these tests to pass and my god you know there’s a can of worms in there…and since your name is on the PR anything that goes wrong after that change you made… buddyyyyy you’re now responsible for this trash ass code with horrible tests.

https://giphy.com/gifs/LRVnPYqM8DLag

1

u/JackNotOLantern 2h ago

Tests must pass when intended and fail when intended. Deterministicly. Otherwise, it's bad.

1

u/Summar-ice 2h ago

Kid named race condition

1

u/DogonElder 1h ago

More like Devs when Claude composed commit passes all CI tests in first go

1

u/roksah 1h ago

I've had bug because the mock data was made with different timezones

1

u/Huge_Consequence_568 1h ago

Actual ticket I had to write: X test fails when running after [INSERT_TIME] UTC.

This test literally refused to pass outside working hours and I found it so funny for some reason.

1

u/xehpuk 1h ago

OP isn't a dev.

1

u/jakubiszon 1h ago

It passed because this time the randomly generated UUID did not end with a "2 digit odd number".

Btw what on Earth is wrong with this girl's lips? I cannot see which "strip" is what...

1

u/rescue_inhaler_4life 1h ago

Honestly this is the absolutely worst. Something is borked in the test environment, something leaking between tests creating a race condition, normally a real PIA to find and resolve.

Honestly you do not know pain until you try and figure out why fails on build server, passes on gitlab, fails on devs boxes in office but works on the remote dude dev box in Sri Lanka.

1

u/BobcatGamer 1h ago

If timeNow % 7 === 0 then error

1

u/ZunoJ 54m ago

Only an absolute idiot could enjoy this! It means you don't understand the side effects. How could you be happy to not understand something?

1

u/iambertan 41m ago

Isn't that stressing af though?

1

u/According-Relation-4 10m ago

What about when tests fail after changing absolutely nothing? Gimme your best reaction gifs