Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 2e5dfb4

Browse files
author
Allen Shih
committed
wdmNext automation refactor improvements
1 parent 13b683e commit 2e5dfb4

File tree

96 files changed

+6606
-3520
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+6606
-3520
lines changed

src/test-apps/happy/test-templates/WeaveWdmNext.py

Lines changed: 214 additions & 347 deletions
Large diffs are not rendered by default.
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Defines all test parameter options for WeaveWdmNext automation.
5+
"""
6+
7+
# Test Options
8+
# Client nodes
9+
CLIENTS = "clients"
10+
# Whether to use plaid
11+
PLAID = "plaid"
12+
# Control test result output
13+
QUIET = "quiet"
14+
# Server nodes
15+
SERVER = "server"
16+
# Whether to use strace
17+
STRACE = "strace"
18+
# Name of test case
19+
TEST_CASE_NAME = "test_case_name"
20+
# Time to wait for test end
21+
TIMEOUT = "timeout"
22+
# Option for using persistent storage
23+
USE_PERSISTENT_STORAGE = "use_persistent_storage"
24+
# Type of weave subscription
25+
WDM_OPTION = "wdm_option"
26+
# Tag to denote test type
27+
TEST_TAG = "test_tag"
28+
29+
"""
30+
Client/Server SHARED Options
31+
"""
32+
# Resets the state of the data sink after each iteration
33+
CLEAR_STATE_BETWEEN_ITERATIONS = "clear_state_between_iterations"
34+
# Enable/disable flip trait data in HandleDataFlipTimeout
35+
ENABLE_FLIP = "enable_flip"
36+
# Controls whether the process will exit the iteration or not at the end of the iteration
37+
ENABLE_STOP = "enable_stop"
38+
# Controls the event generator (None | Debug | Livenesss | Security | Telemetry | TestTrait)
39+
# running in the node's background.
40+
EVENT_GENERATOR = "event_generator"
41+
# Fault injections
42+
FAULTS = "faults"
43+
# Control what ends the test iteration
44+
# 0(client cancel), 1(publisher cancel), 2(client abort), 3(Publisher abort), 4(Idle)
45+
FINAL_STATUS = "final_status"
46+
# Period of time (milliseconds) between events
47+
INTER_EVENT_PERIOD = "inter_event_period"
48+
# Specify time (seconds) between liveness checks in WDM subscription as publisher
49+
LIVENESS_CHECK_PERIOD = "wdm_liveness_check_period"
50+
# Save wdm perf data in files
51+
SAVE_PERF = "save_perf"
52+
TAP = "tap_device"
53+
# Controls which traits are published and subscribed to, values must be same between client/server
54+
TEST_CASE = "test_case"
55+
# Period of time (milliseconds) between iterations
56+
TEST_DELAY = "test_delay"
57+
# Number of times test sequence is repeated
58+
TEST_ITERATIONS = "test_iterations"
59+
# Period of time between trait instance mutations
60+
TIMER_PERIOD = "timer_period"
61+
# Number of times the node will mutate the trait instance per iteration
62+
TOTAL_COUNT = "total_count"
63+
# Logs to verify on node
64+
LOG_CHECK = "log_check"
65+
66+
"""
67+
Client ONLY Options
68+
"""
69+
CASE = "case"
70+
# File containing Weave certificate to authenticate the node
71+
CASE_CERT_PATH = "node_cert"
72+
# File containing private key to authenticate the node
73+
CASE_KEY_PATH = "node_key"
74+
# Enable/disable dictionary tests
75+
ENABLE_DICTIONARY_TEST = "enable_dictionary_test"
76+
# Enable automatic subscription retries by WDM
77+
ENABLE_RETRY = "enable_retry"
78+
# Enable mock event initial counter using timestamp
79+
ENABLE_MOCK_EVENT_TIMESTAMP_INITIAL_COUNTER = "enable_mock_event_timestamp_initial_counter"
80+
# Use group key to encrypt messages
81+
GROUP_ENC = "group_enc"
82+
# Key to encrypt messages
83+
GROUP_ENC_KEY_ID = "group_enc_key_id"
84+
# The conditionality of the update (conditional | unconditional | mixed | alternate)
85+
UPDATE_CONDITIONALITY = "wdm_update_conditionality"
86+
# Client discards the paths on which SetUpdated was called in case of error
87+
UPDATE_DISCARD_ERROR = "wdm_update_discard_on_error"
88+
# The first mutation to apply to each trait instance
89+
UPDATE_MUTATION = "wdm_update_mutation"
90+
# Number of mutations performed in same context
91+
UPDATE_NUM_MUTATIONS = "wdm_update_number_of_mutations"
92+
# How many times same mutation is applied before moving on
93+
UPDATE_NUM_REPEATED_MUTATIONS = "wdm_update_number_of_repeated_mutations"
94+
# Number of traits to mutate (1-4)
95+
UPDATE_NUM_TRAITS = "wdm_update_number_of_traits"
96+
# Controls when first mutation is applied and flushed
97+
UPDATE_TIMING = "wdm_update_timing"
98+
99+
100+
"""
101+
Server ONLY Options
102+
"""
103+
# Node ID of the destination node
104+
WDM_SUBLESS_NOTIFY_DEST_NODE = "wdm_subless_notify_dest_node"
105+
106+
# Options top level keys
107+
CLIENT = "client_options"
108+
SERVER = "server_options"
109+
TEST = "test_options"
110+
111+
OPTIONS = {
112+
CLIENT: {
113+
CASE: False,
114+
CASE_CERT_PATH: None,
115+
CASE_KEY_PATH: None,
116+
CLEAR_STATE_BETWEEN_ITERATIONS: False,
117+
ENABLE_DICTIONARY_TEST: True,
118+
ENABLE_FLIP: None,
119+
ENABLE_RETRY: False,
120+
ENABLE_STOP: True,
121+
ENABLE_MOCK_EVENT_TIMESTAMP_INITIAL_COUNTER: True,
122+
EVENT_GENERATOR: None,
123+
FAULTS: None,
124+
FINAL_STATUS: None,
125+
GROUP_ENC: False,
126+
GROUP_ENC_KEY_ID: None,
127+
INTER_EVENT_PERIOD: None,
128+
LIVENESS_CHECK_PERIOD: None,
129+
SAVE_PERF: False,
130+
TAP: None,
131+
TEST_CASE: 1,
132+
TEST_DELAY: None,
133+
TEST_ITERATIONS: None,
134+
TIMER_PERIOD: None,
135+
TOTAL_COUNT: None,
136+
UPDATE_CONDITIONALITY: None,
137+
UPDATE_DISCARD_ERROR: False,
138+
UPDATE_MUTATION: None,
139+
UPDATE_NUM_MUTATIONS: None,
140+
UPDATE_NUM_REPEATED_MUTATIONS: None,
141+
UPDATE_NUM_TRAITS: None,
142+
UPDATE_TIMING: None,
143+
LOG_CHECK: []
144+
},
145+
SERVER: {
146+
CLEAR_STATE_BETWEEN_ITERATIONS: False,
147+
ENABLE_FLIP: None,
148+
ENABLE_STOP: False,
149+
EVENT_GENERATOR: None,
150+
FAULTS: None,
151+
FINAL_STATUS: None,
152+
INTER_EVENT_PERIOD: None,
153+
LIVENESS_CHECK_PERIOD: None,
154+
SAVE_PERF: False,
155+
TAP: None,
156+
TEST_CASE: 1,
157+
TEST_DELAY: 0,
158+
TEST_ITERATIONS: None,
159+
TIMER_PERIOD: None,
160+
TOTAL_COUNT: None,
161+
WDM_SUBLESS_NOTIFY_DEST_NODE: None,
162+
LOG_CHECK: []
163+
},
164+
TEST: {
165+
CLIENTS: None,
166+
PLAID: "auto",
167+
QUIET: True,
168+
SERVER: None,
169+
STRACE: False,
170+
TEST_CASE_NAME: [],
171+
TIMEOUT: 60 * 15,
172+
WDM_OPTION: None,
173+
USE_PERSISTENT_STORAGE: True,
174+
TEST_TAG: None
175+
}
176+
}

src/test-apps/happy/tests/standalone/wdmNext/test_weave_wdm_next_application_key_01.py

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -34,41 +34,9 @@
3434
class test_weave_wdm_next_application_key_01(weave_wdm_next_test_base):
3535

3636
def test_weave_wdm_next_application_key_01(self):
37-
wdm_next_args = {}
38-
39-
wdm_next_args['wdm_option'] = "mutual_subscribe"
40-
41-
wdm_next_args['test_client_case'] = 2
42-
wdm_next_args['total_client_count'] = 2
43-
wdm_next_args['final_client_status'] = 0
44-
wdm_next_args['timer_client_period'] = 5000
45-
wdm_next_args['test_client_iterations'] = 5
46-
wdm_next_args['test_client_delay'] = 2000
47-
wdm_next_args['enable_client_flip'] = 1
48-
49-
wdm_next_args['test_server_case'] = 2
50-
wdm_next_args['total_server_count'] = 2
51-
wdm_next_args['final_server_status'] = 4
52-
wdm_next_args['timer_server_period'] = 4000
53-
wdm_next_args['enable_server_flip'] = 1
54-
55-
wdm_next_args['client_clear_state_between_iterations'] = True
56-
wdm_next_args['server_clear_state_between_iterations'] = True
57-
58-
wdm_next_args['client_log_check'] = [('Handler\[0\] \[(ALIVE|CONFM)\] bound mutual subscription is going away', wdm_next_args['test_client_iterations']),
59-
('Client->kEvent_OnNotificationProcessed', wdm_next_args['test_client_iterations'] * (wdm_next_args['total_server_count'] + 1)),
60-
('Client\[0\] \[(ALIVE|CONFM)\] EndSubscription Ref\(\d+\)', wdm_next_args['test_client_iterations']),
61-
('Client\[0\] moving to \[ FREE\] Ref\(0\)', wdm_next_args['test_client_iterations']),
62-
('Handler\[0\] Moving to \[ FREE\] Ref\(0\)', wdm_next_args['test_client_iterations'])]
63-
wdm_next_args['server_log_check'] = [('Handler\[0\] \[(ALIVE|CONFM)\] bound mutual subscription is going away', wdm_next_args['test_client_iterations']),
64-
('Client->kEvent_OnNotificationProcessed', wdm_next_args['test_client_iterations'] * (wdm_next_args['total_client_count'] + 1)),
65-
('Client\[0\] \[(ALIVE|CONFM)\] CancelRequestHandler Ref\(\d+\)', wdm_next_args['test_client_iterations']),
66-
('Client\[0\] moving to \[ FREE\] Ref\(0\)', wdm_next_args['test_client_iterations']),
67-
('Handler\[0\] Moving to \[ FREE\] Ref\(0\)', wdm_next_args['test_client_iterations'])]
68-
wdm_next_args['test_tag'] = self.__class__.__name__[35:].upper()
69-
wdm_next_args['test_case_name'] = ['B01: Stress Mutual Subscribe: Application key: Key distribution']
7037
print 'test file: ' + self.__class__.__name__
7138
print "test_weave_wdm_next_application_key test A01 and B01"
39+
wdm_next_args = self.get_test_param_json(self.__class__.__name__)
7240
super(test_weave_wdm_next_application_key_01, self).weave_wdm_next_test_base(wdm_next_args)
7341

7442

src/test-apps/happy/tests/standalone/wdmNext/test_weave_wdm_next_application_key_02.py

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -28,49 +28,19 @@
2828
import os
2929
import unittest
3030
from weave_wdm_next_test_base import weave_wdm_next_test_base
31+
import WeaveWdmNextOptions as wwno
3132

3233

3334
class test_weave_wdm_next_application_key_02(weave_wdm_next_test_base):
3435

3536
def test_weave_wdm_next_application_key_02(self):
36-
wdm_next_args = {}
37-
wdm_next_args['wdm_option'] = "mutual_subscribe"
38-
wdm_next_args['total_client_count'] = 2
39-
wdm_next_args['final_client_status'] = 0
40-
wdm_next_args['timer_client_period'] = 5000
41-
wdm_next_args['test_client_iterations'] = 5
42-
wdm_next_args['test_client_delay'] = 2000
43-
wdm_next_args['enable_client_flip'] = 1
44-
45-
wdm_next_args['total_server_count'] = 2
46-
wdm_next_args['final_server_status'] = 4
47-
wdm_next_args['timer_server_period'] = 4000
48-
wdm_next_args['enable_server_flip'] = 1
49-
50-
wdm_next_args['group_enc'] = True
51-
wdm_next_args['group_enc_key_id'] = "0x00005536"
52-
53-
wdm_next_args['client_clear_state_between_iterations'] = True
54-
wdm_next_args['server_clear_state_between_iterations'] = True
55-
56-
wdm_next_args['client_log_check'] = [('Message Encryption Key', 1),
57-
('Handler\[0\] \[(ALIVE|CONFM)\] bound mutual subscription is going away', wdm_next_args['test_client_iterations']),
58-
('Client->kEvent_OnNotificationProcessed', wdm_next_args['test_client_iterations'] * (wdm_next_args['total_server_count'] + 1)),
59-
('Client\[0\] \[(ALIVE|CONFM)\] EndSubscription Ref\(1\)', wdm_next_args['test_client_iterations']),
60-
('Client\[0\] moving to \[ FREE\] Ref\(0\)', wdm_next_args['test_client_iterations']),
61-
('Handler\[0\] Moving to \[ FREE\] Ref\(0\)', wdm_next_args['test_client_iterations'])]
62-
wdm_next_args['server_log_check'] = [('Handler\[0\] \[(ALIVE|CONFM)\] bound mutual subscription is going away', wdm_next_args['test_client_iterations']),
63-
('Client->kEvent_OnNotificationProcessed', wdm_next_args['test_client_iterations'] * (wdm_next_args['total_client_count'] + 1)),
64-
('Client\[0\] \[(ALIVE|CONFM)\] CancelRequestHandler Ref\(1\)', wdm_next_args['test_client_iterations']),
65-
('Client\[0\] moving to \[ FREE\] Ref\(0\)', wdm_next_args['test_client_iterations']),
66-
('Handler\[0\] Moving to \[ FREE\] Ref\(0\)', wdm_next_args['test_client_iterations'])]
67-
wdm_next_args['test_tag'] = self.__class__.__name__[35:].upper()
68-
wdm_next_args['test_case_name'] = ['B02: Stress Mutual Subscribe: Application key: Group key']
6937
print 'test file: ' + self.__class__.__name__
7038
print "test_weave_wdm_next_application_key test A02 and B02"
71-
if "WEAVE_SYSTEM_CONFIG_USE_LWIP" in os.environ.keys() and os.environ["WEAVE_SYSTEM_CONFIG_USE_LWIP"] == "1":
39+
if "WEAVE_SYSTEM_CONFIG_USE_LWIP" in os.environ.keys() and os.environ[
40+
"WEAVE_SYSTEM_CONFIG_USE_LWIP"] == "1":
7241
print "it does not support wdm with group key encryption under Lwip:"
7342
return
43+
wdm_next_args = self.get_test_param_json(self.__class__.__name__)
7444
super(test_weave_wdm_next_application_key_02, self).weave_wdm_next_test_base(wdm_next_args)
7545

7646

0 commit comments

Comments
 (0)