Merge "Allow the Octavia wsgi to accept argv parameters"

This commit is contained in:
Zuul 2020-01-21 08:07:24 +00:00 committed by Gerrit Code Review
commit b6deb12b5d
3 changed files with 10 additions and 2 deletions

View File

@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import sys
import keystonemiddleware.audit as audit_middleware
from oslo_config import cfg
from oslo_log import log as logging
@ -45,6 +47,8 @@ def _init_drivers():
def setup_app(pecan_config=None, debug=False, argv=None):
"""Creates and returns a pecan wsgi app."""
if argv is None:
argv = sys.argv
octavia_service.prepare_service(argv)
cfg.CONF.log_opt_values(LOG, logging.DEBUG)

View File

@ -36,8 +36,10 @@ class TestRootController(base_db_test.OctaviaDBTestBase):
self.conf.config(group='api_settings', auth_strategy=constants.NOAUTH)
def _get_versions_with_config(self):
# Note: we need to set argv=() to stop the wsgi setup_app from
# pulling in the testing tool sys.argv
app = pecan.testing.load_test_app({'app': pconfig.app,
'wsme': pconfig.wsme})
'wsme': pconfig.wsme}, argv=())
return self.get(app=app, path='/').json.get('versions', None)
def test_api_versions(self):

View File

@ -144,8 +144,10 @@ class BaseAPITest(base_db_test.OctaviaDBTestBase):
self.addCleanup(check_quota_met_true_mock.stop)
def _make_app(self):
# Note: we need to set argv=() to stop the wsgi setup_app from
# pulling in the testing tool sys.argv
return pecan.testing.load_test_app({'app': pconfig.app,
'wsme': pconfig.wsme})
'wsme': pconfig.wsme}, argv=())
def _get_full_path(self, path):
return ''.join([self.BASE_PATH, path])