Comment 45 for bug 1820083

Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

Commenting out the __init__.py inside line 25/26.
where it checks the version with PBR
#__version__ = pbr.version.VersionInfo(
# 'etcd3gw').version_string()

commenting this line out and running ./test.py
my response is success.

# testing steps for bionic
version - 0.2.1-1ubuntu0.18.04.1
python3 version - 3.6.9
python2 version - 2.7.17

mkdir 1820083-verification-testing
cd 1820083-verification-testing
pull-lp-source python-etcd3gw bionic

apt install python3-pip
pip3 install -r requirements.txt
pip3 install -r test-requirements.txt

# generate certs in python-etcd3gw folder
openssl req -x509 -keyout localhost.key -newkey rsa:4096 -nodes -sha256 -out localhost.crt

#download etcd binaries & launch etcd locally with TLS enabled
wget https://github.com/etcd-io/etcd/releases/download/v3.3.13/etcd-v3.3.13-linux-amd64.tar.gz

tar -zxvf etcd-v3.3.14-linux-amd64.tar.gz

cd etcd-v3.3.14-linux-amd64/

#spin up etcd server
./etcd --name infra0 --data-dir infra0 --cert-file=/python-etcd3gw/localhost.crt --key-file=/python-etcd3gw/localhost.key --advertise-client-urls=https://127.0.0.1:2379 --listen-client-urls=https://127.0.0.1:2379

# test cert connection endpoint
curl --cacert localhost.crt --key localhost.key --cert localhost.crt https://127.0.0.1:2379/health

response
{"health":"true"}

modify test.py to your config setup for etcd

#run test
./test.py

response
success!

# code for test.py
touch test.py
chmod +rwx test.py

gedit test.py
#!/usr/bin/python3

from etcd3gw import Etcd3Client

c = Etcd3Client(host="127.0.0.1", protocol="https", cert_key="localhost.key", cert_cert="localhost.crt", ca_cert="localhost.crt", timeout=10)
c.put('test', 'success!')
resp = c.get('test')
print(b''.join(resp).decode())

#also feel free to run unit tests with
python3 -m unittest