-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
81 lines (72 loc) · 1.65 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/python
import requests
import json
def check(osver,pkgs):
url = 'http://127.0.0.1:5000'
head= {"Accept":"applicaiton/json",
"Content-type": "application/json"}
res = {"osver":osver,"packages":pkgs}
data = json.dumps(res)
print data
ret = requests.put(url, headers=head, data=data)
assert(ret.status_code == 200)
return json.loads(ret.text)
osver = "alpine:v3.6"
pkgs = {
'musl':'1.1.16-r9',
'expat':'2.2.0-r0',
'busybox':'1.26.2-r5',
}
print ("======================%s===================" % (osver,))
r = check(osver, pkgs)
r1 = len(r['result'])
print r1
osver = "alpine:v3.6"
pkgs = {
'musl':'',
'expat':'',
'busybox':'',
}
print ("======================%s===================" % (osver,))
r = check(osver, pkgs)
r2 = len(r['result'])
print r2
assert(r1 <= r2)
osver = "ubuntu:16.04"
pkgs = {
'systemd':'229-4ubuntu17',
'rsync':'3.1.1-3ubuntu1',
}
print ("======================%s===================" % (osver,))
r = check(osver, pkgs)
print len(r['result'])
osver ="centos:7"
pkgs = {
'glibc':'2.17-157.el7_3.2',
'glibc-common':'2.17-157.el7_3.2',
}
print ("======================%s===================" % (osver,))
r = check(osver, pkgs)
print len(r['result'])
osver="debian:8"
pkgs = {
'libx11':'1.6.2-3',
'libxml2':'2.9.1+dfsg1-5+deb8u4',
'wget':'1.16-1',
}
print ("======================%s===================" % (osver,))
r = check(osver, pkgs)
r1 = len(r['result'])
print r1
# Ask Dummy version
osver="debian:8"
pkgs = {
'libx11':'',
'libxml2':'',
'wget':'',
}
print ("======================%s===================" % (osver,))
r = check(osver, pkgs)
r2 = len(r['result'])
print r2
assert (r1 <= r2)