Repository navigation
Cli-testing migration : remove small dependencies - #2548
Conversation
Hello sylvainsenechal,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
5931178 to
171a3f7
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
| storageAccountOwner: process.env.STORAGE_ACCOUNT_OWNER || 'storage_account_owner', | ||
| dataConsumer: process.env.DATA_CONSUMER || 'data_consumer', | ||
| dataAccessor: process.env.DATA_ACCESSOR || 'data_accessor', | ||
| account: requireEnv('ACCOUNT'), |
There was a problem hiding this comment.
should we not use the values from default ?
otherwise the values -like ACCOUNT_NAME ?- there should be dropped (note: having stuff defined in a single place is better indeed, but not sure it is so good to require everything to come from env : this will make it harder to eventually drop the startup bash script and run/debug simply with yarn/...)
There was a problem hiding this comment.
honestly the state of this file is still pretty bad
Ctst is mixing env var var with proper cucumber parameters, so eventually it would be nice to just use one of the two, and have constants defined in the tests directly if its not needed by the setup files. Here I was just doing quick cleanup but its not super important for the goal of this pr
I just think for later its better to have the same behavior for all these var so that its easier to spot the utilisation of env var when doing a refactoring, if we use default value we might missed it
There was a problem hiding this comment.
my point here is that you added default values for ACCONT in constants.ts : so either it should be removed from the constants, or it should be used... but I don't see either: it is removed here, and I don't see where we use it.
on the scope of PR :
- not clear how this is "quick cleanup", and completely unrelated to the "remove small dependencies" goal which already touches so many lines/files
- there is something do be done abut config - yes. But the proper way would be that we consistently use properly typed data, and do the mapping from env (or default) just once. Like build a cucumber
Worldonce from env and default, for exemple. But until we define (and start working) where we are, just rewriting the code one way or another looks like churn...
There was a problem hiding this comment.
I'm removing the last 2 commits, it's not important to deal with these now we can do it later.
I just wanna remove imports from cli-testing on this pr
francoisferrand
left a comment
There was a problem hiding this comment.
- LGTM, but I don't really see the point: it is not better or worse, just different
- But I don't understand the move of
constants.ts: we we define such defaults, why not use them (inrequireEnv) ? Here you just remove all defaults, yet we know that we want to move most of the defaults in the code anyway: so changing the code while knowing we will still need to change again...
ba7b129 to
087ac65
Compare
| accountKey: string; | ||
| }; | ||
|
|
||
| function requireEnv(name: string): string { |
There was a problem hiding this comment.
this was double defined
|
Btw I agree it's not a super useful pr, i'm trying to remove the dependency on cli-testing, I'm breaking it down a bit starting with this easy one because there are 2 more and it will be a lot of code in a single pr |
| import { createBucketWithConfiguration, putObject } from '../steps/utils/utils'; | ||
| import { createJobAndWaitForCompletion } from '../steps/utils/kubernetes'; | ||
|
|
||
| export function sleep(ms: number): Promise<void> { |
There was a problem hiding this comment.
Node already ships this: timers/promises exposes a promisified setTimeout.
| export function sleep(ms: number): Promise<void> { | |
| export { setTimeout as sleep } from 'timers/promises'; |
| return new Promise(resolve => setTimeout(resolve, ms)); | ||
| } | ||
|
|
||
| export function randomString(): string { |
There was a problem hiding this comment.
crypto can do this in one line:
import { createHash, randomBytes } from 'crypto';
export function randomString(): string {
return randomBytes(5).toString('hex');
}Output becomes lowercase hex (0-9a-f) instead of mixed-case alphanumeric. Fine here: names stay 10 chars, collisions stay negligible for tests 🤷♂️
There was a problem hiding this comment.
yeah thank you
| const accessKeys = await SuperAdmin.generateAccountAccessKey({ accountName }); | ||
| if (!Utils.isAccessKeys(accessKeys)) { | ||
| if (!isAccessKeys(accessKeys)) { | ||
| throw new Error('Failed to generate account access keys for site ${siteKey}'); |
There was a problem hiding this comment.
Unrelated to this commit: these error strings use single quotes, so ${siteKey} isn't interpolated.
…Keys helpers Issue: ZENKO-5372
087ac65 to
4ca47ad
Compare
|
/approve |
Build failedThe build for commit did not succeed in branch improvement/ZENKO-5372 The following options are set: approve |
|
/approve |
|
I have successfully merged the changeset of this pull request
The following branches have NOT changed:
This pull request did not target the following hotfix branch(es) so they
Please check the status of the associated issue ZENKO-5372. Goodbye sylvainsenechal. The following options are set: approve |
ZENKO-5372
Moving from cli-testing directly into this codebase :
Upcoming work for cli-testing, 2 more tickets :
Kubernetes client
Sdk commands