chore: Use timestamp instead of random number for test resource names#1497
chore: Use timestamp instead of random number for test resource names#1497manupedrozo merged 3 commits intomasterfrom
Conversation
20e3803 to
23b6647
Compare
23b6647 to
42f5481
Compare
|
Only organization tests failing - known issue: CLOUDP-332705 |
|
|
||
| # setting projectName | ||
| projectName="cfn-bot-access-list-$((1 + RANDOM % 10000))" | ||
| projectName="cfn-bot-access-list-$(date +%s)" |
There was a problem hiding this comment.
is it in seconds or milliseconds? in case we need to add a random to timestamp.
thinking in case of publishing a resource to multiple regions, script would be executed multiple times at almost the same time
There was a problem hiding this comment.
Good catch! Switching to ms here b7688b9
| fi | ||
|
|
||
| # setting projectName | ||
| projectName="cfn-bot-access-list-$((1 + RANDOM % 10000))" |
There was a problem hiding this comment.
from PR description was curious how we got to this work, is there any related CLOUDP or related PR in which we detected this issue?
There was a problem hiding this comment.
Saw tests failing due to duplicated names while merging sdk updates. Need to re-run in those cases to roll the dice again.
|
|
||
| # setting projectName | ||
| projectName="cfn-bot-access-list-$((1 + RANDOM % 10000))" | ||
| projectName="cfn-bot-access-list-$(date +%s%3N)" |
There was a problem hiding this comment.
I think this will work fine in Linux and GHA, but won't work in Mac:
# Expected: ct-alert-config-1733356800123
# Actual: ct-alert-config-1733356800N
↑
literal "N", not milliseconds
The %3 part is ignored, and %N becomes a literal "N" character.
not sure if keep the random, maybe bigger 😅 or timestamp in seconds + random, e.g.:
projectName="cfn-bot-access-list-$(date +%s)$(1 + RANDOM % 10000)"
There was a problem hiding this comment.
Sad. Going with seconds + random. Thanks!
EspenAlbert
left a comment
There was a problem hiding this comment.
Ty! However, would be awesome if we also supported reading the projectName from an env-var so it is simpler to debug and test locally
Move to use timestamps when generating test resource names.
The current approach can generate duplicate names which cause failures for the resources that require unique names.
It is also confusing to see duplicates in the UI when debugging issues.
Link to any related issue(s):
Type of change:
expected)
Manual QA performed:
Required Checklist:
make fmtand formatted my codeworks in Atlas
Further comments