The parent is talking about when the implementation is flaky, not the test. When you go to fix the problem under that scenario there is no reason for you to modify the test. The test is fine.
What you're describing is the every day reality but what you WANT is that if your implementation has a race condition, then you want a test that 100% of the time detects that there is a race condition (rather than 1% of the time).
If your test can deterministically result in a race condition 100% of the time, is that a race condition? Assuming that we're talking about a unit test here, and not a race condition detector (which are not foolproof).
> Assuming that we're talking about a unit test here
I think the categorisation of tests is sometimes counterproductive and moves the discussion away from what's important: What groups of tests do I need in order to be confident that my code works in the real world?
I want to be confident that my code doesn't have race conditions in it. This isn't easy to do, but it's something I want. If that's the case then your unit test might pass sometimes and fail sometimes, but your CI run should always be red because the race test (however it works) is failing.
This is also hints at a limitation of unit tests, and why we shouldn't be over-reliant on them - often unit tests won't show a race. In my experience, it's two independent modules interacting that causes the race. The same can be true with a memory bug caused by a mismatch in passing of ownership and who should be freeing, or any of the other issues caused by interactions between modules.
> I think the categorisation of tests is sometimes counterproductive
"Unit test" refers to documentation for software-based systems that has automatic verification. Used to differentiate that kind of testing from, say, what you wrote in school with a pencil. It is true that the categorization is technically unnecessary here due to the established context, but counterproductive is a stretch. It would be useful if used in another context, like, say: "We did testing in CS class". "We did unit testing in CS class" would help clarify that you aren't referring to exams.
Yeah, Kent Beck argues that "unit test" needs to bring a bit more nuance: That it is a test that operates in isolation. However, who the hell is purposefully writing tests that are not isolated? In reality, that's a distinction without a difference. It is safe to ignore old man yelling at clouds.
But a race detector isn't rooted in providing verifiable documentation. It only observes. That is what the parent was trying to separate.
> I want to be confident that my code doesn't have race conditions in it.
Then what you really WANT is something like TLA+. Testing is often much more pragmatic, but pragmatism ultimately means giving up what you want.
> often unit tests won't show a race.
That entirely depends on what behaviour your test is trying to document and validate. A test validating properties unrelated to race conditions often won't consistently show a race, but that isn't its intent so there would be no expectation of it validating something unrelated. A test that is validating that there isn't race condition will show the race if there is one.
You can use deterministic simulation testing to reproduce a real-world race condition 100% of the time while under test.
But that's not the kind of test that will expose a race condition 1% of the time. The kinds of tests that are inadvertently finding race conditions 1% of the time are focused on other concerns.
So it is still not a case of a flaky test, but maybe a case of a missing test.
Hey, author here: I completely agree, that's why I also haven't used those strange colours for https://nix-ci.com.
I just thought they would make for a cool visual representation of the point of the blog post.
nix-ci.com is built with this as one of the two central features.
The other is that it figures out what to do by itself; you don't have to write any YAML.
TFA doesn't say that "frustration tolerant" people tolerate problems, but that they tolerate frustration as they fix those problems "without succumbing to negative emotions or counterproductive behaviors".
I was far more frustration intolerant earlier in my career, part of which I can now attribute to undiagnosed AuDHD. Although I can't say that I've mastered frustration tolerance, I've learned to moderate it to the point that I'm far more effective now.
What the article fails to mention is that only in organizations of a certain complexity and dysfunction can the result of high frustration tolerance be referred to as progress.
The real key to success in complicated org is not just dealing effectively with frustration, but the ability to realize what the stakes really are in a complex organization. I've seen people promoted to the stratosphere not for successfully completing a project, but for keeping the wheels on the bus in spite of what happened to the project. This can at times involve repeatedly and energetically referring to failure as success.
> I’d be interested to hear how you’ve learned to moderate your response to frustration more effectively.
I loved @Schiendelman’s answer, and I believe that prioritizing mental and physical health is a prerequisite for tolerating frustration effectively. For me, it's been more about a change in practices and perspective.
For example, I never react in the moment to professional frustration beyond listening and asking sincere questions. I've learned that I need time to respond, and even to consider whether I should respond at all.
If I find myself awake at 4am ruminating about an aspect of my company or product, I remind myself that I may be taking it (and myself) a bit too seriously, and reassure myself that it can safely be tabled until tomorrow.
There's wisdom in the Serenity Prayer: "Grant me the serenity to accept the things I cannot change, courage to change the things I can, and wisdom to know the difference."
I have noticed that on the mornings where I do some exertion before anything else—a run, some yoga, etc.—that my ability to "receive" and process the things that come at me is so much better. It feels like there's a waiting room, whereas otherwise, whatever comes at me gets a 1:1 response.
Have you found weightlifting to be specifically beneficial, or is that just your morning workout of choice?
It is more beneficial than cardio in raising my base caloric burn, though I also like running and hiking when I can!
It takes less time each day than cardio for giving me the kind of focus and calm improvements I want.
It has a much bigger impact on physical appearance as well. Something I've learned is that more muscle mass really does translate to more respectful treatment from basically every other human in your life.
The masochists are all too happy to do something the hard way in perpetuity. But they are in the smart-industrious quadrant and they will burn up man-hours like no tomorrow. Their goal is to fill a week not get stuff done.
You can be the person who jumps on the tedious tasks and that’s fine - as one personality in a diverse team. I worked on a project with all super senior people who never wanted to do any tedious work, ever. Over the course of a year the project started to more and more resemble Second System Syndrome, as each dev contributed an “engine“ or “framework” to perform Task Golf and never write any boring code. That’s just as bad as all masochists.
But a masochist that insists everyone else experience pain too is now a sadist. And from a progress standpoint that’s probably the worst monoculture to have.
At a pivotal point in my career growth, I got stuck with a project I had grown tired of while a more stimulating project was being spun up with new hires. I was “too important” to the old project and shut out. I did not enjoy that experience.
I’ve always been a pretty decent writer, and a passable tutor. It wasn’t that I couldn’t divest knowledge to other people, we just hadn’t made the time. I never did get onto that other project, the company started spiraling before I convinced that manager the team could deal without me. But I have seen what happens when a senior person becomes the bottleneck, or when only one voice champions an idea in meetings, and I do a better job of carving out bits of subject matter to co-create with peers or bequeath to people I’m mentoring. There’s plenty of breathing room between Work Yourself Out of a Job and Being Indispensable, where you have enough capacity that you can participate in new ideas that strike your fancy.
Are the Lazy variants ever a good idea? The author already argues against lazy IO. Are Lazy variants worth using for anything else? I always thought Haskell is typeful and that Lazy variants hide too much under the covers that should be exposed in the types.
Also I still don’t think there’s a great argument for [Char] other than its historical baggage.
reply