OpenStack 构建单测环境

本文档介绍了如何在OpenStack环境中构建测试环境,并提供了执行单元测试的具体步骤。包括使用tox工具运行特定测试案例的方法,以及创建基础网络和外部网络的过程。

单元测试

构建测试环境

       sudo apt-get install build-essential libssl-dev libffi-dev python-dev libevent-dev

       http://ronaldbradford.com/blog/running-openstack-tests-with-tox-2015-04-28/?utm_source=tuicool&utm_medium=referral

       http://docs.openstack.org/developer/cinder/devref/development.environment.html

       http://superuser.openstack.org/articles/a-guide-to-testing-in-openstack/

执行单个测试项

1 .tox/py27/bin/python -m testtools.run  xxxxxx
2 
3 e.g =》  .tox/py27/bin/python -m testtools.run  neutron.tests.unit.agent.test_securitygroups_rpc.TestSecurityGroupAgentWithOVSIptables.test_prepare_remove_port

 

测试参考

        https://docs.openstack.org/developer/ceilometer/testing.html

       http://www.voidspace.org.uk/python/mock/getting-started.html

       http://www.oschina.net/translate/unit-testing-with-the-python-mock-class

 

创建基础网络

创建外部网络

1 neutron net-create ext-net --router:external=True --provider:network-type=flat --provider:physical-network=provider
2 neutron subnet-create ext-net --name ext-subnet --allocation-pool start=192.168.100.150,end=192.168.100.200 --disable-dhcp --gateway 192.168.100.2 192.168.100.0/24

转载于:https://www.cnblogs.com/gaozhengwei/p/7097383.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值