Config Methods
Introduction
The tester config methods provide a library of functions which are typically used in test scripts for the IN Tester for the purpose of checking and modifying application configuration.
This allows a test script to ensure that the application configuration is in the expected state before proceeding with a test, specifically in test suites where it is required to test multiple different application configuration values.
Tester helper methods are accessed via the “n2.n2svcd.tester” module:
local tester = require "n2.n2svcd.tester"
NOTE: Many of these methods use REST requests to access a ManageApp
. Hence they require:
- A
ManageApp
<application>
to be configured in then2svcd.xml
file. - A
RestClientApp
<application>
to be configured in then2svcd.xml
file. - A
RestClientAgent
<agent>
to be configured in then2svcd.xml
file.
Example:
<applications>
<application name="Manage" module="ManageApp">
<include>
<lib>../apps/manage/lib</lib>
</include>
</application>
<application name="REST-MANAGE" module="RestClientApp">
<include>
<lib>../apps/rest_c/lib</lib>
</include>
<parameters>
<parameter name="remote_host" value="localhost"/>
<parameter name="remote_port" value="8088"/>
<parameter name="path" value="/api/"/>
</parameters>
</application>
<application name="Test-Logic" module="LogicApp">
<include>
<lib>../apps/logic/lib</lib>
</include>
<parameters>
<parameter name="lua_lib_path" value="../lua/lib/?.lua"/>
...
<parameter name="default_rest_app_name_manage" value="REST-MANAGE"/>
</parameters>
<config>
...
<agents>
...
<agent module="RestClientApp::RestLuaAgent" libs="../apps/rest_c/lib"/>
</agents>
</config>
</application>
</applications>
.rest_config_set [Asynchronous]
The rest_config_set
method uses the n2svcd.rest_agent
library to send a REST
request to a ManageApp
to request that a configuration scalar value by modified.
The parameters for this method are:
Parameter | Type | Description |
---|---|---|
route
|
String |
The REST "route" that reaches the correct RestClientApp. See the RestClientAgent documentation. |
app_name
|
String |
[Required] The name of the application whose configuration scalar we are requesting. This must be a real application name, it cannot be a virtual (load-share/failover) app name. (Default = use the RestClientApp configured as "default_rest_app_name") |
config_name
|
String | [Required] The name of the configuration scalar value to modify. |
new_value
|
String | [Required] The new value to set for the application's configuration scalar. |
The rest_config_set
method returns true
.
Example:
tester_api.rest_config_set ('manage', 'Logic', 'SVC-0-LD-chunk_reload_secs', '4')