-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature-test_scripts' into develop
- Loading branch information
Showing
6 changed files
with
296 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# HTTP/2 - Testing Framework Script | ||
|
||
## Requirements | ||
This script use [NGHTTP2](https://nghttp2.org/) client for make the HTTP/2 tests. If this client is not present on your system, you can use the installation script from this repository under "clients" directory. | ||
|
||
|
||
## How it works? | ||
|
||
The main functionality of this script is load the list of tests defined on "tests.list" directories and launch all of them sequentially. | ||
|
||
You can launch the tests using the following command: | ||
|
||
```sh | ||
$ ./run_tests.sh 1000 | ||
``` | ||
|
||
You have to define the amount number that each test will be executed as input parameter. On the previous line, the script repeats each HTTP/2 test 1000 times. | ||
|
||
The results of the tests, will be saved under "results" directory. The name of the output file, is defined on "test.list" file individually for each test. | ||
|
||
|
||
## Config file | ||
You have to customize the test script configuration file using a text editor before start. For example: | ||
|
||
```sh | ||
$ sudo nano config.conf | ||
``` | ||
|
||
Each field on this configuration file is described inside the file. | ||
|
||
|
||
## Test list file | ||
All tests to be executed by this script, must be defined inside "test.list" file. You can edit using this command: | ||
|
||
```sh | ||
$ sudo nano test.list | ||
``` | ||
|
||
The only way for defined a test is using four arrays with the same index. These arrays are the following: | ||
|
||
- **TestName:** Contains the route to the template file from the remote test server. | ||
- **TestFilename:** Set the name for the output where the test results will be saved. | ||
- **TestParameter:** Define the input options for NGHTTP client. For get more info about all possibilities, please click [here](https://nghttp2.org/documentation/nghttp.1.html#options). | ||
|
||
This is an example of test definition: | ||
|
||
```bash | ||
TestName=(${TestName[@]} "/test/test_01.html") | ||
TestFilename=(${TestFilename[@]} "h2c_Performance_01_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-uvnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "http://") | ||
``` | ||
|
||
The user only have to modify the values between double quotes for defined or customize a test. | ||
|
||
**WARNING:** The rest of the code inside test.list file must be the same without changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
######################################################### | ||
# HTTP/2 - Test Framework Script Config File # | ||
######################################################### | ||
|
||
#-------------------------------------------------------- | ||
# Server Parameters | ||
#-------------------------------------------------------- | ||
# Write the URL without http:// or https:// | ||
URL="testhttp2.bluevia.com" | ||
|
||
# If your server uses other ports than the defaults, | ||
# please change this values with the correct port number. | ||
HTTP_PORT=80 | ||
HTTPS_PORT=443 | ||
|
||
#-------------------------------------------------------- | ||
# Client Parameters | ||
#-------------------------------------------------------- | ||
# Write here the route or command of your NGHTTP2 client | ||
# binary. | ||
NGHTTP2=nghttp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
# Load configuration file: | ||
source config.conf | ||
|
||
# Read the number of the repetitions for each test | ||
NUM_REPETI=1 # Default value | ||
if [[ $# -ne 0 ]] && [[ $1 -gt 0 ]]; | ||
then | ||
echo "[ INFO ]The tests will be repeated: $1 times." | ||
NUM_REPETI=$1 | ||
fi | ||
|
||
# Load the Tests description file | ||
source test.list | ||
|
||
# Launch each test | ||
TOTALTESTS=${#TestFilename[@]}-1 | ||
for (( i=0; i<${#TestFilename[@]}; i++ )) | ||
do | ||
echo "[ INFO ] Executing test number: $i" | ||
|
||
# Selecting correct port in function of the URL preamble | ||
if [ ${TestUrlPreamb[$i]} == "http://" ]; | ||
then | ||
PORT=$HTTP_PORT | ||
elif [ ${TestUrlPreamb[$i]} == "https://" ]; | ||
then | ||
PORT=$HTTPS_PORT | ||
else | ||
echo "[ ERROR ] Bad URL preamble selected on test number $i." | ||
continue | ||
fi | ||
# Creating the command to be execcuted | ||
FULL_COMMAND="$NGHTTP2 ${TestParameter[$i]} ${TestUrlPreamb[$i]}$URL:$PORT${TestName[$i]}" | ||
echo "[ COMMAND ] $FULL_COMMAND" | ||
|
||
for(( j= 0; j<$NUM_REPETI; j++ )) | ||
do | ||
printf "[ STATUS ] Running test number $i repetition $j... " | ||
# Test Command Execution and getting the last output line | ||
TEST_LAST_LINE=$(eval $FULL_COMMAND | tail -n 1) | ||
echo "[ OK ]" | ||
echo "[ DEBUG ] $TEST_LAST_LINE" | ||
|
||
# Getting the test total time | ||
responseTime=$(echo $TEST_LAST_LINE | awk '{print $2}') # Get the total time. Example: +34.34s | ||
responseTime=${responseTime:1} # Deleting + symbol from the value (first character) | ||
|
||
# Calculating multiplier to parse responseTime to microseconds (us) | ||
valueUnit=$(echo $responseTime | tail -c 3) | ||
echo "[ DEBUG ] Text of the unit value: $valueUnit" | ||
case $valueUnit in | ||
[0-9]*s) multiplier=1000000 ;; | ||
ms) multiplier=1000 ;; | ||
us) multiplier=1 ;; | ||
*) echo "[ERROR] Not valid unit for total test time. Received: $valueUnit" | ||
continue;; | ||
esac | ||
responseTime=$(echo $responseTime | grep -Po '(\d+.*\d+)') # Deleting units from the value | ||
echo "[ DEBUG ] Response time: $responseTime" | ||
valueToSave=$(python -c "print $responseTime * $multiplier") # Parsing time to microseconds | ||
echo "[ DEBUG ] Value to save on result file: $valueToSave" | ||
|
||
# Saving test time to results file | ||
echo "$valueToSave" >> "results/${TestFilename[i]}" | ||
done | ||
done | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
######################################################### | ||
# HTTP/2 - Test Framework Script Test List # | ||
######################################################### | ||
# Each test is defined as an array with the following | ||
# structure: | ||
#-------------------------------------------------------- | ||
# TEST xx: Test Description | ||
#-------------------------------------------------------- | ||
# TestName=(${TestName[@]} "/test/file_01.html") | ||
# TestFilename=(${TestFilename[@]} "h2c_7.2.1_$NUM_REPETI.dat") | ||
# TestParameter=(${TestParameter[@]} "-uvnas") | ||
# TestUrlPreamb=(${TestUrlPreamb[@]} "https://") | ||
|
||
|
||
#-------------------------------------------------------- | ||
# 00 - H2C: Performance Template 01 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_01.html") | ||
TestFilename=(${TestFilename[@]} "h2c_Performance_01_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-uvnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "http://") | ||
#-------------------------------------------------------- | ||
# 01 - H2: Performance Template 01 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_01.html") | ||
TestFilename=(${TestFilename[@]} "h2_Performance_01_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-vnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "https://") | ||
|
||
|
||
#-------------------------------------------------------- | ||
# 02 - H2C: Performance Template 02 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_02.jpg") | ||
TestFilename=(${TestFilename[@]} "h2c_Performance_02_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-uvnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "http://") | ||
#-------------------------------------------------------- | ||
# 03 - H2: Performance Template 02 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_02.jpg") | ||
TestFilename=(${TestFilename[@]} "h2_Performance_02_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-vnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "https://") | ||
|
||
|
||
#-------------------------------------------------------- | ||
# 04 - H2C: Performance Template 03 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_03.html") | ||
TestFilename=(${TestFilename[@]} "h2c_Performance_03_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-uvnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "http://") | ||
#-------------------------------------------------------- | ||
# 05 - H2: Performance Template 03 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_03.html") | ||
TestFilename=(${TestFilename[@]} "h2_Performance_03_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-vnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "https://") | ||
|
||
|
||
#-------------------------------------------------------- | ||
# 06 - H2C: Performance Template 04 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_04.php") | ||
TestFilename=(${TestFilename[@]} "h2c_Performance_04_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-uvnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "http://") | ||
#-------------------------------------------------------- | ||
# 07 - H2: Performance Template 04 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_04.php") | ||
TestFilename=(${TestFilename[@]} "h2_Performance_04_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-vnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "https://") | ||
|
||
|
||
#-------------------------------------------------------- | ||
# 08 - H2C: Performance Template 05 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_05.txt") | ||
TestFilename=(${TestFilename[@]} "h2c_Performance_05_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-uvnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "http://") | ||
#-------------------------------------------------------- | ||
# 09 - H2: Performance Template 05 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_05.txt") | ||
TestFilename=(${TestFilename[@]} "h2_Performance_05_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-vnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "https://") | ||
|
||
|
||
#-------------------------------------------------------- | ||
# 10 - H2C: Performance Template 06 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_06.html") | ||
TestFilename=(${TestFilename[@]} "h2c_Performance_06_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-uvnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "http://") | ||
#-------------------------------------------------------- | ||
# 11 - H2: Performance Template 06 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_06.html") | ||
TestFilename=(${TestFilename[@]} "h2_Performance_06_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-vnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "https://") | ||
|
||
|
||
#-------------------------------------------------------- | ||
# 12 - H2C: Performance Template 10 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_10.html") | ||
TestFilename=(${TestFilename[@]} "h2c_Performance_10_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-uvnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "http://") | ||
#-------------------------------------------------------- | ||
# 13 - H2: Performance Template 10 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_10.html") | ||
TestFilename=(${TestFilename[@]} "h2_Performance_10_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-vnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "https://") | ||
|
||
|
||
#-------------------------------------------------------- | ||
# 14 - H2C: Performance Template 11 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_11.html") | ||
TestFilename=(${TestFilename[@]} "h2c_Performance_11_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-uvnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "http://") | ||
#-------------------------------------------------------- | ||
# 15 - H2: Performance Template 11 | ||
#-------------------------------------------------------- | ||
TestName=(${TestName[@]} "/test/test_11.html") | ||
TestFilename=(${TestFilename[@]} "h2_Performance_11_$NUM_REPETI.dat") | ||
TestParameter=(${TestParameter[@]} "-vnas") | ||
TestUrlPreamb=(${TestUrlPreamb[@]} "https://") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters