Add tests to validate python-redfish is working with python3
- Update setuptools within dockerfiles to support requirements.txt syntax. - Check that tests can be run with Python2 and 3.
This commit is contained in:
parent
d09a63a4c6
commit
66cb53df4e
@ -6,6 +6,9 @@ apt-get install -y python-pip
|
|||||||
COPY python-redfish.src.tar.gz /python-redfish.src.tar.gz
|
COPY python-redfish.src.tar.gz /python-redfish.src.tar.gz
|
||||||
RUN mkdir /var/log/python-redfish
|
RUN mkdir /var/log/python-redfish
|
||||||
RUN tar xvvf python-redfish.src.tar.gz
|
RUN tar xvvf python-redfish.src.tar.gz
|
||||||
|
# Need a really recent version of setuptools to support
|
||||||
|
# configparser>=3.3.0; python_version < '3' in requirements.txt
|
||||||
|
RUN pip install --upgrade setuptools
|
||||||
RUN cd python-redfish* && \
|
RUN cd python-redfish* && \
|
||||||
pip install -r requirements.txt && \
|
pip install -r requirements.txt && \
|
||||||
python setup.py install
|
python setup.py install
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
FROM fedora:23
|
FROM fedora:23
|
||||||
RUN dnf install -y python-pip && \
|
RUN dnf install -y python-pip && \
|
||||||
dnf install -y git && \
|
|
||||||
dnf install -y tar
|
dnf install -y tar
|
||||||
COPY python-redfish.src.tar.gz /python-redfish.src.tar.gz
|
COPY python-redfish.src.tar.gz /python-redfish.src.tar.gz
|
||||||
RUN mkdir /var/log/python-redfish
|
RUN mkdir /var/log/python-redfish
|
||||||
|
11
redfish-client/tests/Dockerfile.fedorap3
Normal file
11
redfish-client/tests/Dockerfile.fedorap3
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
FROM fedora:23
|
||||||
|
RUN dnf install -y python3-pip && \
|
||||||
|
dnf install -y tar
|
||||||
|
COPY python-redfish.src.tar.gz /python-redfish.src.tar.gz
|
||||||
|
RUN mkdir /var/log/python-redfish
|
||||||
|
RUN tar xvvf python-redfish.src.tar.gz
|
||||||
|
RUN cd python-redfish* && \
|
||||||
|
pip3 install -r requirements.txt && \
|
||||||
|
python3 setup.py install
|
||||||
|
CMD ["/bin/bash"]
|
||||||
|
|
@ -1,6 +1,5 @@
|
|||||||
FROM fedora:23
|
FROM fedora:23
|
||||||
RUN dnf install -y python-pip && \
|
RUN dnf install -y python-pip
|
||||||
dnf install -y git
|
|
||||||
RUN mkdir /var/log/python-redfish
|
RUN mkdir /var/log/python-redfish
|
||||||
RUN pip install python-redfish
|
RUN pip install python-redfish
|
||||||
CMD ["/bin/bash"]
|
CMD ["/bin/bash"]
|
||||||
|
@ -6,6 +6,9 @@ apt-get install -y python-pip
|
|||||||
COPY python-redfish.src.tar.gz /python-redfish.src.tar.gz
|
COPY python-redfish.src.tar.gz /python-redfish.src.tar.gz
|
||||||
RUN mkdir /var/log/python-redfish
|
RUN mkdir /var/log/python-redfish
|
||||||
RUN tar xvvf python-redfish.src.tar.gz
|
RUN tar xvvf python-redfish.src.tar.gz
|
||||||
|
# Need a really recent version of setuptools to support
|
||||||
|
# configparser>=3.3.0; python_version < '3' in requirements.txt
|
||||||
|
RUN pip install --upgrade setuptools
|
||||||
RUN cd python-redfish* && \
|
RUN cd python-redfish* && \
|
||||||
pip install -r requirements.txt && \
|
pip install -r requirements.txt && \
|
||||||
python setup.py install
|
python setup.py install
|
||||||
|
@ -37,7 +37,7 @@ class DockerTest(object):
|
|||||||
self.cli.wait(container=container.get('Id'))
|
self.cli.wait(container=container.get('Id'))
|
||||||
response = self.cli.logs(container=container.get('Id'),
|
response = self.cli.logs(container=container.get('Id'),
|
||||||
stdout=True)
|
stdout=True)
|
||||||
return(response)
|
return(response.decode('utf8'))
|
||||||
|
|
||||||
|
|
||||||
def test_dockersocket():
|
def test_dockersocket():
|
||||||
@ -56,7 +56,7 @@ def test_docker():
|
|||||||
|
|
||||||
def test_sources():
|
def test_sources():
|
||||||
output = subprocess.check_output(["python", "setup.py", "sdist"])
|
output = subprocess.check_output(["python", "setup.py", "sdist"])
|
||||||
search = re.search(r"removing '(\S+)'", output)
|
search = re.search(r"removing '(\S+)'", str(output))
|
||||||
filename = Path('dist/' + search.group(1) + '.tar.gz')
|
filename = Path('dist/' + search.group(1) + '.tar.gz')
|
||||||
filename.copy('redfish-client/tests/python-redfish.src.tar.gz')
|
filename.copy('redfish-client/tests/python-redfish.src.tar.gz')
|
||||||
assert Path('redfish-client/tests/python-redfish.src.tar.gz').isfile()
|
assert Path('redfish-client/tests/python-redfish.src.tar.gz').isfile()
|
||||||
@ -64,20 +64,23 @@ def test_sources():
|
|||||||
|
|
||||||
def test_dockerbuild():
|
def test_dockerbuild():
|
||||||
docker = DockerTest()
|
docker = DockerTest()
|
||||||
|
# Warning : Image tag is derived from file name, do not use uppercase !!!
|
||||||
dockerfiles = ('redfish-client/tests/Dockerfile.ubuntu',
|
dockerfiles = ('redfish-client/tests/Dockerfile.ubuntu',
|
||||||
'redfish-client/tests/Dockerfile.debian',
|
'redfish-client/tests/Dockerfile.debian',
|
||||||
'redfish-client/tests/Dockerfile.fedora',
|
'redfish-client/tests/Dockerfile.fedora',
|
||||||
|
'redfish-client/tests/Dockerfile.fedorap3',
|
||||||
'redfish-client/tests/Dockerfile.fedorapip')
|
'redfish-client/tests/Dockerfile.fedorapip')
|
||||||
for dockerfile in dockerfiles:
|
for dockerfile in dockerfiles:
|
||||||
print('Testing : {}'.format(dockerfile))
|
print('Testing : {}'.format(dockerfile))
|
||||||
response = docker.build(dockerfile)
|
response = docker.build(dockerfile)
|
||||||
status = response.pop()
|
status = str(response.pop())
|
||||||
assert 'Successfully built' in status
|
assert 'Successfully built' in status
|
||||||
|
|
||||||
|
|
||||||
def test_install():
|
def test_install():
|
||||||
docker = DockerTest()
|
docker = DockerTest()
|
||||||
images = ('rfubuntu', 'rfdebian', 'rffedora', 'rffedorapip')
|
images = ('rfubuntu', 'rfdebian',
|
||||||
|
'rffedora', 'rffedorap3', 'rffedorapip')
|
||||||
for img in images:
|
for img in images:
|
||||||
print('Testing : {}'.format(img))
|
print('Testing : {}'.format(img))
|
||||||
response = docker.run(img, 'redfish-client config showall')
|
response = docker.run(img, 'redfish-client config showall')
|
||||||
@ -87,10 +90,11 @@ def test_install():
|
|||||||
|
|
||||||
def test_versionformat():
|
def test_versionformat():
|
||||||
docker = DockerTest()
|
docker = DockerTest()
|
||||||
images = ('rfubuntu', 'rfdebian', 'rffedora', 'rffedorapip')
|
images = ('rfubuntu', 'rfdebian',
|
||||||
|
'rffedora', 'rffedorap3', 'rffedorapip')
|
||||||
for img in images:
|
for img in images:
|
||||||
print('Testing : {}'.format(img))
|
print('Testing : {}'.format(img))
|
||||||
response = docker.run(img, 'redfish-client --version')
|
response = docker.run(img, 'redfish-client --version')
|
||||||
print(response)
|
print(response)
|
||||||
assert (re.match('redfish-client \d+\.\d+', response))
|
assert (re.match(r'redfish-client \d+\.\d+', response))
|
||||||
|
|
||||||
|
@ -25,7 +25,8 @@ from redfish.main import *
|
|||||||
try:
|
try:
|
||||||
__version__ = pbr.version.VersionInfo('redfish').release_string()
|
__version__ = pbr.version.VersionInfo('redfish').release_string()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if "Versioning for this project requires either an sdist tarball" in e.message:
|
if "Versioning for this project requires either an sdist tarball" \
|
||||||
|
in e.args[0]:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
Loading…
x
Reference in New Issue
Block a user