Skip to content

Commit

Permalink
Update to Version v3.3.3 (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyarz-aws authored Nov 25, 2024
1 parent 667b0b1 commit c3d907d
Show file tree
Hide file tree
Showing 38 changed files with 244 additions and 114 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.3.3] - 2024-11-22

### Security

- Update `cross-spawn` to mitigate [CVE-2024-21538]
- Update `Werzeug` to mitigate [CVE-2024-49767]

### Fixed

- Update tika-core to v3.0.0 to resolve [https://github.com/aws-solutions/distributed-load-testing-on-aws/issues/214]

### Updated

- Updates on metrics collection process

## [3.3.2] - 2024-11-01

### Security
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.2
3.3.3
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM blazemeter/taurus:1.16.34
# taurus includes python and pip
RUN /usr/bin/python3 -m pip install --upgrade pip
RUN pip install --no-cache-dir awscli
RUN apt-get -y install --no-install-recommends xmlstarlet bc procps
RUN apt-get -y install --no-install-recommends xmlstarlet bc procps jq

# Removing selenium and gatling from our image as they are not supported in DLT
RUN rm -rf /root/.bzt/selenium-taurus
Expand Down Expand Up @@ -32,7 +32,7 @@ RUN rm -rf /root/.bzt/python-packages/3.10.12/urllib3*
RUN cp -r /usr/local/lib/python3.10/dist-packages/urllib3* /root/.bzt/python-packages/3.10.12/

# Replacing Werkzeug with more stable version to resolve vulnerabilities
RUN pip install Werkzeug==3.0.3
RUN pip install Werkzeug==3.0.6
RUN rm -rf /root/.bzt/python-packages/3.10.12/werkzeug*
RUN cp -r /usr/local/lib/python3.10/dist-packages/werkzeug* /root/.bzt/python-packages/3.10.12/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* batik-transcoder v1.14 will be replaced with v1.17
* lets-plot-batik v2.2.1 will be replaced with 4.2.0
* commons-net v3.8.0 will be replaced with v3.9.0
* tika-core v1.28.3 will be replaced with v2.9.2
* tika-core v1.28.3 will be replaced with v3.0.0
* json-path v2.7.0 will be replaced with v2.9.0
* dnsjava v2.1.9 will be replaced with v3.6.1
Expand All @@ -35,7 +35,7 @@
"batik-transcoder": "org/apache/xmlgraphics/batik-transcoder/1.17/batik-transcoder-1.17.jar",
"lets-plot-batik": "org/jetbrains/lets-plot/lets-plot-batik/4.2.0/lets-plot-batik-4.2.0.jar",
"commons-net": "commons-net/commons-net/3.9.0/commons-net-3.9.0.jar",
"tika-core": "org/apache/tika/tika-core/2.9.2/tika-core-2.9.2.jar",
"tika-core": "org/apache/tika/tika-core/3.0.0/tika-core-3.0.0.jar",
"json-path": "com/jayway/jsonpath/json-path/2.9.0/json-path-2.9.0.jar",
"dnsjava": "dnsjava/dnsjava/3.6.1/dnsjava-3.6.1.jar"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ echo "UUID:: ${UUID}"
echo "LIVE_DATA_ENABLED:: ${LIVE_DATA_ENABLED}"
echo "MAIN_STACK_REGION:: ${MAIN_STACK_REGION}"

cat /proc/self/cgroup
TASK_ID=$(cat /proc/self/cgroup | grep -oE '[a-f0-9]{32}' | head -n 1)
echo $TASK_ID

sigterm_handler() {
if [ $pypid -ne 0 ]; then
echo "container received SIGTERM."
Expand Down Expand Up @@ -146,6 +150,23 @@ if [ "$TEST_TYPE" != "simple" ]; then
fi

if [ -f /tmp/artifacts/results.xml ]; then

# Insert the Task ID at the same level as <FinalStatus>
curl -s $ECS_CONTAINER_METADATA_URI_V4/task
Task_CPU=$(curl -s $ECS_CONTAINER_METADATA_URI_V4/task | jq '.Limits.CPU')
Task_Memory=$(curl -s $ECS_CONTAINER_METADATA_URI_V4/task | jq '.Limits.Memory')
START_TIME=$(curl -s "$ECS_CONTAINER_METADATA_URI_V4/task" | jq -r '.Containers[0].StartedAt')
# Convert start time to seconds since epoch
START_TIME_EPOCH=$(date -d "$START_TIME" +%s)
# Calculate elapsed time in seconds
CURRENT_TIME_EPOCH=$(date +%s)
ECS_DURATION=$((CURRENT_TIME_EPOCH - START_TIME_EPOCH))

xmlstarlet ed -P -L -s "/FinalStatus" -t elem -n "TaskId" -v "$TASK_ID" /tmp/artifacts/results.xml
xmlstarlet ed -P -L -s "/FinalStatus" -t elem -n "TaskCPU" -v "$Task_CPU" /tmp/artifacts/results.xml
xmlstarlet ed -P -L -s "/FinalStatus" -t elem -n "TaskMemory" -v "$Task_Memory" /tmp/artifacts/results.xml
xmlstarlet ed -P -L -s "/FinalStatus" -t elem -n "ECSDuration" -v "$ECS_DURATION" /tmp/artifacts/results.xml

echo "Validating Test Duration"
TEST_DURATION=`xmlstarlet sel -t -v "/FinalStatus/TestDuration" /tmp/artifacts/results.xml`

Expand Down
33 changes: 21 additions & 12 deletions source/api-services/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ class APIHandler {
throw this.errorMsg;
}

async sendMetrics(config, data) {
if (process.env.SEND_METRIC === "Yes") {
let taskCountObj = {};
for (const testTaskConfig of config.testTaskConfigs) {
taskCountObj[testTaskConfig.region] = testTaskConfig.taskCount;
}
await utils.sendMetric({
Type: "TestCreate",
TestType: config.testType,
FileType: config.fileType || (config.testType === "simple" ? "none" : "script"),
TaskCountPerRegion: taskCountObj,
TestId: data.testId,
TestScheduleStep: config.scheduleStep,
HoldFor: config.testScenario.execution[0]["hold-for"],
RampUp: config.testScenario.execution[0]["ramp-up"],
CronValue: config.cronValue,
TestEventBridgeScheduled: config.eventBridge,
});
}
}
// Handle the /scenarios endpoint
async handleScenarios(config, queryParams, body, functionName, functionArn) {
let data;
Expand All @@ -53,18 +73,7 @@ class APIHandler {
}
// Handle creating test
else data = await scenarios.createTest(config, functionName);
if (process.env.SEND_METRIC === "Yes") {
await utils.sendMetric({
Type: "TaskCreate",
TestType: config.testType,
FileType: config.fileType || (config.testType === "simple" ? "none" : "script"),
TaskCount: config.taskCount,
TestId: data.testId,
TestScheduleStep: config.scheduleStep,
CronValue: config.cronValue,
TestEventBridgeScheduled: config.eventBridge,
});
}
await this.sendMetrics(config, data);
return data;
default:
throw this.errorMsg;
Expand Down
13 changes: 7 additions & 6 deletions source/api-services/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion source/api-services/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "api-services",
"version": "3.3.2",
"version": "3.3.3",
"description": "REST API micro services",
"repository": {
"type": "git",
Expand Down
10 changes: 6 additions & 4 deletions source/console/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion source/console/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "distributed-load-testing-on-aws-ui",
"version": "3.3.2",
"version": "3.3.3",
"private": true,
"license": "Apache-2.0",
"author": {
Expand Down
13 changes: 7 additions & 6 deletions source/custom-resource/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion source/custom-resource/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "custom-resource",
"version": "3.3.2",
"version": "3.3.3",
"description": "cfn custom resources for distributed load testing on AWS workflow",
"repository": {
"type": "git",
Expand Down
11 changes: 11 additions & 0 deletions source/infrastructure/lib/back-end/step-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
WaitTime,
JsonPath,
DefinitionBody,
TaskInput,
} from "aws-cdk-lib/aws-stepfunctions";
import { LambdaInvoke } from "aws-cdk-lib/aws-stepfunctions-tasks";
import { Aws, CfnResource, Duration } from "aws-cdk-lib";
Expand Down Expand Up @@ -61,6 +62,16 @@ export class TaskRunnerStepFunctionConstruct extends Construct {
const mapEnd = new Pass(this, "Map End");
const parseResult = new LambdaInvoke(this, "Parse result", {
lambdaFunction: props.resultsParser,
payload: TaskInput.fromObject({
"testTaskConfig.$": "$.testTaskConfig",
"testId.$": "$.testId",
"testType.$": "$.testType",
"fileType.$": "$.fileType",
"showLive.$": "$.showLive",
"testDuration.$": "$.testDuration",
"prefix.$": "$.prefix",
"executionStart.$": "$$.Execution.StartTime",
}),
});
parseResult.next(done);

Expand Down
11 changes: 6 additions & 5 deletions source/infrastructure/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion source/infrastructure/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "distributed-load-testing-on-aws-infrastructure",
"version": "3.3.2",
"version": "3.3.3",
"author": {
"name": "Amazon Web Services",
"url": "https://aws.amazon.com/solutions"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4600,7 +4600,7 @@ exports[`Distributed Load Testing stack test 1`] = `
"Arn",
],
},
"","Payload.$":"$"}},"Done":{"Type":"Succeed"}}}",
"","Payload":{"testTaskConfig.$":"$.testTaskConfig","testId.$":"$.testId","testType.$":"$.testType","fileType.$":"$.fileType","showLive.$":"$.showLive","testDuration.$":"$.testDuration","prefix.$":"$.prefix","executionStart.$":"$$.Execution.StartTime"}}},"Done":{"Type":"Succeed"}}}",
],
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ exports[`DLT API Test 1`] = `
"Arn",
],
},
"","Payload.$":"$"}},"Done":{"Type":"Succeed"}}}",
"","Payload":{"testTaskConfig.$":"$.testTaskConfig","testId.$":"$.testId","testType.$":"$.testType","fileType.$":"$.fileType","showLive.$":"$.showLive","testDuration.$":"$.testDuration","prefix.$":"$.prefix","executionStart.$":"$$.Execution.StartTime"}}},"Done":{"Type":"Succeed"}}}",
],
],
},
Expand Down
13 changes: 7 additions & 6 deletions source/integration-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c3d907d

Please sign in to comment.