Creating a test with data from a bucket
You can upload payloads from a Yandex Object Storage bucket to Load Testing. This method allows you to:
- Handle large volumes of payloads (over 100 MB).
- Store payloads and reuse them easily.
- Ensure maximum security (payloads remain in the user's cloud and associated networks).
Preparing the infrastructure
-
Create a test agent.
-
Grant the service account linked to the agent read permission in the bucket. To do this, edit the bucket's ACL:
- In the management console
, select the folder the bucket is in. - From the list of services, select Object Storage.
- Click
next to the bucket and select Configure ACL. - In the window that opens, enter the service account name, select
READ
for bucket permissions, and click Add. - Click Save.
This grants the service account permission to read data from this bucket only.
Note
As an alternative to editing the bucket ACL, you can assign the
storage.editor
role to the service account.This method is less secure, since it allows the service account to perform any operations with all buckets in the folder: creating, deleting, and updating a bucket, or granting public access to them.
- In the management console
Creating a test
-
In the management console
, select the folder for testing. -
From the list of services, select Load Testing.
-
In the
Tests tab, click Create test. -
Select a test agent or create a new one.
-
Under Attached files:
- Click Select from bucket.
- Find the bucket in the drop-down list and specify the path to the payload file.
Alternatively, you can Select files from your computer. In this case, you will have to reupload the files every time you run the test.
-
Depending on the selected configuration type, set the parameters under Test settings:
FormConfiguration file- Select a load generator.
- In the Target address and Target port fields, enter the address and port of the service to test.
- (Optional) Enable Secure connection.
- In the Testing threads field, specify the number of testing threads.
- Under Load type:
- Select a type.
- Click
Load profile and add one or more server load profiles.
- In the Configuration method field, select Attached file as the test data type.
- (Optional) If you want to reduce the test time, set the condition to stop the test automatically in the Autostop menu. Click
Autostop and specify:-
Autostop type: Parameter whose value defines when a test is interrupted.
-
Autostop parameter values.
Specify different sets of parameters for different autostop types.
-
- Under Forced test termination time, specify the time to autostop the test unless it is stopped for other reasons. This parameter value should be slightly greater than the expected test duration.
- Optionally, enable the Agent monitoring option. For more information, see Test agent monitoring.
- Under Test information, specify the test name, description, version number, and label.
Click Attach file and open the configuration file on your computer. If you do not have a configuration file, run the test again or generate a configuration file based on the documentation
.Warning
Make sure to specify the time limit for the test under
autostop
in the configuration file:autostop: enabled: true package: yandextank.plugins.Autostop autostop: - limit (5m)
Note
During testing, the agent automatically cleans up disk space. You can manage the amount of space freed up via the
disk_limit
parameter underrcheck
:rcheck: enabled: true package: yandextank.plugins.ResourceCheck disk_limit: 2048 interval: 10s mem_limit: 512
-
Click Create.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameters.
-
View the description of the CLI command for creating a test:
yc loadtesting test create --help
-
Upload the YAML configuration file for your test:
yc loadtesting test-config create --from-yaml-file <file_path>
-
Upload the test data. To do this, create an IAM token:
export YC_TOKEN=$(yc iam create-token) export TEST_PAYLOAD_FILE="sample/_requests.uri" export S3_PAYLOAD_BUCKET="my_bucket" export S3_PAYLOAD_FILENAME="my_requests.uri" curl -H "X-YaCloud-SubjectToken: ${$YC_TOKEN}" --upload-file - "https://storage.yandexcloud.net/${$S3_PAYLOAD_BUCKET}/${$S3_PAYLOAD_FILENAME}" < ${$TEST_PAYLOAD_FILE}
-
Create a test in the default folder:
loadtesting test create \ --name "yc-examples-test" \ --description "Test has been created using YC" \ --labels source=gh,type=tutorial \ --configuration id=ff6hvk749g71********,agent-id=ff633vbrst7a********,test-data=requests.uri \ --test-data name=requests.uri,s3bucket=my_bucket,s3file=my_requests.uri
Where:
--name
: Test name.--description
: Test description.--labels
: Test labels.--configuration
: Test configuration parameters:id
: Test configuration ID. Specify the ID of the configuration file you uploaded in Step 2. To get the list of configuration IDs, run theyc loadtesting test-config list
command.agent-id
: Test agent ID.test-data
: Test data file name.
--test-data
: Test data settings:name
: Test data object name.s3bucket
: Name of the bucket storing the test data.s3file
: Name of the test data file in the bucket.
For more information on how to create a test with the CLI, see the Yandex Cloud Examples repository
. -
To view the list of tests in the folder for loadtesting using the CLI, run the following command:
yc loadtesting test list
For more information on using the CLI to view test info, see the Yandex Cloud Examples repository
.