![]() |
OpenWeave zawiera szereg skryptów Pythona do testowania funkcjonalności Weave w symulowanych topologiach Happy. Te przypadki testowe zapewniają, że topologia jest prawidłowo skonfigurowana pod kątem łączności sieciowej i wdrożenia Weave.
Skrypty przypadków testowych znajdują się w repozytorium OpenWeave w /src/test-apps/happy/tests
. Istnieją dwa rodzaje testów:
- Obsługa - Testy że interfejs z usługą
- Samodzielne - Testy, które działają na lokalnych topologii
Biegać
- Zainstaluj OpenWeave. Zobacz OpenWeave Konstruowanie przewodnik dla instrukcji.
- Zainstaluj Happy. Zobacz Happy konfiguracji przewodnik dla instrukcji.
- Przejdź do katalogu zawierającego docelowy przypadek testowy. Na przykład, w celu uruchomienia sprawdzian profil echa:
cd <path-to-openweave-core>/src/test-apps/happy/tests/standalone/echo
python test_weave_echo_01.py
Change test topology
OpenWeave test cases run against the sample Happy topologies found in
/src/test-apps/happy/topologies/standalone
.
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
$HOME
directory: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_file
variable. For example,test_weave_echo_01.py
uses 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"
Zaktualizuj ścieżkę topologii, aby wskazywała na niestandardowy plik stanu topologii:
self.topology_file = "~/my_topology.json"
Alternatywnie umieść plik stanu niestandardowej topologii w tej samej lokalizacji, co te dołączone do OpenWeave:
self.topology_file = os.path.dirname(os.path.realpath(__file__)) + \ "/../../../topologies/standalone/my_topology.json"