Creating a test with data from a bucket
You can upload test data to Load Testing from a bucket in Yandex Object Storage. This method enables you to:
- Handle large payloads (over 100 MB).
- Store payloads and reuse them easily.
- Ensure maximum security (payloads remain in the user's cloud and associated networks).
Setting up your infrastructure
-
Create a test agent.
-
Grant the service account linked to the agent read permissions for the bucket. To do this, edit the bucket ACL:
- In the management console
, select the folder with the bucket. - In 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
READfor bucket permissions, and click Add. - Click Save.
The service account will only get read permissions for this bucket.
Note
As an alternative to editing the bucket ACL, you can assign the
storage.editorrole to the service account.This method is less secure because the service account will have unrestricted access to any operations with all buckets in the folder, such as creating, deleting, updating, or enabling public access.
- In the management console
Creating a test
-
In the management console
, select the folder for testing. -
In 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.
-
Based 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.
- Optionally, 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 payload type.
- Optionally, 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: Setting that stops the test when it reaches a specified value.
-
Autostop settings.
Each autostop type has its own settings to specify.
-
- Under Forced test termination time, specify the time after which the test will autostop, unless it is stopped for other reasons. Set it to be slightly greater than the expected test duration.
- Optionally, enable Agent monitoring. For more information, see Test agent monitoring.
- Under Test information, specify a test name, description, version number, and labels.
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 this config article
.Warning
Make sure to specify the time limit for the test under
autostopin 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 size of space to release by specifying
disk_limitunderrcheck: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 installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
-
See 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 payload. 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.uriWhere:
--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 a list of configuration IDs, run theyc loadtesting test-config listcommand.agent-id: Test agent ID.test-data: Payload file name.
--test-data: Payload settings:name: Payload object name.s3bucket: Name of the bucket storing the payload.s3file: Name of the payload file in the bucket.
For more information on how to create a test with the CLI, see the Yandex Cloud Examples repository
. -
To view a list of tests in the folder for load testing using the CLI, run the following command:
yc loadtesting test listFor more information on how to view test info using the CLI, see the Yandex Cloud Examples repository
.