|View source on GitHub|
OpenWeave includes a number of Python scripts for testing Weave functionality over simulated Happy topologies. These test cases ensure the topology is properly configured for network connectivity and Weave deployment.
Test case scripts are found in the OpenWeave repository at
There are two types of tests:
- Service — Tests that interface with a Service
- Standalone — Tests that run on local topologies
- Install OpenWeave. See the OpenWeave Build guide for instructions.
- Install Happy. See the Happy Setup guide for instructions.
- Navigate to the directory containing the target test case. For example, to
run an Echo profile test case:
Change test topology
OpenWeave test cases run against the sample Happy topologies found in
To use your own custom Happy topology in a test case:
- After constructing your custom topology, save it in JSON format. This saves
the topology state file in the
happy-state -s my_topology.json
In the test case script, locate the topology file being used. Topologies in test cases are typically assigned to the
self.topology_filevariable. For example,
test_weave_echo_01.pyuses the following topology for a default OpenWeave build:
self.topology_file = os.path.dirname(os.path.realpath(__file__)) + \ "/../../../topologies/standalone/three_nodes_on_thread_weave.json"
Update the topology path to point to your custom topology state file:
self.topology_file = "~/my_topology.json"
Alternatively, place your custom topology state file in the same location as those included with OpenWeave:
self.topology_file = os.path.dirname(os.path.realpath(__file__)) + \ "/../../../topologies/standalone/my_topology.json"