Representative Line: Unique Testing
Nikolai M's team had a flaky CI/CD build. About 0.5% of the time, one of their tests would fail: frequent enough to be annoying, but not so frequent that it motivated management to assign anybody to investigate. Nikolai eventually dug in, taking the initiative.
Microsoft's implementation of UUIDs calls them GUIDs. The GUID is, per the docs, really just a wrapper around UUID algorithms, and supports a variety of different UUID variants. I'm sure at some historical point, this wasnt't true, and Microsoft had some weird internal algorithm. That's not really here nor there, but the test that was failing was failing because of an assertion relating to GUIDs.
Assert.DoesNotContain("000", transactionId.ToString());transactionId is a GUID. This line converts it to a string and checks if it contains "000". They're attempting to check if it's an empty UUID, and they've assumed that three sequential zeroes in the output would be an impossible event. This is untrue. Nikolai measured it, and found it happens 0.5527% of the time- 1-in-181.
So this is a bad test, and could be made better with a more thorough check. Or it could leverage the built in constant GUID.Empty, which is a UUID where every bit is zero.
And it's that which really bugs me, honestly. Even if you didn't know about the constant, the idea of constructing an empty GUID seems like the obvious choice. Though I suppose you'd have to check the docs to find out how to construct a GUID directly, and if you're already reading the docs, the chances of you seeing the built-in constant are probably higher than 0.5527%.
[Advertisement] Picking up NuGet is easy. Getting good at it takes time. Download our guide to learn the best practice of NuGet for the Enterprise.45 minute delays on major Essex route due to lorry fire
45 minute delays on major Essex route due to lorry fire
DAILY MAIL COMMENT: Labour is betraying Britain by caving in to its Leftist factions
I'm a nutritionist, here's the best breakfast, lunch and dinner to eat to prevent a heart attack - and they're all cheap as chips
Donald Trump says he is 'surprised' five British men were released on bail after material found in terror suspect vans 'not viable explosives'
Burnham to vow public control of energy, water and housing while signalling end of pension triple lock in conference speech
Harry Styles and fiancee Zoe Kravitz are seen slipping out of the same luxury car in NYC
Scrap fuel duty hike before diesel hits £3, ministers tell John Healey
ANDREW NEIL: Healey was too busy boasting about his miner's lamp to explain how he'll pay for all that 'hope'
What are savings platforms and should you use one?
Lidl could open in Wickford high street building that's sat empty for years
'Suffering' Thurrock high street set to be revived in huge 'masterplan'
Google ending ChromeOS support two years early
Saved by the Bell star Dennis Haskins who played iconic Principal Belding dead at 75
Labour minister claims that visions of Britain based on warm ale, pubs, and black labradors are a 'far-Right' fantasy that 'never really existed'
Domestic abuse survivor calls for Clare's Law reform after 'two month wait'
Witham residents invited to have their say on £54,000 outdoor table tennis plans
Domestic abuse survivor calls for Clare's Law reform after 'two month wait'
Bananas That Don't Go Brown To Hit Supermarkets Thanks to DNA Editing
Read more of this story at Slashdot.