From c173214e9c25409944144c9b4bd9892949a834ba Mon Sep 17 00:00:00 2001 From: Vu Tran Date: Wed, 9 Apr 2014 16:45:51 -0400 Subject: swift: add tests Introduce swift test package which contains all Swift unit tests. Swift unit tests can be run as: $ cd /usr/lib64/python2.7/site-packages/swift $ nosetests -v test Signed-off-by: Vu Tran --- .../recipes-devtools/python/python-swift/test.conf | 44 ++++++++++++++++++++++ .../recipes-devtools/python/python-swift_git.bb | 21 ++++++++++- 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 meta-openstack/recipes-devtools/python/python-swift/test.conf (limited to 'meta-openstack/recipes-devtools/python') diff --git a/meta-openstack/recipes-devtools/python/python-swift/test.conf b/meta-openstack/recipes-devtools/python/python-swift/test.conf new file mode 100644 index 0000000..12ee253 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-swift/test.conf @@ -0,0 +1,44 @@ +[func_test] +auth_version = 2 +auth_host = localhost +auth_port = 5000 +auth_ssl = no +auth_prefix = /v2.0/ + +# Primary functional test account (needs admin access to the account) +account = %ADMIN_TENANT_NAME% +username = %ADMIN_USER% +password = %ADMIN_PASSWORD% + +# User on a second account (needs admin access to the account) +account2 = %SERVICE_TENANT_NAME% +username2 = %SERVICE_USER% +password2 = %SERVICE_PASSWORD% + +# User on same account as first, but without admin access +username3 = %DEMO_USER% +password3 = %DEMO_PASSWORD% + +# Default constraints if not defined here, the test runner will try +# to set them from /etc/swift/swift.conf. If that file isn't found, +# the test runner will skip tests that depend on these values. +# Note that the cluster must have "sane" values for the test suite to pass. +max_file_size = 5242880 +max_meta_name_length = 128 +max_meta_value_length = 256 +max_meta_count = 90 +max_meta_overall_size = 4096 +max_object_name_length = 1024 +container_listing_limit = 10000 +account_listing_limit = 10000 +max_account_name_length = 256 +max_container_name_length = 256 + +collate = C + +[unit_test] +fake_syslog = False + +[probe_test] +# check_server_timeout = 30 +# validate_rsync = false diff --git a/meta-openstack/recipes-devtools/python/python-swift_git.bb b/meta-openstack/recipes-devtools/python/python-swift_git.bb index d3419c5..6ab147d 100644 --- a/meta-openstack/recipes-devtools/python/python-swift_git.bb +++ b/meta-openstack/recipes-devtools/python/python-swift_git.bb @@ -10,13 +10,14 @@ SRCNAME = "swift" SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/havana \ file://proxy-server.conf \ file://dispersion.conf \ + file://test.conf \ " SRCREV="2f3526c559fe53ce904b735a81dee6de46127176" PV="2013.2.2+git${SRCPV}" S = "${WORKDIR}/git" -inherit setuptools hosts identity +inherit setuptools python-dir hosts identity do_install_append() { SWIFT_CONF_DIR=${D}${sysconfdir}/swift @@ -29,6 +30,7 @@ do_install_append() { install -m 600 ${S}/etc/container-server.conf-sample ${SWIFT_CONF_DIR}/container-server.conf install -m 600 ${S}/etc/object-server.conf-sample ${SWIFT_CONF_DIR}/object-server.conf install -m 600 ${WORKDIR}/dispersion.conf ${SWIFT_CONF_DIR}/dispersion.conf + install -m 600 ${WORKDIR}/test.conf ${SWIFT_CONF_DIR}/test.conf sed 's/^# bind_port =.*/bind_port = 6002/' -i ${SWIFT_CONF_DIR}/account-server.conf sed 's/^# user =.*/user = root/' -i ${SWIFT_CONF_DIR}/account-server.conf @@ -55,13 +57,28 @@ do_install_append() { sed "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${SWIFT_CONF_DIR}/dispersion.conf sed "s/%SERVICE_USER%/${SRCNAME}/g" -i ${SWIFT_CONF_DIR}/dispersion.conf sed "s/%SERVICE_PASSWORD%/${SERVICE_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/dispersion.conf + + sed "s/%ADMIN_TENANT_NAME%/admin/g" -i ${SWIFT_CONF_DIR}/test.conf + sed "s/%ADMIN_USER%/admin/g" -i ${SWIFT_CONF_DIR}/test.conf + sed "s/%ADMIN_PASSWORD%/${ADMIN_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/test.conf + sed "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${SWIFT_CONF_DIR}/test.conf + sed "s/%SERVICE_USER%/${SRCNAME}/g" -i ${SWIFT_CONF_DIR}/test.conf + sed "s/%SERVICE_PASSWORD%/${SERVICE_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/test.conf + sed "s/%DEMO_USER%/demo/g" -i ${SWIFT_CONF_DIR}/test.conf + sed "s/%DEMO_PASSWORD%/${ADMIN_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/test.conf + + cp -r test ${D}/${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/ + grep -rl '^from test' ${D}/${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/test | xargs sed 's/^from test/from swift\.test/g' -i } -PACKAGES += "${SRCNAME}" +PACKAGES += "${SRCNAME}-tests ${SRCNAME}" FILES_${PN} = "${libdir}/*\ " +FILES_${SRCNAME}-tests = "${sysconfdir}/${SRCNAME}/test.conf \ +" + FILES_${SRCNAME} = "${bindir}/* \ ${sysconfdir}/${SRCNAME}/* \ " -- cgit v1.2.3-54-g00ecf