After you create and save a Compute Nest service, test its availability and service template before submitting it for review.
Service providers can test a service manually or by using automated testing. Choose the method that best suits your service.
-
Manual testing: Use the service instance deployment link to deploy a service instance in your own account from a user's perspective.
-
Automated testing: Create test cases for different templates and run test tasks to verify template accuracy. Test cases are inherited by subsequent service versions, enabling regression testing across iterations. Automated tests are triggered automatically when you submit a service for review.
Manual testing
Use the service instance deployment link to create a service instance in your account and verify the deployment process.
To apply for a free trial of a cloud resource for service testing, see Configure a free trial.
-
Log on to the Compute Nest console.
-
Find the saved service. Click the service name to open the service details page.
-
Click the Service Test tab and then click the test link to open the service instance creation page.
On the service instance creation page, verify the user interface (UI).
-
After the test is complete, the Test successful message is displayed on the Service Test tab. This confirms that the service instance was created and the service is available.
Automated testing
Create a test case to customize service template parameters. The test case is linked to the service review process and runs automatically when you submit the service for review. Test cases are inherited by all subsequent service versions, enabling regression testing when you upgrade or update the service.
If you do not add a test case, automated testing will not run when you submit the service for review.
Test case configuration
A test case is defined in a YAML file. The following example shows a test case configuration for a consul service.
---
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 for the service. The default configuration uses the parameters defined in the service template.
Parameters
The following table describes the fields in a test case configuration.
|
Parameter |
Required |
Description |
|
specificationName |
No |
The name of the parameter set. The parameters in the parameter set cannot conflict with the parameters defined in the |
|
parameters |
Yes |
Parameters used to run the Resource Orchestration Service (ROS) template for a single test. |
-
The
InstanceChargeTypeparameter, which specifies the billing method, must be set toPostPaid. -
The
$[iact3-auto]pseudo parameter automatically selects a random value from the available options. It automatically selects a defined cloud resource from those available in the current region. For more information, see Pseudo parameters. -
Properties that are strongly associated with a region (
region), such as Vpc, zone, vSwitch, and security group, are automatically generated when a task runs. These properties also support user customization.
Create a test task
To run a test, select a template and test case in your Compute Nest account.
-
In the Test Tasks section, click Create Task. In the dialog box that appears, configure the task information.
-
Set a name for the test task.
-
Select a service template and a test case.
If you have multiple templates, you can add a test case for each template.
-
Select the region where you want to run the task.
If you do not select a region, one is randomly selected from the deployment regions that are configured for the service.
-
-
Click Create Now.
After you create the task, you can view its progress in the task list. The task appears in the Test Tasks list. The list contains information such as Task Name, Region, Test Case, and Execution Status. The initial execution status is Running.
-
View the report.
After the task completes, you can view the test configuration and test case information in the execution report.
-
Click the
icon next to the test task name and then click Details. -
In the Test Report dialog box, review the task's test configuration, region, and stack. The dialog box has two sections: The Test Configuration section displays the YAML parameters of the template, such as
SystemDiskSize,PayType,DataDiskSize,InstanceType,AllocatePublicIp,DataDiskCategory,InstancePassword, andSystemDiskCategory. The Test Case section displays the test name, region, stack, result, and test log in a table. You can click the View link to view the details of the corresponding test log.
-
-
View the logs.
You can view information such as the effective parameters, stack details, and error messages in the logs. The log details dialog box shows fields such as
Region,StackName,StackId,TestedResult, andResultReason. For example, if the test result isFailed, the reason might beStackValidationFailedwith a message such asResources.Database.Condition: Unrecognized value 'Please fill in'. This indicates an invalid parameter value. Valid values for boolean types include'0','1','true','false','yes','no','on', and'off'.
Common errors and solutions
The following are common service testing errors and their solutions.
-
Error message: In the error log,
TestedResultisFailedandResultReasonshowsIacerException, can not find any available value for ZoneId in {region}. An example is "IacerException, can not find any available value for ZoneId in cn-qingdao region in [] for default".Solution: No corresponding resources are available in the current region. Specify a different region for the task.
-
Error message: "Resources.TiDBServerScalingGroupEnable.Properties: : Unknown Property DetachOptions request id: 51341F62-56DC-xxxx-xxxx-xxx"
Solution: A parameter in the template is invalid. Modify the parameter in the test configuration based on the log message.
Pseudo parameters
Manually entering test parameters for functional verification can be tedious. Use the $[iact3-auto] pseudo parameter to automatically fill in parameter values. Pseudo parameters are supported in the following scenarios:
-
The parameter supports an API for querying its constraints. When you call the
GetTemplateParameterConstraintsoperation for the parameter, the operation returns a list ofAllowedValues. -
The parameter name has a specific meaning or implies a clear resource type. In this case, the pseudo parameter automatically obtains an appropriate value.
-
For parameters such as
VpcId,VswitchId, andSecurityGroupId, the pseudo parameter automatically selects a corresponding instance ID from the current region. -
For parameters such as
VpcName,Password, andUuid, the pseudo parameter randomly generates a name, password, or UUID value. -
The pseudo parameter supports names that match the following regular expressions:
-
If a parameter name matches the regular expression
vpc(_|)id, it automatically obtains a randomVpcIdvalue from the current region. -
If a parameter name matches
v(_|)switch(_|)id, it automatically obtains aVswitchIdvalue from the current region. If the parameter name also contains a value that matcheszone(_|)id, the ID of a vSwitch in the corresponding zone is queried. -
If a parameter name matches
security(_|)group(_id|id), it automatically obtains security group information. -
If a parameter name matches the regular expression
r'\w*name', a random string that starts withiacer-is generated. -
If a parameter name matches the regular expression
r'\w*password', a random password that contains uppercase letters, lowercase letters, digits, and special characters is generated. -
If a parameter name matches the regular expression
r'\w*uuid', it automatically generates a UUID.
-
-