Page MenuHomePhabricator

[services] Tunnelbroker - Tests for `validateUUIDv4` function
ClosedPublic

Authored by max on Jul 7 2022, 4:55 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 2, 6:20 PM
Unknown Object (File)
Oct 19 2024, 7:56 AM
Unknown Object (File)
Oct 18 2024, 7:40 PM
Unknown Object (File)
Oct 15 2024, 12:21 AM
Unknown Object (File)
Oct 15 2024, 12:07 AM
Unknown Object (File)
Oct 7 2024, 10:34 AM
Unknown Object (File)
Oct 7 2024, 10:34 AM
Unknown Object (File)
Oct 7 2024, 10:33 AM

Details

Summary

This diff introduces tests for a validateUUIDv4 function from D4467 which validate generated UUIDs.

Test Plan

Expected test results on run yarn test-tunnelbroker-service-in-sandbox.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

max held this revision as a draft.
karol added inline comments.
services/tunnelbroker/test/ToolsTest.cpp
44 ↗(On Diff #14250)

nit: maybe we could reuse the string from the previous case and just use a substring here?

We can also add some tests with characters greater than f.
One really important test to add is a failing test with uppercase letters. We're implicitly assuming that all the clients will use lowercase letters for this id, so we should document it somewhere (as a test) to make it more explicit.

This revision is now accepted and ready to land.Jul 8 2022, 2:21 AM

Rebase on stack changes.
Test on invalid format with character greater than F was added.
Test on an uppercase UUID format was added.

max retitled this revision from [services] Tunnelbroker - Tests for `validateUUID` function to [services] Tunnelbroker - Tests for `validateUUIDv4` function.Jul 12 2022, 5:05 PM
max edited the summary of this revision. (Show Details)
In D4468#127460, @palys-swm wrote:

We can also add some tests with characters greater than f.

I've changed the invalid UUID to use a character greater than F instead of the invalid length. That makes more sense.

One really important test to add is a failing test with uppercase letters. We're implicitly assuming that all the clients will use lowercase letters for this id, so we should document it somewhere (as a test) to make it more explicit.

That makes sense to me. I've changed the regex in D4467 to match only the lowercase UUIDs and added the failing test for the uppercase UUID.

services/tunnelbroker/test/ToolsTest.cpp
44 ↗(On Diff #14250)

nit: maybe we could reuse the string from the previous case and just use a substring here?

On the updated version it was changed to use the wrong format with the character greater than F.

This revision was automatically updated to reflect the committed changes.
max marked an inline comment as done.