Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions stress_test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "stress_test",
"display_name": "Stress Test",
"description": "Stress Test for CPU, GPU, and Networking",
"parameters": [
{
"name": "SERVER",
"display_name": "iPerf Server?",
"description": "Is this node a Server or Client for iPerf?",
"type": "boolean",
"required": false
},
{
"name": "SERVER_IP",
"display_name": "Server IP Address",
"description": "IP Address of iPerf Server",
"type": "string",
"required": false
}
],
"main": "stress_test/run.sh",
"dependencies": [
"stress_test/run.sh",
"stress_test/stress_network_server.service",
"stress_test/stress_network_client.service",
"stress_test/stress_cpu.service",
"stress_test/stress_gpu.service",
"utils/cachengo.sh"
]
}
56 changes: 56 additions & 0 deletions stress_test/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

source "utils/cachengo.sh"

DATADIR=/data/$APPID

function do_install {
set -e
cachengo-cli updateInstallStatus $APPID "Installing"

cachengo-cli updateInstallStatus $APPID "Installing: Network Stress Test"
if [ "$SERVER" == "true" ]; then
NETWORKSERVICE=stress_network_server.service
cp stress_test/stress_network_server.service /lib/systemd/system/
else
NETWORKSERVICE=stress_network_client.service
sed -i "s/#server_ip#/$SERVER_IP/" stress_test/stress_network_client.service
cp stress_test/stress_network_client.service /lib/systemd/system/
fi
apt install iperf -y

cachengo-cli updateInstallStatus $APPID "Installing: CPU Stress Test"
apt install stress -y
cp stress_test/stress_cpu.service /lib/systemd/system/

cachengo-cli updateInstallStatus $APPID "Installing: GPU Stress Test"
apt install hashcat -y
sed -i "s|#datadir#|$DATADIR|g" stress_test/stress_gpu.service
cp stress_test/stress_gpu.service /lib/systemd/system/
mkdir -p $DATADIR
cd $DATADIR && curl -L https://github.com/hashcat/hashcat/archive/refs/tags/v5.1.0.zip -o hashcat-5.1.0.zip && cd -
unzip $DATADIR/hashcat-5.1.0.zip -d $DATADIR

cachengo-cli updateInstallStatus $APPID "Installing: Starting Stress Test"
# systemctl enable $NETWORKSERVICE stress_cpu.service stress_gpu.service
systemctl daemon-reload
systemctl start $NETWORKSERVICE stress_cpu.service stress_gpu.service

cachengo-cli updateInstallStatus $APPID "Installed"
}

function do_uninstall {
cachengo-cli updateInstallStatus $APPID "Uninstalling"
systemctl stop stress_network_*.service stress_cpu.service stress_gpu.service
rm -rf /lib/systemd/system/stress_network_*.service
rm -rf /lib/systemd/system/stress_cpu.service
rm -rf /lib/systemd/system/stress_gpu.service
rm -rf $DATADIR
cachengo-cli updateInstallStatus $APPID "Uninstalled"
}


case "$1" in
install) do_install ;;
uninstall) do_uninstall ;;
esac
7 changes: 7 additions & 0 deletions stress_test/stress_cpu.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Unit]
Description=CPU_Stress_Test
[Service]
ExecStart=/usr/bin/stress --cpu 6
Restart=always
[Install]
WantedBy=multi-user.target
8 changes: 8 additions & 0 deletions stress_test/stress_gpu.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description=GPU_Stress_Test
[Service]
WorkingDirectory=#datadir#/hashcat-5.1.0
ExecStart=/usr/bin/hashcat -b
Restart=always
[Install]
WantedBy=multi-user.target
7 changes: 7 additions & 0 deletions stress_test/stress_network_client.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Unit]
Description=Network_Stress_Test_Client
[Service]
ExecStart=/usr/bin/iperf3 -c #server_ip# -t 0
Restart=always
[Install]
WantedBy=multi-user.target
7 changes: 7 additions & 0 deletions stress_test/stress_network_server.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Unit]
Description=Network_Stress_Test_Server
[Service]
ExecStart=/usr/bin/iperf3 -s
Restart=always
[Install]
WantedBy=multi-user.target