Skip to content

Commit a69ef8d

Browse files
committed
runtime-test-base Added service names and fixed tests
1 parent 3fe6039 commit a69ef8d

File tree

147 files changed

+506
-285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+506
-285
lines changed

.scripts/generate-runtime-index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ function generateIndexFor(cloud: string) {
2525
return !file.endsWith(".test.ts") && !file.endsWith("index.ts") && !file.includes(" copy");
2626
});
2727

28+
runtimeFiles.sort();
29+
2830
if (runtimeFiles.length === 0) {
2931
console.warn(`⚠️ No runtime files found in ${runtimeDir}`);
3032
return;
@@ -41,7 +43,7 @@ function generateIndexFor(cloud: string) {
4143
`
4244
/* eslint-disable */
4345
/**
44-
* This file is auto-generated by the "bun generate-runtime-index" command.
46+
* This file is auto-generated by the "npm run generate-runtime-index" command.
4547
* Do not modify this file directly.
4648
*/
4749
${imports.join("\n")}

.scripts/update-service-name.ts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { Glob } from "bun";
2+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
3+
import { resolve } from "node:path";
4+
5+
updateServiceName("aws");
6+
updateServiceName("gcp");
7+
updateServiceName("azure");
8+
9+
function updateServiceName(cloud: string) {
10+
const runtimeDir = resolve(import.meta.dir, "../runtime", cloud);
11+
12+
if (!existsSync(runtimeDir)) {
13+
return;
14+
}
15+
16+
const runtimeGlob = new Glob("**/*.ts");
17+
18+
const results = runtimeGlob.scanSync({
19+
absolute: true,
20+
cwd: runtimeDir,
21+
onlyFiles: true
22+
});
23+
24+
const runtimeFiles = Array.from(results).filter(file => {
25+
return !file.endsWith(".test.ts") && !file.endsWith("index.ts") && !file.includes(" copy");
26+
});
27+
28+
runtimeFiles.sort();
29+
30+
if (runtimeFiles.length === 0) {
31+
return;
32+
}
33+
34+
runtimeFiles.forEach(file => {
35+
const fileContents = readFileSync(file, "utf-8");
36+
const serviceName = file.split("/").at(-2);
37+
38+
if (!serviceName) {
39+
console.error(`No service name found for ${file}`);
40+
return;
41+
}
42+
43+
if (fileContents.includes("serviceName:")) {
44+
console.error(`Service name already exists in ${file}`);
45+
return;
46+
}
47+
48+
const indexOfExport = fileContents.indexOf("} satisfies RuntimeTest");
49+
50+
if (indexOfExport === -1) {
51+
console.error(`No export found in ${file}`);
52+
return;
53+
}
54+
55+
const updatedFileContents =
56+
fileContents.slice(0, indexOfExport) +
57+
`,\n serviceName: "${serviceName}",\n` +
58+
fileContents.slice(indexOfExport);
59+
60+
writeFileSync(file, updatedFileContents);
61+
62+
console.log(`✅ Updated service name in ${file}`);
63+
});
64+
}

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "module",
44
"scripts": {
55
"build": "tsc -b --incremental",
6-
"test": "npm run test",
6+
"test": "bun test",
77
"prepare": "husky",
88
"prettier:lint": "prettier --config .prettierrc.cjs --cache --cache-location .cache/prettier --check .",
99
"lint:files": "env TIMING=1 eslint --quiet",

runtime/aws/AWS CloudTrail/check-cloudtrail-enabled.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,6 @@ export default {
9696
}
9797
],
9898
severity: "MEDIUM",
99-
execute: checkCloudTrailEnabled
99+
execute: checkCloudTrailEnabled,
100+
serviceName: "AWS CloudTrail"
100101
} satisfies RuntimeTest;

runtime/aws/AWS CloudTrail/check-cloudtrail-encryption.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,6 @@ export default {
7474
}
7575
],
7676
severity: "MEDIUM",
77-
execute: checkCloudTrailEncryption
77+
execute: checkCloudTrailEncryption,
78+
serviceName: "AWS CloudTrail"
7879
} satisfies RuntimeTest;

runtime/aws/AWS CloudTrail/check-cloudtrail-kms-encryption.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,6 @@ export default {
7676
}
7777
],
7878
severity: "MEDIUM",
79-
execute: checkCloudTrailKmsEncryption
79+
execute: checkCloudTrailKmsEncryption,
80+
serviceName: "AWS CloudTrail"
8081
} satisfies RuntimeTest;

runtime/aws/AWS CloudTrail/check-cloudtrail-log-validation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,6 @@ export default {
8080
}
8181
],
8282
severity: "MEDIUM",
83-
execute: checkCloudTrailLogValidation
83+
execute: checkCloudTrailLogValidation,
84+
serviceName: "AWS CloudTrail"
8485
} satisfies RuntimeTest;

runtime/aws/AWS CloudTrail/check-cloudtrail-multiregion.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,6 @@ export default {
126126
}
127127
],
128128
severity: "MEDIUM",
129-
execute: checkCloudTrailMultiRegionEnabled
129+
execute: checkCloudTrailMultiRegionEnabled,
130+
serviceName: "AWS CloudTrail"
130131
} satisfies RuntimeTest;

runtime/aws/AWS CloudTrail/check-cloudtrail-s3-access-logging.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,6 @@ export default {
112112
}
113113
],
114114
severity: "MEDIUM",
115-
execute: checkCloudTrailS3AccessLogging
115+
execute: checkCloudTrailS3AccessLogging,
116+
serviceName: "AWS CloudTrail"
116117
} satisfies RuntimeTest;

runtime/aws/AWS CloudTrail/check-cloudtrail-tagged.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,6 @@ export default {
112112
}
113113
],
114114
severity: "MEDIUM",
115-
execute: checkCloudTrailTagged
115+
execute: checkCloudTrailTagged,
116+
serviceName: "AWS CloudTrail"
116117
} satisfies RuntimeTest;

runtime/aws/AWS Config/check-config-enabled-all-regions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,6 @@ export default {
8282
}
8383
],
8484
severity: "MEDIUM",
85-
execute: checkConfigEnabledAllRegions
85+
execute: checkConfigEnabledAllRegions,
86+
serviceName: "AWS Config"
8687
} satisfies RuntimeTest;

runtime/aws/AWS Key Management Service/check-iam-kms-decrypt-policy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,5 +192,6 @@ export default {
192192
}
193193
],
194194
severity: "MEDIUM",
195-
execute: checkIamKmsDecryptPolicy
195+
execute: checkIamKmsDecryptPolicy,
196+
serviceName: "AWS Key Management Service"
196197
} satisfies RuntimeTest;

runtime/aws/AWS Key Management Service/check-inline-policy-kms-decrypt.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,5 +213,6 @@ export default {
213213
}
214214
],
215215
severity: "MEDIUM",
216-
execute: checkInlinePolicyKmsDecrypt
216+
execute: checkInlinePolicyKmsDecrypt,
217+
serviceName: "AWS Key Management Service"
217218
} satisfies RuntimeTest;

runtime/aws/AWS Key Management Service/check-kms-key-rotation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,6 @@ export default {
129129
}
130130
],
131131
severity: "MEDIUM",
132-
execute: checkKmsKeyRotation
132+
execute: checkKmsKeyRotation,
133+
serviceName: "AWS Key Management Service"
133134
} satisfies RuntimeTest;

runtime/aws/AWS Key Management Service/check-kms-keys-deletion-status.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,6 @@ export default {
112112
}
113113
],
114114
severity: "MEDIUM",
115-
execute: checkKmsKeysDeletionStatus
115+
execute: checkKmsKeysDeletionStatus,
116+
serviceName: "AWS Key Management Service"
116117
} satisfies RuntimeTest;

runtime/aws/AWS Key Management Service/check-kms-public-access.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,6 @@ export default {
114114
}
115115
],
116116
severity: "MEDIUM",
117-
execute: checkKmsPublicAccess
117+
execute: checkKmsPublicAccess,
118+
serviceName: "AWS Key Management Service"
118119
} satisfies RuntimeTest;

runtime/aws/AWS Security Hub/check-security-hub.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,6 @@ export default {
6565
}
6666
],
6767
severity: "MEDIUM",
68-
execute: checkSecurityHubEnabled
68+
execute: checkSecurityHubEnabled,
69+
serviceName: "AWS Security Hub"
6970
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_alarm_action_check.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,6 @@ export default {
9393
}
9494
],
9595
severity: "MEDIUM",
96-
execute: checkCloudWatchAlarmActions
96+
execute: checkCloudWatchAlarmActions,
97+
serviceName: "Amazon CloudWatch"
9798
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_alarm_action_enabled.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,6 @@ export default {
8282
}
8383
],
8484
severity: "MEDIUM",
85-
execute: checkCloudWatchAlarmActionsEnabled
85+
execute: checkCloudWatchAlarmActionsEnabled,
86+
serviceName: "Amazon CloudWatch"
8687
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_cloudtrail.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,6 @@ export default {
168168
}
169169
],
170170
severity: "MEDIUM",
171-
execute: checkCloudTrailConfigurationMonitoring
171+
execute: checkCloudTrailConfigurationMonitoring,
172+
serviceName: "Amazon CloudWatch"
172173
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_cmk.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,6 @@ export default {
164164
}
165165
],
166166
severity: "MEDIUM",
167-
execute: checkCmkMonitoringCompliance
167+
execute: checkCmkMonitoringCompliance,
168+
serviceName: "Amazon CloudWatch"
168169
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,6 @@ export default {
168168
}
169169
],
170170
severity: "MEDIUM",
171-
execute: checkConfigChangeMonitoring
171+
execute: checkConfigChangeMonitoring,
172+
serviceName: "Amazon CloudWatch"
172173
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_console_auth.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,6 @@ export default {
166166
}
167167
],
168168
severity: "MEDIUM",
169-
execute: checkConsoleAuthMonitoring
169+
execute: checkConsoleAuthMonitoring,
170+
serviceName: "Amazon CloudWatch"
170171
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_log_group_retention.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,6 @@ export default {
116116
}
117117
],
118118
severity: "MEDIUM",
119-
execute: checkCloudWatchLogGroupRetention
119+
execute: checkCloudWatchLogGroupRetention,
120+
serviceName: "Amazon CloudWatch"
120121
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_monitoring_iam_policies.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,5 +162,6 @@ export default {
162162
}
163163
],
164164
severity: "MEDIUM",
165-
execute: checkIamPolicyMonitoring
165+
execute: checkIamPolicyMonitoring,
166+
serviceName: "Amazon CloudWatch"
166167
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_monitoring_root_account.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,6 @@ export default {
170170
}
171171
],
172172
severity: "MEDIUM",
173-
execute: checkRootAccountMonitoring
173+
execute: checkRootAccountMonitoring,
174+
serviceName: "Amazon CloudWatch"
174175
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_monitoring_signin_mfa.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,6 @@ export default {
167167
}
168168
],
169169
severity: "MEDIUM",
170-
execute: checkMfaMonitoringCompliance
170+
execute: checkMfaMonitoringCompliance,
171+
serviceName: "Amazon CloudWatch"
171172
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_monitoring_unauthorized_api_calls.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,6 @@ export default {
168168
}
169169
],
170170
severity: "MEDIUM",
171-
execute: checkCloudWatchApiMonitoring
171+
execute: checkCloudWatchApiMonitoring,
172+
serviceName: "Amazon CloudWatch"
172173
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_nacl_monitoring.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,6 @@ export default {
167167
}
168168
],
169169
severity: "MEDIUM",
170-
execute: checkNaclMonitoringCompliance
170+
execute: checkNaclMonitoringCompliance,
171+
serviceName: "Amazon CloudWatch"
171172
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_network_gateway.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,6 @@ export default {
168168
}
169169
],
170170
severity: "MEDIUM",
171-
execute: checkNetworkGatewayMonitoring
171+
execute: checkNetworkGatewayMonitoring,
172+
serviceName: "Amazon CloudWatch"
172173
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_org_changes_monitored.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,6 @@ export default {
168168
}
169169
],
170170
severity: "MEDIUM",
171-
execute: checkCloudWatchOrgChangesMonitored
171+
execute: checkCloudWatchOrgChangesMonitored,
172+
serviceName: "Amazon CloudWatch"
172173
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_route_table.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,6 @@ export default {
166166
}
167167
],
168168
severity: "MEDIUM",
169-
execute: checkRouteTableMonitoring
169+
execute: checkRouteTableMonitoring,
170+
serviceName: "Amazon CloudWatch"
170171
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_s3_policy_change.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,6 @@ export default {
167167
}
168168
],
169169
severity: "MEDIUM",
170-
execute: checkS3PolicyMonitoring
170+
execute: checkS3PolicyMonitoring,
171+
serviceName: "Amazon CloudWatch"
171172
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_security_group.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,6 @@ export default {
170170
}
171171
],
172172
severity: "MEDIUM",
173-
execute: checkSecurityGroupMonitoring
173+
execute: checkSecurityGroupMonitoring,
174+
serviceName: "Amazon CloudWatch"
174175
} satisfies RuntimeTest;

runtime/aws/Amazon CloudWatch/aws_cloudwatch_vpc_changes_monitored.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,6 @@ export default {
168168
}
169169
],
170170
severity: "MEDIUM",
171-
execute: checkVpcChangesMonitored
171+
execute: checkVpcChangesMonitored,
172+
serviceName: "Amazon CloudWatch"
172173
} satisfies RuntimeTest;

runtime/aws/Amazon Elastic Compute Cloud (EC2)/aws_autoscaling_elb_healthcheck_required.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,6 @@ export default {
100100
}
101101
],
102102
severity: "MEDIUM",
103-
execute: checkAutoScalingELBHealthCheck
103+
execute: checkAutoScalingELBHealthCheck,
104+
serviceName: "Amazon Elastic Compute Cloud (EC2)"
104105
} satisfies RuntimeTest;

0 commit comments

Comments
 (0)