Set endpoint_type = internal by default for glance requests

Closes-Bug: PROD-35257
Change-Id: Ib6876500439a9c62fc942330c255b1d914bb4c9e
diff --git a/_modules/glanceng.py b/_modules/glanceng.py
index 080de42..d607fef 100644
--- a/_modules/glanceng.py
+++ b/_modules/glanceng.py
@@ -94,8 +94,12 @@
     Only intended to be used within glance-enabled modules
     '''
 
+    endpoint_type = str(connection_args.get('connection_endpoint_type',
+                                            'internal'))
     kstone = __salt__['keystoneng.auth'](profile, **connection_args)
-    g_endpoint = __salt__['keystoneng.endpoint_get']('glance', profile=profile)
+    g_endpoint = __salt__['keystoneng.endpoint_get']('glance',
+                                                     profile=profile,
+                                                     interface=endpoint_type)
     glance_client = client.Client(api_version, session=kstone.session, endpoint=g_endpoint.get('url'))
     return glance_client
 
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 9761585..1f05f1c 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -40,6 +40,9 @@
     virtualenv $VENV_DIR
     source ${VENV_DIR}/bin/activate
     python -m pip install salt${PIP_SALT_VERSION}
+    if [[ -f ${CURDIR}/test-requirements.txt ]]; then
+       python -m pip install -r ${CURDIR}/test-requirements.txt
+    fi
 }
 
 setup_mock_bin() {
diff --git a/tests/test-requirements.txt b/tests/test-requirements.txt
new file mode 100644
index 0000000..bc7dc7f
--- /dev/null
+++ b/tests/test-requirements.txt
@@ -0,0 +1,4 @@
+jsonschema
+reno
+setuptools<45.0.0
+msgpack<1.0.0