Test Durumları

Kaynağı GitHub'da görüntüleyin

OpenWeave, Simüle edilmiş Happy topolojileri üzerinde Weave işlevselliğini test etmek için bir dizi Python betiği içerir. Bu test durumları, topolojinin ağ bağlantısı ve Weave dağıtımı için uygun şekilde yapılandırılmasını sağlar.

Test durumda betiklerinizin OpenWeave depoda bulunan /src/test-apps/happy/tests . İki tür test vardır:

  • Servis - Testler bir Servisi arayüz
  • Bağımsız - Yerel topolojileri üzerinde çalışan Testler

Çalıştırmak

  1. OpenWeave'i yükleyin. OpenWeave Bkz Yapı talimatları için rehber.
  2. Happy'i yükleyin. Mutlu Bkz Kurulum talimatları için rehber.
  3. Hedef test senaryosunu içeren dizine gidin. Örneğin, bir yankı profili test durumda çalıştırmak için:
    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:

  1. 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
  2. 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"
    
  3. Özel topoloji durumu dosyanıza işaret etmek için topoloji yolunu güncelleyin:

    self.topology_file = "~/my_topology.json"
    
  4. Alternatif olarak, özel topoloji durum dosyanızı OpenWeave'de bulunanlarla aynı konuma yerleştirin:

    self.topology_file = os.path.dirname(os.path.realpath(__file__)) + \
        "/../../../topologies/standalone/my_topology.json"
    
  5. Test vakası çalıştırın .