示例#1
0
文件: tests.py 项目: yodamaster/regal
 def test_combine_num(self):
     ab = BaseInfo(
         self.ver,
         self.combine_num
     )
     instance_combine_num = ab.grouping().result[0][1]
     self.assertEqual(len(instance_combine_num[1:-1][0]), self.combine_num)
示例#2
0
文件: tests.py 项目: yodamaster/regal
 def test_empty_info(self):
     ab = BaseInfo('', '', '')
     with self.assertRaises(AttributeError):
         ab.grouping()
示例#3
0
文件: tests.py 项目: yodamaster/regal
 def test_schedule_num(self):
     schedule_num = 2
     ab = BaseInfo(self.ver, self.combine_num, schedule_num)
     instance_combine_num = ab.grouping().result[0][1]
     self.assertEqual(len(instance_combine_num[0][0].split(',')), schedule_num)
示例#4
0
文件: tests.py 项目: yodamaster/regal
 def test_empty_info_version_host_isdict(self):
     ab = BaseInfo({}, '', '')
     self.assertIsNotNone(ab.grouping())
示例#5
0
文件: tests.py 项目: yodamaster/regal
 def test_info_errortype(self):
     ab = BaseInfo({}, '1', 'sds')
     self.assertIsNotNone(ab.grouping())
示例#6
0
@contact:QQ4113291000
@time:2018/5/4.下午2:03
'''

'''
灰度测试用
pip install regal
'''

from regal import BaseInfo

#combine 希望以每组多少台服务器作为一组,进行用户群B的分流
ab = BaseInfo(
    version_host={
        'version-1.0':'192.168.0.1,192.168.0.2,192.168.0.3,192.168.0.4',
        'version-2.0':'192.168.0.5,192.168.0.6,192.168.0.7,192.168.0.8',
    }
              ,combine=2,
              schedule=2)

# grouping() 进行分组
# smart_grouping = ab.grouping()
# grouping()方法还提供了priority_name参数,当需要在多版本发布的时候,设置优先级,指定你需要优先发布的'版本名'
smart_grouping = ab.grouping(priority_name='version-2.0')

print smart_grouping.result

for i in smart_grouping.iter_dict():
    print i

if __name__ == '__main__':
示例#7
0
文件: tests.py 项目: pythorn/regal
 def test_info_errortype(self):
     ab = BaseInfo({}, "1", "sds")
     self.assertIsNotNone(ab.grouping())
示例#8
0
 def test_schedule_num(self):
     schedule_num = 2
     ab = BaseInfo(self.ver, self.combine_num, schedule_num)
     instance_combine_num = ab.grouping().result[0][1]
     self.assertEqual(len(instance_combine_num[0][0].split(',')),
                      schedule_num)
示例#9
0
 def test_empty_info(self):
     ab = BaseInfo('', '', '')
     with self.assertRaises(AttributeError):
         ab.grouping()
示例#10
0
 def test_combine_num(self):
     ab = BaseInfo(self.ver, self.combine_num)
     instance_combine_num = ab.grouping().result[0][1]
     self.assertEqual(len(instance_combine_num[1:-1][0]), self.combine_num)
示例#11
0
 def test_info_errortype(self):
     ab = BaseInfo({}, '1', 'sds')
     self.assertIsNotNone(ab.grouping())
示例#12
0
 def test_empty_info_version_host_isdict(self):
     ab = BaseInfo({}, '', '')
     self.assertIsNotNone(ab.grouping())
示例#13
0
# coding: utf-8
# regal v1.0 example
from regal import BaseInfo

ab = BaseInfo(
    version_host={
        'test-app-1.0.0-SNAPSHOT-201512191829.war':
        '1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4,5.1.1.1,6.2.2.2,7.3.3.3,8.4.4.4'
    },
    combine=4,  # 每组四台
    schedule=3  # groupA组 分三台
)

cc = ab.grouping()
print cc.result
for i in cc.iter_dict():
    print i

# 多版本支持
ab = BaseInfo(
    version_host={
        'ver1': '1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4',
        'ver2': '1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4',
        'ver3': '1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4',
        'ver4': '1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4',
    },
    combine=3,
    # schedule=2   # groupA组 分三台
)

cc = ab.grouping(priority_name='ver2')  # priority_name 多版本的情况下可以作为优先级策略
示例#14
0
# coding: utf-8
# regal v1.0 example
from regal import BaseInfo


ab = BaseInfo(
    version_host={
        'test-app-1.0.0-SNAPSHOT-201512191829.war': '1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4,5.1.1.1,6.2.2.2,7.3.3.3,8.4.4.4'},
    combine=4,   # 每组四台
    schedule=3   # groupA组 分三台
)

cc = ab.grouping()
print cc.result
for i in cc.iter_dict():
    print i


# 多版本支持
ab = BaseInfo(
    version_host={'ver1': '1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4',
                  'ver2': '1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4',
                  'ver3': '1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4',
                  'ver4': '1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4',},
    combine=3,
    # schedule=2   # groupA组 分三台
)

cc = ab.grouping(priority_name='ver2')  # priority_name 多版本的情况下可以作为优先级策略
print cc.result
for i in cc.iter_dict():