Run all tests for versioned packages
This commit is contained in:
parent
505ba2fc42
commit
8bbcfca8a0
|
@ -159,7 +159,11 @@ set(mv_packaging_dir ${PROJECT_SOURCE_DIR}/packaging/multiversion)
|
|||
math(EXPR ALTERNATIVES_PRIORITY "(${PROJECT_VERSION_MAJOR} * 1000) + (${PROJECT_VERSION_MINOR} * 100) + ${PROJECT_VERSION_PATCH}")
|
||||
set(script_dir "${PROJECT_BINARY_DIR}/packaging/multiversion/")
|
||||
file(MAKE_DIRECTORY "${script_dir}/server" "${script_dir}/clients")
|
||||
configure_file("${mv_packaging_dir}/server/postinst" "${script_dir}/server" @ONLY)
|
||||
|
||||
# Needs to to be named postinst for debian
|
||||
configure_file("${mv_packaging_dir}/server/postinst-deb" "${script_dir}/server/postinst" @ONLY)
|
||||
|
||||
configure_file("${mv_packaging_dir}/server/postinst-rpm" "${script_dir}/server" @ONLY)
|
||||
configure_file("${mv_packaging_dir}/server/prerm" "${script_dir}/server" @ONLY)
|
||||
set(LIB_DIR lib)
|
||||
configure_file("${mv_packaging_dir}/clients/postinst" "${script_dir}/clients" @ONLY)
|
||||
|
@ -210,6 +214,8 @@ set(CPACK_COMPONENT_SERVER-EL7_DEPENDS clients-el7)
|
|||
set(CPACK_COMPONENT_SERVER-DEB_DEPENDS clients-deb)
|
||||
set(CPACK_COMPONENT_SERVER-TGZ_DEPENDS clients-tgz)
|
||||
set(CPACK_COMPONENT_SERVER-VERSIONED_DEPENDS clients-versioned)
|
||||
set(CPACK_RPM_SERVER-VERSIONED_PACKAGE_REQUIRES
|
||||
"foundationdb-clients-${FDB_MAJOR}.${FDB_MINOR}.${FDB_PATCH} = ${FDB_MAJOR}.${FDB_MINOR}.${FDB_PATCH}")
|
||||
|
||||
set(CPACK_COMPONENT_SERVER-EL7_DISPLAY_NAME "foundationdb-server")
|
||||
set(CPACK_COMPONENT_SERVER-DEB_DISPLAY_NAME "foundationdb-server")
|
||||
|
@ -323,7 +329,7 @@ set(CPACK_RPM_SERVER-EL7_PACKAGE_REQUIRES
|
|||
"foundationdb-clients = ${FDB_MAJOR}.${FDB_MINOR}.${FDB_PATCH}")
|
||||
|
||||
set(CPACK_RPM_SERVER-VERSIONED_POST_INSTALL_SCRIPT_FILE
|
||||
${CMAKE_BINARY_DIR}/packaging/multiversion/server/postinst)
|
||||
${CMAKE_BINARY_DIR}/packaging/multiversion/server/postinst-rpm)
|
||||
|
||||
set(CPACK_RPM_SERVER-VERSIONED_PRE_UNINSTALL_SCRIPT_FILE
|
||||
${CMAKE_BINARY_DIR}/packaging/multiversion/server/prerm)
|
||||
|
|
|
@ -169,16 +169,12 @@ def centos_image_with_fdb_versioned() -> Iterator[Optional[Image]]:
|
|||
|
||||
def pytest_generate_tests(metafunc):
|
||||
if "linux_container" in metafunc.fixturenames:
|
||||
metafunc.parametrize("linux_container", ["ubuntu", "centos"], indirect=True)
|
||||
elif "linux_container_versioned" in metafunc.fixturenames:
|
||||
metafunc.parametrize(
|
||||
"linux_container_versioned", ["ubuntu", "centos"], indirect=True
|
||||
)
|
||||
metafunc.parametrize("linux_container", ["ubuntu", "centos", "ubuntu-versioned", "centos-versioned"], indirect=True)
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def linux_container(
|
||||
request, ubuntu_image_with_fdb, centos_image_with_fdb
|
||||
request, ubuntu_image_with_fdb, centos_image_with_fdb, ubuntu_image_with_fdb_versioned, centos_image_with_fdb_versioned
|
||||
) -> Iterator[Container]:
|
||||
"""
|
||||
Tests which accept this fixture will be run once for each supported platform.
|
||||
|
@ -190,39 +186,22 @@ def linux_container(
|
|||
pytest.skip("No debian packages available to test")
|
||||
container = Container(ubuntu_image_with_fdb)
|
||||
container.run(
|
||||
["service", "foundationdb", "start"]
|
||||
["/etc/init.d/foundationdb", "start"]
|
||||
) # outside docker this shouldn't be necessary
|
||||
elif request.param == "centos":
|
||||
if centos_image_with_fdb is None:
|
||||
pytest.skip("No rpm packages available to test")
|
||||
container = Container(centos_image_with_fdb, initd=True)
|
||||
else:
|
||||
assert False
|
||||
yield container
|
||||
finally:
|
||||
if container is not None:
|
||||
container.dispose()
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def linux_container_versioned(
|
||||
request, ubuntu_image_with_fdb_versioned, centos_image_with_fdb_versioned
|
||||
) -> Iterator[Container]:
|
||||
"""
|
||||
Tests which accept this fixture will be run once for each supported platform.
|
||||
"""
|
||||
container: Optional[Container] = None
|
||||
try:
|
||||
if request.param == "ubuntu":
|
||||
if ubuntu_image_with_fdb_versioned is None:
|
||||
pytest.skip("No debian packages available to test")
|
||||
elif request.param == "ubuntu-versioned":
|
||||
if ubuntu_image_with_fdb is None:
|
||||
pytest.skip("No versioned debian packages available to test")
|
||||
container = Container(ubuntu_image_with_fdb_versioned)
|
||||
container.run(
|
||||
["service", "foundationdb", "start"]
|
||||
["/etc/init.d/foundationdb", "start"]
|
||||
) # outside docker this shouldn't be necessary
|
||||
elif request.param == "centos":
|
||||
if centos_image_with_fdb_versioned is None:
|
||||
pytest.skip("No rpm packages available to test")
|
||||
elif request.param == "centos-versioned":
|
||||
if centos_image_with_fdb is None:
|
||||
pytest.skip("No versioned rpm packages available to test")
|
||||
container = Container(centos_image_with_fdb_versioned, initd=True)
|
||||
else:
|
||||
assert False
|
||||
|
@ -239,10 +218,6 @@ def test_db_available(linux_container: Container):
|
|||
linux_container.run(["fdbcli", "--exec", "get x"])
|
||||
|
||||
|
||||
def test_versioned_package(linux_container_versioned: Container):
|
||||
linux_container_versioned.run(["fdbcli", "--exec", "get x"])
|
||||
|
||||
|
||||
def test_write(linux_container: Container, snapshot):
|
||||
linux_container.run(["fdbcli", "--exec", "writemode on; set x y"])
|
||||
assert snapshot == linux_container.run(["fdbcli", "--exec", "get x"])
|
||||
|
|
|
@ -15,6 +15,8 @@ fi
|
|||
getent group foundationdb >/dev/null || addgroup --system foundationdb
|
||||
getent passwd foundationdb >/dev/null || adduser --system --disabled-login --ingroup foundationdb --no-create-home --home /var/lib/foundationdb --gecos "FoundationDB" --shell /bin/false foundationdb
|
||||
|
||||
mkdir -p /usr/@LIB_DIR@/foundationdb/backup_agent
|
||||
|
||||
update-alternatives --install /usr/bin/fdbcli fdbclients /usr/lib/foundationdb-@PROJECT_VERSION@/bin/fdbcli @ALTERNATIVES_PRIORITY@ \
|
||||
--slave /usr/bin/fdbbackup fdbbackup /usr/lib/foundationdb-@PROJECT_VERSION@/bin/fdbbackup \
|
||||
--slave /usr/bin/fdbrestore fdbrestore /usr/lib/foundationdb-@PROJECT_VERSION@/bin/fdbbackup \
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
getent group foundationdb >/dev/null || groupadd -r foundationdb >/dev/null
|
||||
getent passwd foundationdb >/dev/null || useradd -c "FoundationDB" -g foundationdb -s /bin/false -r -d /var/lib/foundationdb foundationdb >/dev/null
|
||||
|
||||
mkdir -p /var/lib/foundationdb/data /var/log/foundationdb
|
||||
chown -R foundationdb:foundationdb /var/lib/foundationdb /var/log/foundationdb
|
||||
chmod -R 0700 /var/lib/foundationdb/data /var/log/foundationdb
|
||||
|
||||
mkdir -p /usr/lib/foundationdb
|
||||
update-alternatives --install /usr/sbin/fdbserver fdbserver /usr/lib/foundationdb-@PROJECT_VERSION@/sbin/fdbserver @ALTERNATIVES_PRIORITY@ \
|
||||
--slave /usr/lib/foundationdb/fdbmonitor fdbmonitor /usr/lib/foundationdb-@PROJECT_VERSION@/sbin/fdbmonitor \
|
||||
--slave /lib/systemd/system/foundationdb.service foundationdb.service /usr/lib/foundationdb-@PROJECT_VERSION@/lib/systemd/system/foundationdb.service
|
||||
|
||||
if mkdir /etc/foundationdb
|
||||
then
|
||||
description=`LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c 8`
|
||||
random_str=`LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c 8`
|
||||
echo $description:$random_str@127.0.0.1:4500 > /etc/foundationdb/fdb.cluster
|
||||
cp /usr/lib/foundationdb-@PROJECT_VERSION@/etc/foundationdb/foundationdb.conf /etc/foundationdb/foundationdb.conf
|
||||
chown -R foundationdb:foundationdb /etc/foundationdb
|
||||
chmod 775 /etc/foundationdb
|
||||
chmod 0664 /etc/foundationdb/fdb.cluster
|
||||
/usr/bin/systemctl enable foundationdb >/dev/null 2>&1
|
||||
/usr/bin/systemctl start foundationdb >/dev/null 2>&1
|
||||
/usr/bin/fdbcli -C /etc/foundationdb/fdb.cluster --exec "configure new single memory; status" --timeout 20
|
||||
fi
|
Loading…
Reference in New Issue