Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca committed Dec 12, 2022
1 parent d42792e commit 7b000cd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 42 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ jobs:
--target linux-x64-java-matter-controller \
build \
"
- name: Run Tests
- name: Run Discover Tests
timeout-minutes: 65
run: |
scripts/run_in_build_env.sh \
Expand All @@ -471,9 +471,12 @@ jobs:
--app-args "--discriminator 3840 --interface-id -1" \
--tool-path out/linux-x64-java-matter-controller \
--tool-cluster "discover" \
--tool-args "--nodeid 1 --fabricid 1" \
--tool-args "commissionables" \
--factoryreset \
'
- name: Run Pairing Tests
timeout-minutes: 65
run: |
scripts/run_in_build_env.sh \
'./scripts/tests/run_java_test.py \
--app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \
Expand Down
1 change: 0 additions & 1 deletion scripts/tests/java/commissioning_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# limitations under the License.
#

# Commissioning test.
import logging
import os
import sys
Expand Down
57 changes: 18 additions & 39 deletions scripts/tests/java/discover_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# limitations under the License.
#

# Discovery test.
import logging
import os
import sys
Expand All @@ -26,7 +25,7 @@
import subprocess
import threading
import typing
from optparse import OptionParser
import argparse
from colorama import Fore, Style
from java.base import DumpProgramOutputToQueue

Expand All @@ -37,46 +36,24 @@ def __init__(self, thread_list: typing.List[threading.Thread], queue: queue.Queu
self.queue = queue
self.command = cmd

optParser = OptionParser()
optParser.add_option(
"--nodeid",
action="store",
dest="nodeid",
default='1',
type='str',
help="DNS-SD name corresponding with the given node ID",
metavar="<nodeid>"
)
optParser.add_option(
"--fabricid",
action="store",
dest="fabricid",
default='1',
type='str',
help="DNS-SD name corresponding with the given fabric ID",
metavar="<nodeid>"
)
optParser.add_option(
"-p",
"--paa-trust-store-path",
action="store",
dest="paaTrustStorePath",
default='',
type='str',
help="Path that contains valid and trusted PAA Root Certificates.",
metavar="<paa-trust-store-path>"
)
parser = argparse.ArgumentParser(description='Process discover arguments.')

(options, remainingArgs) = optParser.parse_args(args.split())
parser.add_argument('command', help="Command name")
parser.add_argument('-n', '--nodeid', help="DNS-SD name corresponding with the given node ID", default='1')
parser.add_argument('-f', '--fabricid', help="DNS-SD name corresponding with the given fabric ID", default='1')
parser.add_argument('-p', '--paa-trust-store-path', dest='paa_trust_store_path',
help="Path that contains valid and trusted PAA Root Certificates")

self.nodeid = options.nodeid
self.fabricid = options.fabricid
args = parser.parse_args(args.split())

self.command_name = args.command
self.nodeid = args.nodeid
self.fabricid = args.fabricid

logging.basicConfig(level=logging.INFO)

def TestCmdCommissionables(self):
java_command = self.command + ['discover', 'commissionables']
print(java_command)
logging.info(f"Execute: {java_command}")
java_process = subprocess.Popen(
java_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Expand All @@ -85,10 +62,12 @@ def TestCmdCommissionables(self):

def RunTest(self):
logging.info("Testing discovering commissionables devices")
java_exit_code = self.TestCmdCommissionables()
if java_exit_code != 0:
logging.error("Testing command commissionables failed with error %r" % java_exit_code)
return java_exit_code

if self.command_name == 'commissionables':
java_exit_code = self.TestCmdCommissionables()
if java_exit_code != 0:
logging.error("Testing command commissionables failed with error %r" % java_exit_code)
return java_exit_code

# Testing complete without errors
return 0

0 comments on commit 7b000cd

Please sign in to comment.