Install test_server.bin in well known location
This patch installs and uses test_server.bin from
/opt/octavia-tempest-plugin as a well known location on the
filesystem. This way tests, like grenade, that run the devstack
plugins once in /old paths, can find the binary when running from
/new paths.
Change-Id: Ia78f16fde026269dec01f4dceb202842ad12a557
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index 4b8f60b..df0336e 100644
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -16,9 +16,11 @@
fi
go_path=$(find $DEST/tempest/.tox/tempest/ -name test_server.go)
- bin_path=${go_path%.go}.bin
+ sudo mkdir -m755 -p /opt/octavia-tempest-plugin
+ sudo chown $STACK_USER /opt/octavia-tempest-plugin
CGO_ENABLED=0 GOOS=linux go build \
- -a -ldflags '-s -w -extldflags -static' -o $bin_path \
+ -a -ldflags '-s -w -extldflags -static' \
+ -o /opt/octavia-tempest-plugin/test_server.bin \
${DEST}/octavia-tempest-plugin/octavia_tempest_plugin/contrib/test_server/test_server.go
}
diff --git a/octavia_tempest_plugin/config.py b/octavia_tempest_plugin/config.py
index 77d2f6e..f44bf96 100644
--- a/octavia_tempest_plugin/config.py
+++ b/octavia_tempest_plugin/config.py
@@ -213,6 +213,10 @@
default='/var/log/octavia-amphora.log',
help='File path, on the tempest system, to the amphora admin '
'log file.'),
+ cfg.StrOpt('test_server_path',
+ default='/opt/octavia-tempest-plugin/test_server.bin',
+ help='Filesystem path to the test web server that will be '
+ 'installed in the web server VMs.'),
]
lb_feature_enabled_group = cfg.OptGroup(name='loadbalancer-feature-enabled',
diff --git a/octavia_tempest_plugin/tests/test_base.py b/octavia_tempest_plugin/tests/test_base.py
index f260e88..669a33c 100644
--- a/octavia_tempest_plugin/tests/test_base.py
+++ b/octavia_tempest_plugin/tests/test_base.py
@@ -13,7 +13,6 @@
# under the License.
import ipaddress
-import pkg_resources
import random
import shlex
import string
@@ -849,8 +848,7 @@
@classmethod
def _install_start_webserver(cls, ip_address, ssh_key, start_id):
- local_file = pkg_resources.resource_filename(
- 'octavia_tempest_plugin.contrib.test_server', 'test_server.bin')
+ local_file = CONF.load_balancer.test_server_path
dest_file = '/dev/shm/test_server.bin'
linux_client = remote_client.RemoteClient(