1# Copyright (c) 2013 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5# TEST IS DISABLED UNTIL MIGRATED TO PYTHON 3. 6# For instructions on how to: go/tauto-py3-migration 7# To re-enable migrate to Python 3. 8# If the test is not migrated by 1/14/22 it will be deleted. 9 10import traceback 11 12from autotest_lib.client.common_lib.cros.network import ap_constants 13from autotest_lib.server import utils 14 15AUTHOR = 'krisr, wiley, jabele' 16NAME = 'network_WiFi_ChaosConfigFailure' 17TIME = 'SHORT' 18TEST_TYPE = 'server' 19PY_VERSION = 3 20 21DOC = """ 22This test is run when a chaos APConfigurator fails to successfully configure 23an AP. It will grab screenshots and print stack traces of the failure. 24This control file is only run directly to simulate APConfigurator failures for 25test purposes. 26""" 27 28from autotest_lib.server.cros.chaos_ap_configurators \ 29 import ap_configurator_factory 30from autotest_lib.server.cros.chaos_ap_configurators import ap_spec 31 32 33def run_chaos_config_failure(machine): 34 args_dict = utils.args_to_dict(args) 35 host = hosts.create_host(machine) 36 debug_aps = ['chromeos3-row2-rack1-host3',] 37 tested_ap_spec = ap_spec.APSpec(hostnames=debug_aps) 38 factory = ap_configurator_factory.APConfiguratorFactory() 39 ap = factory.get_ap_configurators_by_spec(tested_ap_spec)[0] 40 ap.set_using_ap_spec(tested_ap_spec) 41 ap.apply_settings() 42 ## Simulate test failure by forcing state and gathering artifacts 43 try: 44 raise RuntimeError("Simulated APConfigurator Error") 45 except Exception: 46 trace = ''.join(traceback.format_exc()) 47 ap.store_config_failure(trace) 48 job.run_test('network_WiFi_ChaosConfigFailure', ap=ap, 49 error_string=ap_constants.AP_CONFIG_FAIL, tag=ap.ssid) 50 51 52parallel_simple(run_chaos_config_failure, machines) 53