vmware-nsx/quantum/tests/unit
Paul Michali 8ec8987c31 Remove cfg option default value and check if missing
Currently, several plugins already check config options at __init__()
for validity and will exit, if the settings are incorrect. However,
most (all?) config option definitions have default values, so if the
option is missing, a valid, but maybe unexpected value will be used.
This is what occurred in the bug.

The proposed fix is to take a config option, sql_connection, which is
used by many plugins, and remove the default value. Then, at init
time, when the config option is used in configure_db(), a check is
made for the value. If the value is not set, a warning is logged and
the value is set to the default, for db/api.py. It is expected that
this will be the only module to consume this config option.

Added UT to check that log warning is issued. Also, changed the timing
so that the test takes 0.25 secs vs 12 secs. Removed UTs in two plugin
tests that checked the default value for sql_connection.

Other alternatives explored in previous patches, were to either
raise an exception, or mark this config option as "required". This
resulted in a large number of changes to tests, and required config
overrides in plugins that imported quantum.db.api, but did not use
sql_connection.

In order to keep this solution (of this log-hanging fruit) fix, the
proposed, simpler change is being made.

Some cleanup to the Cisco plugin test case was also made, so that
the mock was more in line with what production code does.

bug 1059923

Change-Id: I8c2a4e05231ac4e172d0dccece067e6fdb354341
2013-02-12 09:24:22 -05:00
..
bigswitch Replaces assertEquals to assertEqual 2012-12-14 10:05:10 +08:00
cisco Remove cfg option default value and check if missing 2013-02-12 09:24:22 -05:00
db Adds xml support for quantum v2 API. 2013-02-06 00:50:24 +00:00
extensions Move extension.py into quantum/api. 2012-11-20 10:07:29 -05:00
hyperv Fix line endings from CRLF to LF. 2013-01-16 09:44:06 -05:00
linuxbridge Remove cfg option default value and check if missing 2013-02-12 09:24:22 -05:00
metaplugin Remove unused imports in unit tests 2013-01-13 02:20:35 +02:00
nec Remove cfg option default value and check if missing 2013-02-12 09:24:22 -05:00
nicira Remove cfg option default value and check if missing 2013-02-12 09:24:22 -05:00
openvswitch Remove cfg option default value and check if missing 2013-02-12 09:24:22 -05:00
ryu Remove cfg option default value and check if missing 2013-02-12 09:24:22 -05:00
__init__.py Config lockutils to use a temp path for tests. 2013-01-17 18:42:37 +00:00
_test_extension_portbindings.py Add a common test case for Port Binding Extension 2013-01-17 01:45:15 +09:00
_test_rootwrap_exec.py Remove unused imports in unit tests 2013-01-13 02:20:35 +02:00
database_stubs.py Logging module cleanup 2013-01-03 16:20:56 +08:00
dummy_plugin.py API extension and DB support for service types 2013-01-07 17:21:42 -08:00
extension_stubs.py Move extension.py into quantum/api. 2012-11-20 10:07:29 -05:00
test_agent_config.py Define root_helper variable under the [AGENT] section 2013-02-04 09:11:47 +00:00
test_agent_linux_utils.py Replaces assertEquals to assertEqual 2012-12-14 10:05:10 +08:00
test_agent_netns_cleanup.py Enable OVS and NETNS utilities to perform logging 2013-02-07 16:23:14 +00:00
test_agent_ovs_cleanup.py Enable OVS and NETNS utilities to perform logging 2013-02-07 16:23:14 +00:00
test_agent_rpc.py Fix i18n messages 2013-01-22 11:42:15 +08:00
test_api_api_common.py Completes unittest coverage of quantum.api.api_common 2013-01-21 17:06:09 +08:00
test_api_v2_resource.py Adds xml support for quantum v2 API. 2013-02-06 00:50:24 +00:00
test_api_v2.py Adds xml support for quantum v2 API. 2013-02-06 00:50:24 +00:00
test_attributes.py Improvements to API validation logic. 2013-02-09 01:31:47 -05:00
test_auth.py AuthN support for Quantum 2012-06-05 09:52:26 -05:00
test_common_utils.py Improve openvswitch and linuxbridge agents' parsing of mappings 2012-11-20 10:44:00 -05:00
test_config.py API extension and DB support for service types 2013-01-07 17:21:42 -08:00
test_db_migration.py Port to argparse based cfg 2013-01-09 11:48:22 -05:00
test_db_plugin.py Improvements to API validation logic. 2013-02-09 01:31:47 -05:00
test_db_rpc_base.py Replaces assertEquals to assertEqual 2012-12-14 10:05:10 +08:00
test_db.py Remove cfg option default value and check if missing 2013-02-12 09:24:22 -05:00
test_debug_commands.py Register root_helper in test_debug_commands and test_dhcp_agent 2013-02-06 13:22:53 +02:00
test_dhcp_agent.py Use AssertEqual instead of AssertTrue 2013-02-12 07:03:53 +00:00
test_extension_portsecurity.py Adds port security api extension and base class 2013-01-23 13:42:30 -08:00
test_extension_security_group.py Add NVP Security group support 2013-02-07 03:57:53 -08:00
test_extensions.py Adds API parameters to quantum.api.extension.ResourceExtension 2013-02-11 13:26:53 +09:00
test_iptables_firewall.py Implements quantum security groups support on OVS plugin 2013-02-10 07:42:28 +09:00
test_iptables_manager.py Import order clean-up 2012-11-02 09:52:12 +08:00
test_l3_agent.py only destroy single namespace if router_id is set 2013-02-12 08:52:04 +01:00
test_l3_plugin.py L3 API support for nicira plugin 2013-02-11 05:19:04 -08:00
test_linux_daemon.py add metadata proxy support for Quantum Networks 2012-11-28 19:09:16 -05:00
test_linux_dhcp.py add non-routed subnet metadata support 2013-02-08 00:05:51 -05:00
test_linux_external_process.py Fix i18n messages 2013-01-22 11:42:15 +08:00
test_linux_interface.py Define root_helper variable under the [AGENT] section 2013-02-04 09:11:47 +00:00
test_linux_ip_lib.py Be smarter when figuring out broadcast address 2013-02-05 16:29:00 +01:00
test_loadbalancer_plugin.py Adds xml support for quantum v2 API. 2013-02-06 00:50:24 +00:00
test_metadata_agent.py Pass X-Forwarded-For header to Nova 2013-01-08 19:18:58 -05:00
test_metadata_namespace_proxy.py add metadata proxy support for Quantum Networks 2012-11-28 19:09:16 -05:00
test_policy.py Remove unused imports in unit tests 2013-01-13 02:20:35 +02:00
test_quantum_context.py Replaces assertEquals to assertEqual 2012-12-14 10:05:10 +08:00
test_quantum_manager.py API extension and DB support for service types 2013-01-07 17:21:42 -08:00
test_quota_per_tenant_ext.py Adds xml support for quantum v2 API. 2013-02-06 00:50:24 +00:00
test_rootwrap.py Remove unused imports in unit tests 2013-01-13 02:20:35 +02:00
test_security_groups_rpc.py Implements quantum security groups support on OVS plugin 2013-02-10 07:42:28 +09:00
test_servicetype.py Adds xml support for quantum v2 API. 2013-02-06 00:50:24 +00:00
test_setup.py Bug #1013967 - Quantum is breaking on tests with pep 1.3 2012-06-16 15:38:10 -03:00
test_wsgi.py Adds xml support for quantum v2 API. 2013-02-06 00:50:24 +00:00
testlib_api.py Adds xml support for quantum v2 API. 2013-02-06 00:50:24 +00:00