From fe06f4dd3a5852470f096b1e7b7ac8156fdabd80 Mon Sep 17 00:00:00 2001 From: Luigi Marini Date: Wed, 24 Mar 2021 10:47:14 -0500 Subject: [PATCH 1/3] JMeter test plan. --- scripts/jmeter/README.md | 18 ++ scripts/jmeter/jmeter-clowder.jmx | 447 ++++++++++++++++++++++++++++++ 2 files changed, 465 insertions(+) create mode 100644 scripts/jmeter/README.md create mode 100644 scripts/jmeter/jmeter-clowder.jmx diff --git a/scripts/jmeter/README.md b/scripts/jmeter/README.md new file mode 100644 index 000000000..364a40a00 --- /dev/null +++ b/scripts/jmeter/README.md @@ -0,0 +1,18 @@ +# JMeter Clowder Tests + +This directory includes a simple [JMeter](https://jmeter.apache.org/) test plan to exercise the service and API. +JMeter includes both a GUI to create and run the test plans as well as a CLI. When stress testing, use the CLI. + +Before running the test you will need to set `X-API-KEY` to your own Clowder API key. Change the web server protocol, +server name, and port, in HTTP Request Defaults and the file path `File.path` you want to use to test in `Upload file`. + +You can set the concurrency by changing the number of threads `ThreadGroup.num_threads` in Scenario 1. +This scenario includes the following steps: +- Create dataset +- Upload file to dataset +- Create folder +- Move file to folder +- Update file name +- Upload file metadata + +There is a 1s pause between each call. Make that shorter or disable if stress testing. \ No newline at end of file diff --git a/scripts/jmeter/jmeter-clowder.jmx b/scripts/jmeter/jmeter-clowder.jmx new file mode 100644 index 000000000..53e16c6cb --- /dev/null +++ b/scripts/jmeter/jmeter-clowder.jmx @@ -0,0 +1,447 @@ + + + + + + false + false + + + + + + + + continue + + false + -1 + + 5 + 5 + 1373789594000 + 1373789594000 + true + 10 + 5 + Virtual Users Running Scenario 1. +Make test last 1 minute (see Scheduler) + true + + + + + + + localhost + 9000 + http + + /clowder + Notice Timeouts: +Read to 30s +Connect to 5s + 4 + 5000 + 30000 + + + + + false + false + + + + + + User-Agent + Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:48.0) Gecko/20100101 Firefox/48.0 + + + Accept + text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 + + + Accept-Language + fr,en-US;q=0.7,en;q=0.3 + + + Accept-Encoding + gzip, deflate + + + X-API-KEY + replace-with-your-api-key + + + + + + true + + + + false + { + "name": "Testing Uploads", + "description": "Created by JMeter script.", + "space": [] +} + = + + + + + + + + /clowder/api/datasets/createempty + POST + true + false + true + false + + + + + + + datasetId + $.id + + NOT_FOUND + + + + + + Content-Type + application/json + + + + + + + 1 + 0 + 0 + + + + 1000 + 100.0 + + + + + + + + /Users/lmarini/data/clowder-demo-files/9xLwvaT.jpg + file + image/jpg + + + + + + + + + + + /clowder/api/uploadToDataset/${datasetId} + POST + true + false + true + true + + + + + + + fileId + $.id + + NOT_FOUND + + + + + 1 + 0 + 0 + + + + 1000 + 100.0 + + + + + true + + + + false + { + "name": "folder", + "parentId": "${datasetId}", + "parentType": "dataset" +} + = + + + + + + + + /clowder/api/datasets/${datasetId}/newFolder + POST + true + false + true + false + + + + + + + + + Content-Type + application/json + + + + + + folderId + $.id + + NOT_FOUND + + + + + 1 + 0 + 0 + + + + 1000 + 100.0 + + + + + true + + + + false + { +} + = + + + + + + + + /clowder/api/datasets/${datasetId}/moveFile/${folderId}/${fileId} + POST + true + false + true + false + + + + + + + + + Content-Type + application/json + + + + + + + 1 + 0 + 0 + + + + 1000 + 100.0 + + + + + true + + + + false + { + "name":"newFolderName" +} + = + + + + + + + + /clowder/api/datasets/${datasetId}/updateName/${folderId} + PUT + true + false + true + false + + + + + + + + + Content-Type + application/json + + + + + + + 1 + 0 + 0 + + + + 1000 + 100.0 + + + + + true + + + + false + { + "@context":[ + "https://clowder.ncsa.illinois.edu/contexts/metadata.jsonld", + { + "Abstract": "http://purl.org/dc/terms/abstract" + } + ], + "agent": { + "@type":"cat:extractor", + "name":"Jmeter", + "extractor_id":"https://clowder.ncsa.illinois.edu/api/extractors/jmeter" + }, + "content": { + "Abstract": "Testing API calls using Jmeter." + } +} + = + + + + + + + + clowder/api/datasets/${datasetId}/metadata.jsonld + POST + true + false + true + false + + + + + + + + + Content-Type + application/json + + + + + + + 1 + 0 + 0 + + + + 1000 + 100.0 + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + false + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + + + For scripting only + + + + + + From 2474eaca56679955de53e131f6344bd95930aeb5 Mon Sep 17 00:00:00 2001 From: Luigi Marini Date: Wed, 24 Mar 2021 10:50:04 -0500 Subject: [PATCH 2/3] Added how to run JMeter from command line. --- scripts/jmeter/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/jmeter/README.md b/scripts/jmeter/README.md index 364a40a00..b23a873c8 100644 --- a/scripts/jmeter/README.md +++ b/scripts/jmeter/README.md @@ -15,4 +15,11 @@ This scenario includes the following steps: - Update file name - Upload file metadata -There is a 1s pause between each call. Make that shorter or disable if stress testing. \ No newline at end of file +There is a 1s pause between each call. Make that shorter or disable if stress testing. + +To run the test from the command line use the following command: + +`jmeter -n -t jmeter-clowder.jmx -l jmeter-out -e -o jmeter-out-html` + +The file `jmeter-out` will include the status of each call. +The `jmeter-out-html` will include an html page with summaries and visualizations of that output. \ No newline at end of file From 75a2b657ac65fc49c40079261447ef1d33e675bf Mon Sep 17 00:00:00 2001 From: Luigi Marini Date: Wed, 24 Mar 2021 10:51:55 -0500 Subject: [PATCH 3/3] Updated CHANGELOG.md. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad4517c42..55fe43335 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added - Added a `sort` and `order` parameter to `/api/search` endpoint that supports date and numeric field sorting. If only order is specified, created date is used. String fields are not currently supported. - Added a new `/api/deleteindex` admin endpoint that will queue an action to delete an Elasticsearch index (usually prior to a reindex). +- JMeter testing suite. ## 1.15.1 - 2021-03-12