Skip to content

Commit b12781e

Browse files
authored
Update to Version v3.2.4 (#145)
1 parent 706044e commit b12781e

39 files changed

+446
-114
lines changed

CHANGELOG.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,29 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [3.2.3] - 2023-10-5
8+
## [3.2.4] - 2023-11-10
9+
10+
### Changed
11+
12+
- Updating Lambda Runtimes to Use Node-18
13+
- Updated Version of Taurus image to 1.16.26
14+
- Updated Jmeter dependencies and taurus dependencis within the docker image to enhance the security of the docker image
15+
16+
### Fixed
17+
18+
- Bug fix to resolve issues with our recurring schedulers [#141](https://github.com/aws-solutions/distributed-load-testing-on-aws/issues/141)
19+
- Bug fix to resolve issues with deploying to distant regions as additional regions to the main region [#138](https://github.com/aws-solutions/distributed-load-testing-on-aws/issues/138)
20+
21+
## [3.2.3] - 2023-10-05
922

1023
### Fixed
11-
24+
1225
- Bug fix to resolve Multipart upload for files bigger than 5MB
1326
- Bug fix to show success codes other than 200
14-
- Bug fix to reoslve [#131] https://github.com/aws-solutions/distributed-load-testing-on-aws/issues/131
27+
- Bug fix to reoslve [#131](https://github.com/aws-solutions/distributed-load-testing-on-aws/issues/131)
1528
- Updating CDK libraries to latest version to allow deployment in some form in Israel Region
1629
- Fixing Security Hotspots and resolving codesmells
17-
- Updating the Docker Image to the latest version
30+
- Updating the Docker Image to the latest version
1831

1932
## [3.2.2] - 2023-06-29
2033

CODE_OF_CONDUCT.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
## Code of Conduct
2-
32
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
43
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
54
[email protected] with any additional questions or comments.

deployment/build-s3-dist.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ echo "--------------------------------------------------------------------------
143143
echo "Creating container deployment package"
144144
echo "------------------------------------------------------------------------------"
145145
cd ${template_dir}/ecr/distributed-load-testing-on-aws-load-tester
146-
# Downloading jetty 9.4.34.v20201102
147-
curl -O https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-alpn-client/9.4.34.v20201102/jetty-alpn-client-9.4.34.v20201102.jar
148-
curl -O https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-alpn-openjdk8-client/9.4.34.v20201102/jetty-alpn-openjdk8-client-9.4.34.v20201102.jar
149-
curl -O https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-client/9.4.34.v20201102/jetty-client-9.4.34.v20201102.jar
150-
curl -O https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-http/9.4.34.v20201102/jetty-http-9.4.34.v20201102.jar
151-
curl -O https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-io/9.4.34.v20201102/jetty-io-9.4.34.v20201102.jar
152-
curl -O https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-util/9.4.34.v20201102/jetty-util-9.4.34.v20201102.jar
146+
# Downloading jetty 9.4.53.v20231009
147+
curl -O https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-alpn-client/9.4.53.v20231009/jetty-alpn-client-9.4.53.v20231009.jar
148+
curl -O https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-alpn-openjdk8-client/9.4.53.v20231009/jetty-alpn-openjdk8-client-9.4.53.v20231009.jar
149+
curl -O https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-client/9.4.53.v20231009/jetty-client-9.4.53.v20231009.jar
150+
curl -O https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-http/9.4.53.v20231009/jetty-http-9.4.53.v20231009.jar
151+
curl -O https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-io/9.4.53.v20231009/jetty-io-9.4.53.v20231009.jar
152+
curl -O https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-util/9.4.53.v20231009/jetty-util-9.4.53.v20231009.jar
153153

154154
echo "------------------------------------------------------------------------------"
155155
echo "Building console"

deployment/ecr/distributed-load-testing-on-aws-load-tester/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,38 @@ FROM blazemeter/taurus:1.16.26
33
RUN /usr/bin/python3 -m pip install --upgrade pip
44
RUN pip install --no-cache-dir awscli
55
RUN apt-get -y install xmlstarlet bc procps
6+
7+
# Removing selenium and gatling from our image as they are not supported in DLT
8+
RUN rm -rf /root/.bzt/selenium-taurus
9+
RUN rm -rf /root/.bzt/gatling-taurus
10+
11+
RUN apt-get update && apt-get upgrade -y
612
# Taurus working directory = /bzt-configs
713
ADD ./load-test.sh /bzt-configs/
814
ADD ./*.jar /bzt-configs/
915
ADD ./*.py /bzt-configs/
16+
1017
RUN chmod 755 /bzt-configs/load-test.sh
1118
RUN chmod 755 /bzt-configs/ecslistener.py
1219
RUN chmod 755 /bzt-configs/ecscontroller.py
20+
RUN chmod 755 /bzt-configs/jar_updater.py
21+
RUN python3 /bzt-configs/jar_updater.py
22+
23+
# Fixing CVE-2023-22796
24+
WORKDIR /usr/local/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rbs-2.8.2/steep
25+
RUN sed -i 's/7.0.4/7.0.7.1/g' Gemfile.lock
26+
RUN gem install activesupport -v 7.0.7.1
27+
28+
# Replacing urllib3, Werkzeug and cryptography with more stable Versions to fix vulnerabilities
29+
RUN pip install urllib3==2.0.7
30+
RUN pip install Werkzeug==3.0.1
31+
RUN pip install cryptography==41.0.5
32+
RUN rm -rf /root/.bzt/python-packages/3.10.12/urllib3*
33+
RUN rm -rf /root/.bzt/python-packages/3.10.12/werkzeug*
34+
RUN rm -rf /root/.bzt/python-packages/3.10.12/cryptography*
35+
RUN cp -r /usr/local/lib/python3.10/dist-packages/urllib3* /root/.bzt/python-packages/3.10.12/
36+
RUN cp -r /usr/local/lib/python3.10/dist-packages/werkzeug* /root/.bzt/python-packages/3.10.12/
37+
RUN cp -r /usr/local/lib/python3.10/dist-packages/cryptography* /root/.bzt/python-packages/3.10.12/
38+
39+
WORKDIR /bzt-configs/
1340
ENTRYPOINT ["./load-test.sh"]
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
2+
import os
3+
import time
4+
import requests
5+
6+
from bzt.modules.jmeter import JarCleaner
7+
8+
9+
"""
10+
jar_updater.py updates json-smart, neo4j-java-driver, xalan to address CVEs on the taurus image. this is not DLT application code.
11+
the script may be removed once taurus updates the libraries on the image.
12+
Affected Jmeter jars:
13+
* json-smart v2.4.8 will be replaced with v2.4.9
14+
* neo4j-java-driver v4.12.0 will be replaced with v5.14.0
15+
* xalan v2.7.2 will be replaced with v2.7.3
16+
"""
17+
18+
# these jars should be replaced with newer version in order to fix some vulnerabilities
19+
# component name and download link in https://repo1.maven.org/maven2/
20+
# These are Components with regards to JMETER
21+
JMETER_COMPONENTS = {
22+
"json-smart": "net/minidev/json-smart/2.4.9/json-smart-2.4.9.jar",
23+
"neo4j-java-driver": "org/neo4j/driver/neo4j-java-driver/5.14.0/neo4j-java-driver-5.14.0.jar",
24+
"xalan": "xalan/xalan/2.7.3/xalan-2.7.3.jar",
25+
}
26+
JMETER_VERSION = "5.4.3"
27+
28+
# To add other platform, and what to update, add affected components and version HERE
29+
30+
def download(url, target_path):
31+
response = requests.get(url, stream=True)
32+
response.raise_for_status()
33+
# Write the content to a file
34+
with open(target_path, 'wb') as file:
35+
for chunk in response.iter_content(chunk_size=8192):
36+
file.write(chunk)
37+
38+
class Platform:
39+
def __init__(self, platform, version, affected_components=None):
40+
# To dynamically import from bzt.modules.gatling import Platform Objects
41+
module = __import__('bzt.modules.' + platform.lower(), fromlist=[platform])
42+
# Object created for the platform i.e JMeter(), Gatling()
43+
self.obj = getattr(module, platform)()
44+
self.lib_dir = f"/root/.bzt/{platform.lower()}-taurus/{version}/lib"
45+
self.affected_components = affected_components
46+
47+
def install_jmeter_plugins(self):
48+
plugins_mgr_version = "1.10"
49+
plugins_mgr_link = f'https://search.maven.org/remotecontent?filepath=kg/apc/jmeter-plugins-manager/{plugins_mgr_version}/jmeter-plugins-manager-{plugins_mgr_version}.jar'
50+
plugins_mgr_name = os.path.basename(plugins_mgr_link)
51+
pm_installer_path = os.path.join(self.lib_dir, 'ext', plugins_mgr_name)
52+
download(plugins_mgr_link, pm_installer_path)
53+
self.obj._JMeter__install_plugins_manager(pm_installer_path)
54+
cleaner = JarCleaner(self.obj.log)
55+
cleaner.clean(os.path.join(self.lib_dir, 'ext'))
56+
57+
def _install_plugins(self):
58+
dest = os.path.dirname(self.lib_dir)
59+
plugins_manager_cmd = os.path.join(dest, 'bin', 'PluginsManagerCMD.sh')
60+
cmd_line = [plugins_manager_cmd, 'install', ",".join([])]
61+
62+
try:
63+
out, err = self.obj.call(cmd_line)
64+
except Exception as exc:
65+
raise Exception(f"Failed to install plugins : {exc}") #NOSONAR
66+
67+
self.log.debug("Install plugins: %s / %s", out, err)
68+
69+
if out and "Plugins manager will apply some modifications" in out:
70+
time.sleep(5)
71+
72+
def update_jars(self):
73+
jar_files = [_file for _file in os.listdir(self.lib_dir) if _file.endswith(".jar")]
74+
for jar_file in jar_files:
75+
for comp_name in self.affected_components:
76+
if jar_file.startswith(comp_name):
77+
download_link = "https://repo1.maven.org/maven2/" + self.affected_components[comp_name]
78+
target_path = os.path.join(self.lib_dir, os.path.basename(download_link))
79+
download(download_link, target_path)
80+
break
81+
82+
cleaner = JarCleaner(self.obj.log)
83+
cleaner.clean(self.lib_dir)
84+
85+
86+
if __name__ == "__main__":
87+
# update this map to add other platforms
88+
platform_components_map = {"JMeter": (JMETER_VERSION, JMETER_COMPONENTS)}
89+
for key, value in platform_components_map.items():
90+
platform = Platform(key, value[0], value[1])
91+
platform.update_jars()
92+
if key == "JMeter":
93+
platform.install_jmeter_plugins()
94+

source/.eslintrc

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@
3232
"rules": {
3333
"@typescript-eslint/no-inferrable-types": ["off", { "ignoreParameters": true, "ignoreProperties": true }],
3434
"@typescript-eslint/no-useless-constructor": ["off"],
35-
"@typescript-eslint/no-unused-vars": [
36-
"error",
37-
{ "args": "none", "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }
38-
],
35+
"@typescript-eslint/no-unused-vars": ["error", { "args": "none", "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }],
3936
"@typescript-eslint/no-throw-literal": ["error"],
4037
"no-new": 0
4138
}
@@ -54,17 +51,12 @@
5451
"no-useless-constructor": ["off"],
5552
"no-throw-literal": ["off"],
5653

57-
"header/header": [
58-
"error",
59-
"line",
60-
[" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.", " SPDX-License-Identifier: Apache-2.0"],
61-
2
62-
],
54+
"header/header": ["error", "line", [" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.", " SPDX-License-Identifier: Apache-2.0"], 2],
6355

6456
"jsdoc/require-param-type": ["off"],
6557
"jsdoc/require-returns-type": ["off"],
6658
"jsdoc/newline-after-description": ["off"],
6759

6860
"import/no-unresolved": 1 // warn only on Unable to resolve path import/no-unresolved
6961
}
70-
}
62+
}

source/.prettierrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ trailingComma: "es5"
88
tabWidth: 2
99
semi: true
1010
quoteProps: "as-needed"
11-
printWidth: 120
11+
printWidth: 120

source/api-services/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ exports.handler = async (event, context) => {
104104
console.log(JSON.stringify(event, null, 2));
105105
let data;
106106
let response;
107-
const config = JSON.parse(event.body);
107+
let config = JSON.parse(event.body);
108108
const apiHandler = new APIHandler(event.resource, event.httpMethod);
109109

110110
try {
@@ -113,6 +113,8 @@ exports.handler = async (event, context) => {
113113
data = await apiHandler.handleRegions();
114114
break;
115115
case "/scenarios":
116+
if (!event.headers) config.eventBridge = "true";
117+
116118
data = await apiHandler.handleScenarios(
117119
config,
118120
event.queryStringParameters,

source/api-services/lib/scenarios/index.js

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -449,32 +449,32 @@ const setTestId = (testId) =>
449449
testId || utils.generateUniqueId(10);
450450
/**
451451
* Sets the next schedule test run
452+
* @param {string} scheduledTime
452453
* @param {string} scheduleRecurrence
453454
* @returns next run, scheduleRecurrence
454455
*/
455-
const setNextRun = (scheduleRecurrence = "") => {
456+
const setNextRun = (scheduledTime, scheduleRecurrence = "") => {
456457
let nextRun = "";
457458
if (scheduleRecurrence) {
458459
switch (scheduleRecurrence) {
459460
case "daily":
460-
nextRun = moment().utc().add(1, "d").format("YYYY-MM-DD HH:mm:ss");
461+
nextRun = scheduledTime.add(1, "d").format("YYYY-MM-DD HH:mm:ss");
461462
break;
462463
case "weekly":
463-
nextRun = moment().utc().add(7, "d").format("YYYY-MM-DD HH:mm:ss");
464+
nextRun = scheduledTime.add(7, "d").format("YYYY-MM-DD HH:mm:ss");
464465
break;
465466
case "biweekly":
466-
nextRun = moment().utc().add(14, "d").format("YYYY-MM-DD HH:mm:ss");
467+
nextRun = scheduledTime.add(14, "d").format("YYYY-MM-DD HH:mm:ss");
467468
break;
468469
case "monthly":
469-
nextRun = moment().utc().add(1, "M").format("YYYY-MM-DD HH:mm:ss");
470+
nextRun = scheduledTime.add(1, "M").format("YYYY-MM-DD HH:mm:ss");
470471
break;
471472
default:
472473
throw new ErrorException("InvalidParameter", "Invalid recurrence value.");
473474
}
474475
}
475-
return { nextRun, scheduleRecurrence };
476+
return nextRun;
476477
};
477-
478478
/**
479479
* Validates the setting for task count and task concurrency
480480
* @param {object} testTaskConfigs
@@ -758,16 +758,28 @@ const updateTestDBEntry = async (updateTestConfigs) => {
758758
*/
759759
const createTest = async (config) => {
760760
console.log(`Create test: ${JSON.stringify(config, null, 2)}`);
761-
762761
try {
763762
const { testName, testDescription, testType, showLive, regionalTaskDetails } = config;
764-
let { testId, testScenario, testTaskConfigs, fileType } = config;
765-
763+
let { testId, testScenario, testTaskConfigs, fileType, scheduleTime, eventBridge, recurrence } = config;
764+
let nextRun;
766765
fileType = setFileType(testType, fileType);
767766
testId = setTestId(testId);
768767

769-
const startTime = moment().utc().format("YYYY-MM-DD HH:mm:ss");
770-
let { nextRun, scheduleRecurrence } = setNextRun(config.recurrence);
768+
const testEntry = await getTestEntry(testId);
769+
if (testEntry && testEntry.nextRun) nextRun = moment.utc(testEntry.nextRun, "YYYY-MM-DD HH:mm:ss");
770+
771+
let startTime = moment().utc();
772+
if (eventBridge) {
773+
const startDate = moment().format("YYYY-MM-DD");
774+
// If it is eventBridge triggered definitely has scheduleTime
775+
startTime = moment.utc(`${startDate} ${scheduleTime}:00`, "YYYY-MM-DD HH:mm:ss");
776+
}
777+
778+
if (nextRun && startTime.isBefore(nextRun)) nextRun = nextRun.format("YYYY-MM-DD HH:mm:ss");
779+
else nextRun = setNextRun(startTime, recurrence);
780+
781+
const scheduleRecurrence = recurrence ? recurrence : "";
782+
startTime = startTime.format("YYYY-MM-DD HH:mm:ss");
771783

772784
testTaskConfigs = validateTaskCountConcurrency(testTaskConfigs, regionalTaskDetails);
773785

@@ -996,7 +1008,7 @@ const getTestHistoryTestRunIds = async (testId) => {
9961008
};
9971009
do {
9981010
const testRunIds = await dynamoDB.query(params).promise();
999-
testRunIds.Items.map((testRunItem) => {
1011+
testRunIds.Items.forEach((testRunItem) => {
10001012
response.push(testRunItem.testRunId);
10011013
});
10021014
params.ExclusiveStartKey = testRunIds.LastEvaluatedKey;

0 commit comments

Comments
 (0)