After you create and save a Compute Nest service as a service provider, you must test the service and submit the service for review after the service passes the test. This topic describes how to test the availability and template of a service as a service provider.
You can manually test a service or perform an automated test on a service based on your business requirements.
Manually test a service: You can use the deployment URL of the service to deploy a service instance within your account as a customer.
Perform an automated test on a service: You can create test cases based on different templates and verify the accuracy of the templates by creating and running test tasks. Test cases are inherited when a new version is created for the service. This facilitates regression testing and ensures the accuracy of service iteration. In addition, the test case is associated with the service review process. When you submit the service for review, the test case is automatically triggered to test the service.
Manually test a service
Use the deployment URL of a service to create a service instance within your account. This verifies the operations performed to deploy a service instance.
To apply for a trial of cloud resources for service testing, see Configure a free trial.
Log on to the Compute Nest console.
Go to the My Services page and find the service that you created. Click the service name to go to the Service Details page.
On the Service Details page, click the Service Test tab and then click the test URL to go to the Create Service Instance page.
On the Create Service Instance page, test the parameters of the service instance.
Return to the Service Test tab of the Service Details page. After the test is complete, the "The test is successful" message is displayed on the Service Test tab.
Perform an automated test on a service
Create a test case and customize the parameters of the service template in the test case. The created test case is associated with the service review process. The test case is automatically triggered to test the service when you submit the service for review. The test case is inherited when a new version is created for the service. When a service is updated or a service instance is upgraded, the new version of the service inherits the test case of the old version of the service. This facilitates regression testing.
If you do not create a test case, no automated test is triggered when you submit the service for review.
Configure a test case
A test case configuration file is a YAML file. In this example, the test case configuration file of the consul service is used.
---
parameters:
SystemDiskSize: 100
PayType: "PostPaid"
DataDiskSize: 40
InstanceType: "$[iact3-auto]"
AllocatePublicIp: "true"
DataDiskCategory: "cloud_efficiency"
InstancePassword: "$[iact3-auto]"
SystemDiskCategory: "cloud_essd"You can also click Import Default Configurations in the Add Test Case dialog box to import the default test case configuration file of the service. The parameters in the default test case configuration file are parsed based on the parameters defined in the service template.
Parameters
The following table describes the parameters in the service template.
Parameter | Required | Description |
specificationName | No | The name of the parameter set. The parameters in a parameter set cannot conflict with the parameters defined in the parameters section. |
parameters | Yes | The parameters used to execute a Resource Orchestration Service (ROS) template in a service test. |
The
InstanceChargeTypeparameter must be set toPostPaid.The
$[iact3-auto]pseudo parameter is automatically set to an optional value. The defined cloud resources are automatically selected from the resources available in the current region. For more information, see the Pseudo parameters section of this topic.The virtual private cloud (VPC), zone, vSwitch, and security group attributes that are strongly associated with the
regionattribute are automatically generated when the test task is run. You can customize the attributes.
Create a test task
Select a template and a test case in Compute Nest within your account to test the service.
In the Test Tasks section, click Create Task. In the Create Task dialog box, configure the task information.
Enter a task name in the Task Name field.
Select a template and a test case.
If multiple templates are available, you can create a test case for each template.
Select the region in which you want to run the task.
If you do not select a region, the system randomly selects a region from the regions in which the service can be deployed.
Click Create Now.
After the task is created, you can view the task progress in the task list.
View the execution report.
After the task is complete, you can view the test configurations and test case information in the execution report.
Click the
icon next to the name of the test task, and then click Details. In the Test Report dialog box, view the test configurations, region, and stack of the task.
View logs.
In the logs, you can view the effective parameters, stack details, and error information.
Errors and solutions
This section describes the common errors that may occur during a service test and provides solutions.
Error log: "IacerException, can not find any available value for ZoneId in cn-qingdao region in [] for default"
Solution: No resources are available in the current region. You must specify another region to run the task.
Error log: "Resources.TiDBServerScalingGroupEnable.Properties: : Unknown Property DetachOptions request id: 51341F62-56DC-xxxx-xxxx-xxx"
Solution: The parameters defined in the template are invalid. Modify the parameters in the test configurations based on the log.
Pseudo parameters
The $[iact3-auto] pseudo parameter can be used to automatically specify values for parameters. This simplifies the parameter settings during a service feature test. You can use pseudo parameters to configure parameters in the following two cases:
The values that can be specified for a parameter can be queried by calling an API operation. If you call the
GetTemplateParameterConstraintsoperation for a parameter,AllowedValuesis returned.A parameter specifies a specific resource or an item. In this case, the pseudo parameter automatically obtains an appropriate value for the parameter.
If the parameter is
VpcId,VswitchId, orSecurityGroupId, the pseudo parameter automatically selects a VPC ID, a vSwitch ID, or a security group ID for the parameter in the current region.If the parameter is
VpcName,Password, orUuid, the pseudo parameter randomly generates a VPC name, a password, or a UUID for the parameter.Pseudo parameters support the following parameters:
If a parameter matches the regular expression
vpc(_|)id, the pseudo parameter automatically selects a random VPC ID for theVpcIdparameter in the current region.If a parameter matches the regular expression
v(_|)switch(_|)id, the pseudo parameter automatically selects a vSwitch ID for theVswitchIdparameter in the current region. If a parameter matches the regular expressionzone(_|)id, the pseudo parameter automatically selects a vSwitch ID in the corresponding zone.If a parameter matches the regular expression
security(_|)group(_id|id), the pseudo parameter automatically selects a security group ID.If a parameter matches the regular expression
r'\w*name', the pseudo parameter automatically generates a random string that starts with iacer-.If a parameter matches the regular expression
r'\w*password', the pseudo parameter automatically generates a password that contains uppercase letters, lowercase letters, digits, and special characters.If a parameter matches the regular expression
r'\w*uuid', the pseudo parameter automatically generates a UUID.