Planet Ceph

Aggregated news from external sources

June 27, 2018

利用s3-test进行ceph的接口兼容性测试

s3

前言

ceph的rgw能够提供一个兼容性的s3的接口,既然是兼容性,当然不可能是所有接口都会兼容,那么我们需要有一个工具来进行接口的验证以及测试,这个在其他测试工具里面有类似的posix接口验证工具,这类的工具就是跑测试用例,来输出通过或者不通过的列表

用此类的工具有个好的地方就是,能够对接口进行验证,来避免版本的更新带来的接口破坏

安装

直接对官方的分支进行clone下来,总文件数不多,下载很快

[root@lab101 s3]# git clone https://github.com/ceph/s3-tests.git
[root@lab101 s3]# cd s3-tests/

这个地方注意下有版本之分,测试的时候需要用对应版本,这里我们测试的jewel版本就切换到jewel的分支(关键步骤)

[root@lab101 s3-tests]# git branch -a
[root@lab101 s3-tests]# git checkout -b jewel remotes/origin/ceph-jewel
[root@lab101 s3-tests]# ./bootstrap

进入到目录当中执行 ./bootstrap进行初始化相关的工作,这个是下载一些相关的库和软件包,并且创建了一个python的虚拟环境,如果从其他地方拷贝过来的代码最好是删除掉python虚拟环境,让程序自己去重新创建一套环境

执行完了以后就是创建测试配置文件test.conf

[DEFAULT]
## this section is just used as default for all the "s3 *"
## sections, you can place these variables also directly there

## replace with e.g. "localhost" to run against local software
host = 192.168.19.101

## uncomment the port to use something other than 80
port = 7481

## say "no" to disable TLS
is_secure = no

[fixtures]
## all the buckets created will start with this prefix;
## {random} will be filled with random characters to pad
## the prefix to 30 characters long, and avoid collisions
bucket prefix = cephtest-{random}-

[s3 main]
## the tests assume two accounts are defined, "main" and "alt".

## user_id is a 64-character hexstring
user_id = test1

## display name typically looks more like a unix login, "jdoe" etc
display_name = test1

## replace these with your access keys
access_key = test1
secret_key = test1

## replace with key id obtained when secret is created, or delete if KMS not tested
#kms_keyid = 01234567-89ab-cdef-0123-456789abcdef

[s3 alt]
## another user account, used for ACL-related tests
user_id = test2
display_name = test2
## the "alt" user needs to have email set, too
email = test2@qq.com
access_key = test2
secret_key = test2

上面的用户信息是需要提前创建好的,这个用集群内的机器radosgw-admin命令创建即可

radosgw-admin user create --uid=test01 --display-name=test01 --access-key=test01 --secret-key=test01 --email=test01@qq.com
radosgw-admin user create --uid=test02 --display-name=test02 --access-key=test02 --secret-key=test02 --email=test02@qq.com

创建好了以后就可以开始测试了

[root@lab101 s3-tests]# S3TEST_CONF=test.conf ./virtualenv/bin/nosetests -a '!fails_on_rgw'
..................................................SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.....................................................................................................................SSSS.......................................................................................................................................SSSS.......................................................
----------------------------------------------------------------------
Ran 408 tests in 122.087s

OK (SKIP=51)

正常测试完就应该是上面的ok的状态,也有可能某个版本的测试用例是写的支持,但是rgw也不一定就做好了,这个需要自己判断一下

总结

了解软件适配的接口,针对接口进行相关测试即可

变更记录

Why Who When
创建 武汉-运维-磨渣 2018-06-27

Source: zphj1987@gmail (利用s3-test进行ceph的接口兼容性测试)

Careers