Repository navigation
Cli-testing migration : remove small dependencies #2548
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
Changes from all commits
98026ec
3d8d3c0
39db8c9
42df3fe
4ca47ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| export function requireEnv(name: string): string { | ||
| const value = process.env[name]; | ||
| if (!value) { | ||
| throw new Error(`Missing required environment variable: ${name}`); | ||
| } | ||
| return value; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,34 @@ | ||
| export default { | ||
| complianceRetention: 'COMPLIANCE', | ||
| governanceRetention: 'GOVERNANCE', | ||
| DEFAULT_SUBDOMAIN: 'my-company.com', | ||
| DEFAULT_TIMEOUT: 100000, | ||
| ACCOUNT_NAME: 'AccountTest', | ||
| INTERNAL_SERVICES_ACCOUNT_ID: '000000000000', | ||
| USER_NAME_TEST: 'userNameForTest', | ||
| POLICY_NAME_TEST: 'policyNameForTest', | ||
| ROLE_NAME_TEST: 'roleNameForTest', | ||
| BUCKET_NAME_TEST: 'bucketForTest', | ||
| K_CLIENT: 'zenko-ui', | ||
| MAX_ACCOUNT_CHECK_RETRIES: 100, | ||
| // Must match the file name cli-testing's S3.getObject writes downloaded objects to | ||
| OUTFILE_NAME: 'out.loc', | ||
| assumeRolePolicy: JSON.stringify({ | ||
| Version: '2012-10-17', | ||
| Statement: [ | ||
| { | ||
| Effect: 'Allow', | ||
| Action: ['iam:ListRoles', 'sts:AssumeRole'], | ||
| Resource: '*', | ||
| }, | ||
| ], | ||
| }), | ||
| assumeRoleTrustPolicy: JSON.stringify({ | ||
| Version: '2012-10-17', | ||
| Statement: { | ||
| Effect: 'Allow', | ||
| Principal: '*', | ||
| Action: 'sts:AssumeRole', | ||
| }, | ||
| }), | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| import assert from 'assert'; | ||
| import { exec } from 'child_process'; | ||
| import http from 'http'; | ||
| import { createHash } from 'crypto'; | ||
| import { createHash, randomBytes } from 'crypto'; | ||
| import { setTimeout as sleep } from 'timers/promises'; | ||
| import { Command, IAM, Identity, IdentityEnum } from 'cli-testing'; | ||
| import { | ||
| AttachedPolicy, | ||
|
|
@@ -15,10 +16,20 @@ import Zenko from 'world/Zenko'; | |
| import fs from 'fs'; | ||
| import { runOnceAcrossWorkers } from 'common/WorkerCoordination'; | ||
| import { ITestCaseHookParameter } from '@cucumber/cucumber'; | ||
| import { AWSCredentials, Utils } from 'cli-testing'; | ||
| import { AWSCredentials } from 'cli-testing'; | ||
| import { createBucketWithConfiguration, putObject } from '../steps/utils/utils'; | ||
| import { createJobAndWaitForCompletion } from '../steps/utils/kubernetes'; | ||
|
|
||
| export { sleep }; | ||
|
|
||
| export function randomString(): string { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
import { createHash, randomBytes } from 'crypto';
export function randomString(): string {
return randomBytes(5).toString('hex');
}Output becomes lowercase hex (
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah thank you |
||
| return randomBytes(5).toString('hex'); | ||
| } | ||
|
|
||
| export function isAccessKeys(object: Partial<AWSCredentials>): object is AWSCredentials { | ||
| return Boolean(object.accessKeyId && object.secretAccessKey && object.sessionToken !== ''); | ||
| } | ||
|
|
||
| export function assertBudgetFitsStepTimeout(budgetSeconds: number, stepTimeoutMs: number): void { | ||
| assert.ok( | ||
| budgetSeconds * 1000 < stepTimeoutMs, | ||
|
|
@@ -417,7 +428,7 @@ export async function prepareMetricsScenarios( | |
| } | ||
|
|
||
| await createJobAndWaitForCompletion(world, jobName, jobNamespace); | ||
| await Utils.sleep(2000); | ||
| await sleep(2000); | ||
| fs.writeFileSync(dataFile, JSON.stringify(output)); | ||
| }, | ||
| ); | ||
|
|
||
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.
this was double defined