dcc-server-tester
v1.0.3
Published
A server to process media submitted to lightover
Downloads
4
Readme
DCC-Server-Tester
The DCC-Server-Tester is a test script that you can easily run against your server deployment. Tests can either be run locally, or for more production-scale tests, they can be run using AWS lambda.
Preparing to test
1. Install Node.js
The dcc-server-tester runs using Node.js. Follow the instructions to install Node.js to get started.
2. Setup a test Email via the DCC Dashboard
First, navigate to the server dashboard you wish to test (for example https://dashboard.dcconsortium.org). Click "Upload and Prepare Batch"
Create a name for your test batch (for example, "Test 7"), and select any available template you wish to test. On the "Upload & Manage Earner Information" page, upload a CSV with one line that contains your email. For example, you could copy the CSV below and replace [email protected]
with your personal email.
earnerName,degreeType,subject,credentialName,emailAddress
John Doe,Bachelor of Science,Computer Science,Bachelors,[email protected]
Select an email template. On the final "Confirmation" page, press "Send." This should send an email with a link to your personal email (like the one below.) Copy the emailed link and save it for later.
Running Tests
Running tests locally requires minimal setup. You can use the dcc-server-tester library by simply running the command below, replacing {EMAILED_URL}
and {DASHBOARD_URL}
with your personal information.
npx dcc-server-tester test -e "{EMAILED_URL}" -d "{DASHBOARD_URL}" -s "1" -r "1"
The dcc-server-tester CLI has one command, "test," and it has the following parameters:
| Param | Description | Example | Default | |-----------------------|---------------------------------------------------|-------------------------------------------------------|---------| | -e or --emailed_url | The URL emailed to you in the step above. | https://load-test.dcconsortium.org/claim/?token=ey... | none | | -d or --dashboard_url | The URL of the dashboard you wish to test | https://load-test.dcconsortium.org | none | | -s or --seconds | The number of seconds you want your test to run | 200 | 1 | | -r or --rate | The number of simulated users per second you want | 100 | 1 | | -a or --aws | Add this flag to run your tests on AWS Lambda | | |
Running tests with AWS Lambda
Get Access Keys for AWS
AWS Lambda uses Amazon servers to run your tests. This lets us use a beefy data-center network to send thousands of requests. But, before we run the tests, we need to set up your Amazon account.
First go to https://aws.amazon.com/ and create an account if you have not already.
In the search bar on the AWS console, search "IAM" and choose "IAM"
Once you've activated IAM, select the "user" link in the side menu and click "Create User."
On the next screen, you can name the user anything (for example cli-user
).
On the "Set Permissions" screen, select the "Attach policies directly" option, search "administratorAccess" in the search box, and select the "AdministratorAccess" policy.
Review the options and click "Create User."
Back on the "User" pane, click on the user you just created.
Now, we need to generate keys that we will use to let the dcc-server-tester access this user. To do this, click the "Create Access Key" link.
Select "Command Line Interface (CLI)" from the options.
Once you've created the key, copy the "Access Key" and "Secret access key" and save it for later. You will not be able to retrieve these keys once you naviage away from this screen.
Configure the AWS CLI
Now we want to set up the AWS CLI on your local machine. When you run the dcc-server-tester it will look for the AWS CLI and use it to deploy your tests to AWS Lambda.
To install the AWS CLI, follow the installation instructions for your platform.
Now, run the aws configure
command. You will be prompted to provide a AWS Access Key and AWS Access Secret Key. Use the ones we generated in the previous section.
Run the Tests
Now, we can run the tests using AWS Lambda. To do so, we can run the same command, but provide the "-a" flag to indicate we want the tests to run on AWS. For example:
npx dcc-server-tester test -e "{EMAILED_URL}" -d "{DASHBOARD_URL}" -s "1" -r "1" -a