-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat(cts): generate tests for helpers #2798
Conversation
✗ The generated branch has been deleted.If the PR has been merged, you can check the generated code on the |
8a51cc3
to
04b4cd7
Compare
tests/CTS/client/search/helpers.json
Outdated
"object": "$client", | ||
"path": "generateSecuredApiKey", | ||
"parameters": { | ||
"parentAPIKey": "2640659426d5107b6e47d75db9cbaef8", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no worries this is our search api key, this means the generated key is usable for e2e
I was about to start adding those tests for PHP by hand, is it still useful or should I wait for this PR to be merged ? |
0ed2041
to
6f93939
Compare
2207ebe
to
ec3f8c8
Compare
ec3f8c8
to
423e43b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks awesome
Object.prototype.toString.call(parameters[key]) === '[object Array]' | ||
? parameters[key].join(',') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this will break something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it did break something, it wasn't working before with generateSecuredApiKey, but you agree with me that never ever do we have a query param that looks like a serialezed object right ? we only allow primitives and array to stringified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup but IIRC this implem was exactly the same as the legacy client but since I never found the reason why it had an object case :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay but we don't have any tests that expect that, and we don't have the same behavior in other languages, this was an outlier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can revert this if you want, but I think this is more correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think so but since it worked like that for years I think there's an edge case we are not aware of :/ we can leave it and see if there's complains
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted in b9ff92c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah bah it breaks the test because now it adds brackets to stringified array, thats why I had to put the .join(',')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mostly wonder how it could've been wrong for 4 years in the current JS client, maybe the engine supports this format?
Your initial solution is indeed correct to me, we can go with it and if user complain we fix it (we can also for example try it on the Crawler migration PoC too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good, the PR should be fine then
if isinstance(value, dict): | ||
return dumps(value) | ||
elif isinstance(value, list): | ||
if isinstance(value, list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does list validates dict? that's why you changed the order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing as for js, we never want to stringify a dict
This reverts commit b9ff92c.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤞🏻 🍀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐍
🧭 What and Why
DI-2464
Use the helper spec to generate tests, starting with the simplest: generateSecuredApiKey