mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-21 11:51:06 +00:00
Make generate_objects.py and rand_readwrite.py inside the package.
Handle dependencies properly. Now e.g. "./bootstrap && ./virtualenv/bin/s3tests-test-readwrite" should just work.
This commit is contained in:
parent
33b25c577e
commit
02a4c82dfa
8 changed files with 61 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -8,6 +8,7 @@
|
|||
*.pyc
|
||||
*.pyo
|
||||
|
||||
/*.egg-info
|
||||
/virtualenv
|
||||
|
||||
config.yml
|
||||
|
|
24
bootstrap
24
bootstrap
|
@ -1,4 +1,28 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
for package in python-pip python-virtualenv python-dev libevent-dev; do
|
||||
if [ "$(dpkg --status -- $package|sed -n 's/^Status: //p')" != "install ok installed" ]; then
|
||||
# add a space after old values
|
||||
missing="${missing:+$missing }$package"
|
||||
fi
|
||||
done
|
||||
if [ -n "$missing" ]; then
|
||||
echo "$0: missing required packages, please install them:" 1>&2
|
||||
echo "sudo apt-get install $missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
virtualenv --no-site-packages --distribute virtualenv
|
||||
|
||||
# avoid pip bugs
|
||||
./virtualenv/bin/pip install --upgrade pip
|
||||
|
||||
./virtualenv/bin/pip install -r requirements.txt
|
||||
|
||||
# forbid setuptools from using the network because it'll try to use
|
||||
# easy_install, and we really wanted pip; next line will fail if pip
|
||||
# requirements.txt does not match setup.py requirements -- sucky but
|
||||
# good enough for now
|
||||
./virtualenv/bin/python setup.py develop \
|
||||
--allow-hosts None
|
||||
|
|
|
@ -2,3 +2,5 @@ PyYAML
|
|||
nose >=1.0.0
|
||||
boto >=2.0b4
|
||||
bunch >=1.0.0
|
||||
# 0.14 switches to libev, that means bootstrap needs to change too
|
||||
gevent ==0.13.6
|
||||
|
|
10
generate_objects.py → s3tests/generate_objects.py
Executable file → Normal file
10
generate_objects.py → s3tests/generate_objects.py
Executable file → Normal file
|
@ -2,10 +2,10 @@
|
|||
|
||||
from boto.s3.key import Key
|
||||
from optparse import OptionParser
|
||||
import realistic
|
||||
from . import realistic
|
||||
import traceback
|
||||
import random
|
||||
import common
|
||||
from . import common
|
||||
import sys
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ def upload_objects(bucket, files, seed):
|
|||
return keys
|
||||
|
||||
|
||||
def main():
|
||||
def _main():
|
||||
'''To run the static content load test, make sure you've bootstrapped your
|
||||
test environment and set up your config.yml file, then run the following:
|
||||
S3TEST_CONF=config.yml virtualenv/bin/python generate_objects.py -O urls.txt --seed 1234
|
||||
|
@ -106,10 +106,10 @@ def main():
|
|||
print >> sys.stderr, 'done'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
common.setup()
|
||||
try:
|
||||
main()
|
||||
_main()
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
common.teardown()
|
3
rand_readwrite.py → s3tests/rand_readwrite.py
Executable file → Normal file
3
rand_readwrite.py → s3tests/rand_readwrite.py
Executable file → Normal file
|
@ -194,6 +194,3 @@ def main():
|
|||
# cleanup
|
||||
if options.cleanup:
|
||||
common.teardown()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
29
setup.py
Normal file
29
setup.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/python
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name='s3tests',
|
||||
version='0.0.1',
|
||||
packages=find_packages(),
|
||||
|
||||
author='Tommi Virtanen',
|
||||
author_email='tommi.virtanen@dreamhost.com',
|
||||
description='Unofficial Amazon AWS S3 compatibility tests',
|
||||
license='MIT',
|
||||
keywords='s3 web testing',
|
||||
|
||||
install_requires=[
|
||||
'boto >=2.0b4',
|
||||
'PyYAML',
|
||||
'bunch >=1.0.0',
|
||||
'gevent ==0.13.6',
|
||||
],
|
||||
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
's3tests-generate-objects = s3tests.generate_objects:main',
|
||||
's3tests-test-readwrite = s3tests.rand_readwrite:main',
|
||||
],
|
||||
},
|
||||
|
||||
)
|
Loading…
Reference in a new issue