Agent selection
When creating a test, you can either select a test agent from the list or create a temporary agent. The temporary test agent will be created for this specific test only and deleted after the test is complete. You can also configure selecting the first available agent. The agent selection option allows you to filter test agents by parameters you set.
Creating a temporary test agent
To create a temporary test agent:
- In the management console
, select the folder for testing. - In the list of services, select Load Testing.
- In the
Tests tab, click Create test. - In the Agents section, click Temporal.
- Under Temporal agent settings:
- Select a suitable agent type. For more information, see Agent performance.
- Select a previously created service account or create a new one by clicking Create. The service account must have the following roles:
loadtesting.generatorClient: To send test results to Load Testing.compute.editor: To create a VM in the user folder.iam.serviceAccounts.user: To link the service account to the VM.vpc.user: To connect to and use network resources in the user folder.vpc.publicAdmin: To assign a public IP address to the VM.
- Select the subnet hosting your test target.
- Select the security group. Make sure to configure the security group in advance.
Specifying a test agent
To specify a test agent:
-
In the management console
, select the folder for testing. -
In the list of services, select Load Testing.
-
In the
Tests tab, click Create test. -
In the Agents section, click Select from list.
-
Select the name of the agent you need from the drop-down list.
Note
Within a single test, you can assign multiple agents to work synchronously, which allows you to increase the load on the test target.
To do this, either select multiple agent names from the list or use Only and Except buttons in the row with the name of one of the agents. These buttons allow you to select only this agent or all agents other than this one, respectively.
When creating a test, specify agent IDs:
export AGENT_ID1='<agent_1_ID>'
export AGENT_ID2='<agent_2_ID>'
yc loadtesting test create \
--name "yc-examples-test" \
--description "Test has been created using YC" \
--labels source=gh,type=tutorial,kind=multi \
--configuration id=$TEST_CONFIG_ID,agent-id=$AGENT_ID1,test-data=$TEST_PAYLOAD_FILE_IN_CONFIG \
--configuration id=$TEST_CONFIG_ID,agent-id=$AGENT_ID2,test-data=$TEST_PAYLOAD_FILE_IN_CONFIG \
--test-data name=$TEST_PAYLOAD_FILE_IN_CONFIG,s3bucket=$S3_PAYLOAD_BUCKET,s3file=$S3_PAYLOAD_FILENAME
Setting up selection of the first test agent that becomes available
To configure selecting the first test agent that becomes available:
- In the management console
, select the folder for testing. - In the list of services, select Load Testing.
- In the
Tests tab, click Create test. - In the Agents section, click First released.
- If any of the agents is suitable for the test, select Any suitable agent; otherwise, select Set conditions and set up the agent filtering conditions:
- (Optional) In the Filter labels section, click Add label and specify the labels for agent selection in
key:valueformat. - (Optional) In the Filter by name field, specify a string that must be present in the names of the agents you want to start the test configuration on.
- (Optional) In the Filter labels section, click Add label and specify the labels for agent selection in
- In the Agent count field, specify how many agents will be used to run the test in sync: This will allow you to increase the load on the test target.
Set the filtering conditions:
export ANY_AGENT_SELECTOR=""
export SPECIFIC_AGENT_SELECTOR="labels.key IN (value1, value2)"
yc loadtesting test create \
--name "yc-examples-test" \
--description "Test has been created using YC" \
--labels source=gh,type=tutorial \
--configuration id=$TEST_CONFIG_ID,agent-by-filter=$ANY_AGENT_SELECTOR,test-data=$TEST_PAYLOAD_FILE_IN_CONFIG \
--configuration id=$TEST_CONFIG_ID,agent-by-filter={$SPECIFIC_AGENT_SELECTOR},test-data=$TEST_PAYLOAD_FILE_IN_CONFIG \
--test-data name=$TEST_PAYLOAD_FILE_IN_CONFIG,s3bucket=$S3_PAYLOAD_BUCKET,s3file=$S3_PAYLOAD_FILENAME
In this example, the first part of the test will be performed on any suitable agent (because no filtering conditions are set in ANY_AGENT_SELECTOR), while the second part, on any agent with the key label set to value1 or value2.