author | Brock Pytlik <brock.pytlik@oracle.com> |
Tue, 22 Mar 2011 15:01:13 -0700 | |
changeset 2272 | d81ea073d050 |
parent 2230 | 76f30e842e82 |
child 2310 | ce10607d5332 |
permissions | -rw-r--r-- |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1507
diff
changeset
|
1 |
#!/usr/bin/python |
581 | 2 |
# |
3 |
# CDDL HEADER START |
|
4 |
# |
|
5 |
# The contents of this file are subject to the terms of the |
|
6 |
# Common Development and Distribution License (the "License"). |
|
7 |
# You may not use this file except in compliance with the License. |
|
8 |
# |
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
10 |
# or http://www.opensolaris.org/os/licensing. |
|
11 |
# See the License for the specific language governing permissions |
|
12 |
# and limitations under the License. |
|
13 |
# |
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
|
19 |
# |
|
20 |
# CDDL HEADER END |
|
21 |
# |
|
22 |
||
1899
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
23 |
# |
2230
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
24 |
# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. |
1899
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
25 |
# |
581 | 26 |
|
27 |
import testutils |
|
28 |
if __name__ == "__main__": |
|
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
29 |
testutils.setup_environment("../../../proto") |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
30 |
import pkg5unittest |
581 | 31 |
|
742
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
32 |
import httplib |
581 | 33 |
import os |
34 |
import shutil |
|
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
35 |
import tempfile |
1020
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
36 |
import time |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
37 |
import unittest |
738
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
38 |
import urllib |
742
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
39 |
import urllib2 |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
40 |
import urlparse |
581 | 41 |
|
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
42 |
import pkg.client.publisher as publisher |
1507
b956ea23d3a6
11735 pkg history data files should not be executable
Richard Lowe <richlowe@richlowe.net>
parents:
1505
diff
changeset
|
43 |
import pkg.depotcontroller as dc |
b956ea23d3a6
11735 pkg history data files should not be executable
Richard Lowe <richlowe@richlowe.net>
parents:
1505
diff
changeset
|
44 |
import pkg.fmri as fmri |
b956ea23d3a6
11735 pkg history data files should not be executable
Richard Lowe <richlowe@richlowe.net>
parents:
1505
diff
changeset
|
45 |
import pkg.misc as misc |
1968
c0540b1e4f7e
8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents:
1937
diff
changeset
|
46 |
import pkg.server.repository as sr |
1507
b956ea23d3a6
11735 pkg history data files should not be executable
Richard Lowe <richlowe@richlowe.net>
parents:
1505
diff
changeset
|
47 |
import pkg.p5i as p5i |
581 | 48 |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
49 |
class TestPkgDepot(pkg5unittest.SingleDepotTestCase): |
581 | 50 |
# Only start/stop the depot once (instead of for every test) |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
51 |
persistent_setup = True |
581 | 52 |
|
1151
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
53 |
foo10 = """ |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
54 |
open [email protected],5.11-0 |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
55 |
add dir path=tmp/foo mode=0755 owner=root group=bin |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
56 |
close """ |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
57 |
|
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
58 |
bar10 = """ |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
59 |
open [email protected],5.11-0 |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
60 |
add dir path=tmp/bar mode=0755 owner=root group=bin |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
61 |
close """ |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
62 |
|
581 | 63 |
quux10 = """ |
64 |
open [email protected],5.11-0 |
|
65 |
add dir mode=0755 owner=root group=bin path=/bin |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
66 |
add file tmp/cat mode=0555 owner=root group=bin path=/bin/cat |
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
67 |
add file tmp/libc.so.1 mode=0555 owner=root group=bin path=/lib/libc.so.1 |
581 | 68 |
close """ |
69 |
||
689
1cb7154e1592
4489 depot traceback for info operation due to changeset 660
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
612
diff
changeset
|
70 |
info10 = """ |
1cb7154e1592
4489 depot traceback for info operation due to changeset 660
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
612
diff
changeset
|
71 |
open [email protected],5.11-0 |
1cb7154e1592
4489 depot traceback for info operation due to changeset 660
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
612
diff
changeset
|
72 |
close """ |
1cb7154e1592
4489 depot traceback for info operation due to changeset 660
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
612
diff
changeset
|
73 |
|
1025
fca418265023
8010 Depot fails to return 304 when no updates available
johansen <johansen@sun.com>
parents:
1020
diff
changeset
|
74 |
update10 = """ |
fca418265023
8010 Depot fails to return 304 when no updates available
johansen <johansen@sun.com>
parents:
1020
diff
changeset
|
75 |
open [email protected],5.11-0 |
fca418265023
8010 Depot fails to return 304 when no updates available
johansen <johansen@sun.com>
parents:
1020
diff
changeset
|
76 |
close """ |
fca418265023
8010 Depot fails to return 304 when no updates available
johansen <johansen@sun.com>
parents:
1020
diff
changeset
|
77 |
|
fca418265023
8010 Depot fails to return 304 when no updates available
johansen <johansen@sun.com>
parents:
1020
diff
changeset
|
78 |
update11 = """ |
fca418265023
8010 Depot fails to return 304 when no updates available
johansen <johansen@sun.com>
parents:
1020
diff
changeset
|
79 |
open [email protected],5.11-0 |
fca418265023
8010 Depot fails to return 304 when no updates available
johansen <johansen@sun.com>
parents:
1020
diff
changeset
|
80 |
close """ |
fca418265023
8010 Depot fails to return 304 when no updates available
johansen <johansen@sun.com>
parents:
1020
diff
changeset
|
81 |
|
738
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
82 |
system10 = """ |
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
83 |
open system/[email protected],5.11-0 |
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
84 |
add set name="description" value="Package to test package names with slashes" |
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
85 |
add dir path=tmp/foo mode=0755 owner=root group=bin |
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
86 |
add depend type=require fmri=pkg:/SUNWcsl |
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
87 |
close """ |
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
88 |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
89 |
misc_files = [ "tmp/libc.so.1", "tmp/cat" ] |
581 | 90 |
|
91 |
def setUp(self): |
|
1895
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1850
diff
changeset
|
92 |
# This suite, for obvious reasons, actually needs a depot. |
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1850
diff
changeset
|
93 |
pkg5unittest.SingleDepotTestCase.setUp(self, start_depot=True) |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
94 |
self.make_misc_files(self.misc_files) |
581 | 95 |
|
96 |
def test_depot_ping(self): |
|
97 |
""" Ping the depot several times """ |
|
98 |
||
99 |
self.assert_(self.dc.is_alive()) |
|
100 |
self.assert_(self.dc.is_alive()) |
|
101 |
self.assert_(self.dc.is_alive()) |
|
102 |
self.assert_(self.dc.is_alive()) |
|
103 |
||
104 |
def testStartStop(self): |
|
105 |
""" Start and stop the depot several times """ |
|
106 |
self.dc.stop() |
|
107 |
for i in range(0, 5): |
|
108 |
self.dc.start() |
|
109 |
self.assert_(self.dc.is_alive()) |
|
110 |
self.dc.stop() |
|
111 |
self.assert_(not self.dc.is_alive()) |
|
112 |
||
113 |
self.dc.start() |
|
114 |
||
115 |
def test_bug_1876(self): |
|
116 |
""" Send package [email protected] an action at a time, restarting the |
|
117 |
depot server after each one is sent, to ensure that |
|
118 |
transactions work across depot restart. Then verify that |
|
119 |
the package was successfully added by performing some |
|
120 |
basic operations. """ |
|
121 |
||
122 |
durl = self.dc.get_depot_url() |
|
123 |
||
124 |
for line in self.quux10.split("\n"): |
|
125 |
line = line.strip() |
|
126 |
if line == "": |
|
127 |
continue |
|
128 |
||
129 |
try: |
|
130 |
self.pkgsend(durl, line, exit = 0) |
|
131 |
except: |
|
132 |
self.pkgsend(durl, "close -A", exit = 0) |
|
133 |
raise |
|
134 |
||
135 |
if not line == "close": |
|
136 |
self.restart_depots() |
|
137 |
||
138 |
self.image_create(durl) |
|
139 |
||
140 |
self.pkg("list -a") |
|
141 |
self.pkg("list", exit=1) |
|
142 |
||
143 |
self.pkg("install quux") |
|
144 |
||
145 |
self.pkg("list") |
|
146 |
self.pkg("verify") |
|
147 |
||
148 |
self.pkg("uninstall quux") |
|
149 |
self.pkg("verify") |
|
150 |
||
151 |
def test_bad_fmris(self): |
|
152 |
durl = self.dc.get_depot_url() |
|
153 |
self.pkgsend(durl, "open foo@", exit=1) |
|
154 |
self.pkgsend(durl, "open [email protected]", exit=1) |
|
155 |
self.pkgsend(durl, "open [email protected],-2.0", exit=1) |
|
156 |
||
599
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
157 |
def test_bug_3365(self): |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
158 |
durl = self.dc.get_depot_url() |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
159 |
depotpath = self.dc.get_repodir() |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
160 |
|
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
161 |
dir_file = os.path.join(depotpath, "search.dir") |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
162 |
pag_file = os.path.join(depotpath, "search.pag") |
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
163 |
|
599
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
164 |
self.assert_(not os.path.exists(dir_file)) |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
165 |
self.assert_(not os.path.exists(pag_file)) |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
166 |
|
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
167 |
f = open(dir_file, "w") |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
168 |
f.close() |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
169 |
f = open(pag_file, "w") |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
170 |
f.close() |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
171 |
self.assert_(os.path.exists(dir_file)) |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
172 |
self.assert_(os.path.exists(pag_file)) |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
173 |
|
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
174 |
self.dc.stop() |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
175 |
self.dc.start() |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
176 |
self.pkgsend_bulk(durl, self.quux10) |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
177 |
self.assert_(not os.path.exists(dir_file)) |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
178 |
self.assert_(not os.path.exists(pag_file)) |
4643893d6502
3365 When search is upgraded it should remove old data
Brock Pytlik <bpytlik@sun.com>
parents:
581
diff
changeset
|
179 |
|
689
1cb7154e1592
4489 depot traceback for info operation due to changeset 660
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
612
diff
changeset
|
180 |
def test_bug_4489(self): |
1cb7154e1592
4489 depot traceback for info operation due to changeset 660
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
612
diff
changeset
|
181 |
"""Publish a package and then verify that the depot /info |
1cb7154e1592
4489 depot traceback for info operation due to changeset 660
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
612
diff
changeset
|
182 |
operation doesn't fail.""" |
1cb7154e1592
4489 depot traceback for info operation due to changeset 660
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
612
diff
changeset
|
183 |
depot_url = self.dc.get_depot_url() |
1cb7154e1592
4489 depot traceback for info operation due to changeset 660
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
612
diff
changeset
|
184 |
plist = self.pkgsend_bulk(depot_url, self.info10) |
1974
6af683c5bde5
9203 pkgrecv should check for valid destination before beginning download
johansen <johansen@opensolaris.org>
parents:
1968
diff
changeset
|
185 |
repourl = urlparse.urljoin(depot_url, "info/0/%s" % plist[0]) |
6af683c5bde5
9203 pkgrecv should check for valid destination before beginning download
johansen <johansen@opensolaris.org>
parents:
1968
diff
changeset
|
186 |
urllib2.urlopen(repourl) |
581 | 187 |
|
933
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
188 |
def test_bug_3739(self): |
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
189 |
"""Verify that a depot will return a 400 (Bad Request) error |
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
190 |
whenever it is provided malformed FMRIs.""" |
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
191 |
|
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
192 |
durl = self.dc.get_depot_url() |
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
193 |
|
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
194 |
for operation in ("info", "manifest"): |
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
195 |
for entry in ("BRCMbnx", "BRCMbnx%40a", |
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
196 |
"BRCMbnx%400.5.11%2C5.11-0.101%3A20081119T231649a"): |
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
197 |
try: |
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
198 |
urllib2.urlopen("%s/%s/0/%s" % (durl, |
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
199 |
operation, entry)) |
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
200 |
except urllib2.HTTPError, e: |
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
201 |
if e.code != httplib.BAD_REQUEST: |
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
202 |
raise |
601797170f72
3739 pkg.depotd traceback on malformed requests
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
873
diff
changeset
|
203 |
|
738
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
204 |
def test_bug_5366(self): |
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
205 |
"""Publish a package with slashes in the name, and then verify |
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
206 |
that the depot manifest and info operations work regardless of |
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
207 |
the encoding.""" |
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
208 |
depot_url = self.dc.get_depot_url() |
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
209 |
plist = self.pkgsend_bulk(depot_url, self.system10) |
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
210 |
# First, try it un-encoded. |
1974
6af683c5bde5
9203 pkgrecv should check for valid destination before beginning download
johansen <johansen@opensolaris.org>
parents:
1968
diff
changeset
|
211 |
repourl = urlparse.urljoin(depot_url, "info/0/%s" % plist[0]) |
6af683c5bde5
9203 pkgrecv should check for valid destination before beginning download
johansen <johansen@opensolaris.org>
parents:
1968
diff
changeset
|
212 |
urllib2.urlopen(repourl) |
6af683c5bde5
9203 pkgrecv should check for valid destination before beginning download
johansen <johansen@opensolaris.org>
parents:
1968
diff
changeset
|
213 |
repourl = urlparse.urljoin(depot_url, "manifest/0/%s" % |
6af683c5bde5
9203 pkgrecv should check for valid destination before beginning download
johansen <johansen@opensolaris.org>
parents:
1968
diff
changeset
|
214 |
plist[0]) |
6af683c5bde5
9203 pkgrecv should check for valid destination before beginning download
johansen <johansen@opensolaris.org>
parents:
1968
diff
changeset
|
215 |
urllib2.urlopen(repourl) |
738
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
216 |
# Second, try it encoded. |
1974
6af683c5bde5
9203 pkgrecv should check for valid destination before beginning download
johansen <johansen@opensolaris.org>
parents:
1968
diff
changeset
|
217 |
repourl = urlparse.urljoin(depot_url, "info/0/%s" % |
738
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
218 |
urllib.quote(plist[0])) |
1974
6af683c5bde5
9203 pkgrecv should check for valid destination before beginning download
johansen <johansen@opensolaris.org>
parents:
1968
diff
changeset
|
219 |
urllib2.urlopen(repourl) |
6af683c5bde5
9203 pkgrecv should check for valid destination before beginning download
johansen <johansen@opensolaris.org>
parents:
1968
diff
changeset
|
220 |
repourl = urlparse.urljoin(depot_url, "manifest/0/%s" % |
738
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
221 |
urllib.quote(plist[0])) |
1974
6af683c5bde5
9203 pkgrecv should check for valid destination before beginning download
johansen <johansen@opensolaris.org>
parents:
1968
diff
changeset
|
222 |
urllib2.urlopen(repourl) |
738
2a3ba8f94ec3
5366 depot should allow manifest and info requests with un-encoded or encoded slashes
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
689
diff
changeset
|
223 |
|
1151
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
224 |
def test_bug_5707(self): |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
225 |
"""Testing depotcontroller.refresh().""" |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
226 |
|
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
227 |
depot_url = self.dc.get_depot_url() |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
228 |
self.pkgsend_bulk(depot_url, self.foo10) |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
229 |
|
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
230 |
self.image_create(depot_url) |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
231 |
self.pkg("install foo") |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
232 |
self.pkg("verify") |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
233 |
|
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
234 |
depot_file_url = "file://%s" % self.dc.get_repodir() |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
235 |
self.pkgsend_bulk(depot_url, self.bar10) |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
236 |
self.pkg("refresh") |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
237 |
|
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
238 |
self.pkg("install bar") |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
239 |
self.pkg("verify") |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
240 |
|
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
241 |
self.dc.refresh() |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
242 |
self.pkg("refresh") |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
243 |
|
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1431
diff
changeset
|
244 |
self.pkg("install bar", exit=4) # nothing to do |
1151
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
245 |
self.pkg("verify") |
ad15996ecf64
5707 depot should support SIGHUP to refresh configuration
Rich Burridge <rich.burridge@sun.com>
parents:
1117
diff
changeset
|
246 |
|
742
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
247 |
def test_face_root(self): |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
248 |
"""Verify that files outside of the package content web root |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
249 |
cannot be accessed, and that files inside can be.""" |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
250 |
depot_url = self.dc.get_depot_url() |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
251 |
# Since /usr/share/lib/pkg/web/ is the content web root, |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
252 |
# any attempts to go outside that directory should fail |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
253 |
# with a 404 error. |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
254 |
try: |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
255 |
urllib2.urlopen("%s/../../../../bin/pkg" % depot_url) |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
256 |
except urllib2.HTTPError, e: |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
257 |
if e.code != httplib.NOT_FOUND: |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
258 |
raise |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
259 |
|
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
260 |
f = urllib2.urlopen("%s/robots.txt" % depot_url) |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
261 |
self.assert_(len(f.read())) |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
262 |
f.close() |
909b912fa942
3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
738
diff
changeset
|
263 |
|
873
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
264 |
def test_repo_create(self): |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
265 |
"""Verify that starting a depot server in readonly mode with |
1672
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
266 |
a non-existent or empty repo_dir fails and that permissions |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
267 |
errors are handled correctly during creation. Then verify |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
268 |
that starting a depot with the same directory in publishing |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
269 |
mode works and then a readonly depot again after that works. |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
270 |
""" |
873
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
271 |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
272 |
dpath = os.path.join(self.test_root, "repo_create") |
873
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
273 |
|
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
274 |
opath = self.dc.get_repodir() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
275 |
self.dc.set_repodir(dpath) |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
276 |
|
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
277 |
# First, test readonly mode with a repo_dir that doesn't exist. |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
278 |
self.dc.set_readonly() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
279 |
self.dc.stop() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
280 |
self.dc.start_expected_fail() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
281 |
self.assert_(not self.dc.is_alive()) |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
282 |
|
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
283 |
# Next, test readonly mode with a repo_dir that is empty. |
1507
b956ea23d3a6
11735 pkg history data files should not be executable
Richard Lowe <richlowe@richlowe.net>
parents:
1505
diff
changeset
|
284 |
os.makedirs(dpath, misc.PKG_DIR_MODE) |
873
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
285 |
self.dc.set_readonly() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
286 |
self.dc.start_expected_fail() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
287 |
self.assert_(not self.dc.is_alive()) |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
288 |
|
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
289 |
# Next, test readwrite (publishing) mode with a non-existent |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
290 |
# repo_dir. |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
291 |
shutil.rmtree(dpath) |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
292 |
self.dc.set_readwrite() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
293 |
self.dc.start() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
294 |
self.assert_(self.dc.is_alive()) |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
295 |
self.dc.stop() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
296 |
self.assert_(not self.dc.is_alive()) |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
297 |
|
1672
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
298 |
# Next, test readwrite (publishing) mode with a non-existent |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
299 |
# repo_dir for an unprivileged user. |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
300 |
shutil.rmtree(dpath) |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
301 |
self.dc.set_readwrite() |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
302 |
wr_start, wr_end = self.dc.get_wrapper() |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
303 |
su_wrap, su_end = self.get_su_wrapper(su_wrap=True) |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
304 |
try: |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
305 |
self.dc.set_wrapper([su_wrap], su_end) |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
306 |
self.dc.start_expected_fail(exit=1) |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
307 |
finally: |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
308 |
# Even if this test fails, this wrapper must be reset. |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
309 |
self.dc.set_wrapper(wr_start, wr_end) |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
310 |
self.assert_(not self.dc.is_alive()) |
3a71439a03f3
13021 file manager exceptions should be api exceptions
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
311 |
|
873
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
312 |
# Next, test readwrite (publishing) mode with an empty repo_dir. |
1507
b956ea23d3a6
11735 pkg history data files should not be executable
Richard Lowe <richlowe@richlowe.net>
parents:
1505
diff
changeset
|
313 |
os.makedirs(dpath, misc.PKG_DIR_MODE) |
873
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
314 |
self.dc.set_readwrite() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
315 |
self.dc.start() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
316 |
self.assert_(self.dc.is_alive()) |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
317 |
self.dc.stop() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
318 |
self.assert_(not self.dc.is_alive()) |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
319 |
|
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
320 |
# Finally, re-test readonly mode now that the repository has |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
321 |
# been created. |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
322 |
self.dc.set_readonly() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
323 |
self.dc.start() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
324 |
self.assert_(self.dc.is_alive()) |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
325 |
self.dc.stop() |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
326 |
self.assert_(not self.dc.is_alive()) |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
327 |
|
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
328 |
# Cleanup. |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
329 |
shutil.rmtree(dpath) |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
330 |
self.dc.set_repodir(opath) |
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
331 |
|
1902
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
332 |
def test_repo_file_only(self): |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
333 |
"""Test that if a depot is created with only --file-root |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
334 |
supplied, it comes up in mirror mode, with only file content |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
335 |
available.""" |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
336 |
|
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
337 |
if self.dc.is_alive(): |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
338 |
self.dc.stop() |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
339 |
|
2073
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
2065
diff
changeset
|
340 |
fpath = os.path.join(self.test_root, "var/pkg/download") |
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
2065
diff
changeset
|
341 |
os.makedirs(fpath, misc.PKG_DIR_MODE) |
1902
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
342 |
opath = self.dc.get_repodir() |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
343 |
self.dc.set_repodir(None) |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
344 |
self.dc.set_file_root(fpath) |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
345 |
self.dc.set_readwrite() |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
346 |
self.dc.start() |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
347 |
self.assert_(self.dc.is_alive()) |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
348 |
|
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
349 |
durl = self.dc.get_depot_url() |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
350 |
verdata = urllib2.urlopen("%s/versions/0/" % durl) |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
351 |
verlines = verdata.readlines() |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
352 |
verdict = dict( |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
353 |
s.split(None, 1) |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
354 |
for s in (l.strip() for l in verlines) |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
355 |
) |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
356 |
|
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
357 |
self.assert_("file" in verdict) |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
358 |
self.assert_("catalog" not in verdict) |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
359 |
self.assert_("manifest" not in verdict) |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
360 |
|
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
361 |
self.dc.stop() |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
362 |
self.dc.set_repodir(opath) |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
363 |
self.dc.set_file_root(None) |
59b7214232cb
6957 mDNS support for depot
johansen <johansen@opensolaris.org>
parents:
1899
diff
changeset
|
364 |
|
1937
be8995c7bb8f
10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents:
1902
diff
changeset
|
365 |
|
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
366 |
def test_append_reopen(self): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
367 |
"""Test that if a depot has a partially finished append |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
368 |
transaction, that it reopens it correctly.""" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
369 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
370 |
durl = self.dc.get_depot_url() |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
371 |
plist = self.pkgsend_bulk(durl, self.foo10) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
372 |
self.pkgsend(durl, "append %s" % plist[0]) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
373 |
self.dc.stop() |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
374 |
self.dc.start() |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
375 |
self.pkgsend(durl, "close") |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
376 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
377 |
def test_nonsig_append(self): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
378 |
"""Test that sending a non-signature action to an append |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
379 |
transaction results in an error.""" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
380 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
381 |
durl = self.dc.get_depot_url() |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
382 |
plist = self.pkgsend_bulk(durl, self.foo10) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
383 |
self.pkgsend(durl, "append %s" % plist[0]) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
384 |
self.pkgsend(durl, "add dir path=tmp/foo mode=0755 " |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
385 |
"owner=root group=bin", exit=1) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
1974
diff
changeset
|
386 |
|
2044
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
387 |
def test_root_link(self): |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
388 |
"""Verify that the depot server accepts a link to a |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
389 |
directory as a repository root.""" |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
390 |
|
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
391 |
if self.dc.started: |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
392 |
self.dc.stop() |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
393 |
|
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
394 |
# Create a link to the repository and verify that |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
395 |
# the depot server allows it. |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
396 |
lsrc = self.dc.get_repodir() |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
397 |
ltarget = os.path.join(self.test_root, "depot_link") |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
398 |
os.symlink(lsrc, ltarget) |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
399 |
self.dc.set_repodir(ltarget) |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
400 |
self.dc.start() |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
401 |
|
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
402 |
# Reset for any tests that might execute afterwards. |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
403 |
os.unlink(ltarget) |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
404 |
self.dc.stop() |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
405 |
self.dc.set_repodir(lsrc) |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
406 |
self.dc.start() |
a46dff79cf01
16916 repository class should allow root to be a symlink
Shawn Walker <shawn.walker@oracle.com>
parents:
2028
diff
changeset
|
407 |
|
873
b95d76c53b5e
2691 ability to publish packages to local disk repository
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
408 |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
409 |
class TestDepotController(pkg5unittest.CliTestCase): |
581 | 410 |
|
411 |
def setUp(self): |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
412 |
pkg5unittest.CliTestCase.setUp(self) |
581 | 413 |
|
414 |
self.__dc = dc.DepotController() |
|
415 |
self.__pid = os.getpid() |
|
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
416 |
self.__dc.set_property("publisher", "prefix", "test") |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
417 |
self.__dc.set_depotd_path(pkg5unittest.g_proto_area + \ |
581 | 418 |
"/usr/lib/pkg.depotd") |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
419 |
self.__dc.set_depotd_content_root(pkg5unittest.g_proto_area + \ |
612
353fef98c569
4102 test suite fails if /usr/share/lib/pkg doesn't exist
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
599
diff
changeset
|
420 |
"/usr/share/lib/pkg") |
581 | 421 |
|
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
422 |
repopath = os.path.join(self.test_root, "repo") |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
423 |
logpath = os.path.join(self.test_root, self.id()) |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
424 |
self.create_repo(repopath, properties={ "publisher": { |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
425 |
"prefix": "test" }}) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
426 |
self.__dc.set_repodir(repopath) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
427 |
self.__dc.set_logpath(logpath) |
581 | 428 |
|
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
429 |
def _get_repo_index_dir(self): |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
430 |
depotpath = self.__dc.get_repodir() |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
431 |
repo = self.__dc.get_repo() |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
432 |
rstore = repo.get_pub_rstore("test") |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
433 |
return rstore.index_root |
581 | 434 |
|
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
435 |
def _get_repo_writ_dir(self): |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
436 |
depotpath = self.__dc.get_repodir() |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
437 |
repo = self.__dc.get_repo() |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
438 |
rstore = repo.get_pub_rstore("test") |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
439 |
return rstore.writable_root |
581 | 440 |
|
441 |
def tearDown(self): |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
442 |
pkg5unittest.CliTestCase.tearDown(self) |
581 | 443 |
self.__dc.kill() |
444 |
||
445 |
def testStartStop(self): |
|
2272
d81ea073d050
3617 Testsuite should allow choice for base port to use
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2230
diff
changeset
|
446 |
self.__dc.set_port(self.next_free_port) |
581 | 447 |
for i in range(0, 5): |
448 |
self.__dc.start() |
|
449 |
self.assert_(self.__dc.is_alive()) |
|
450 |
self.__dc.stop() |
|
451 |
self.assert_(not self.__dc.is_alive()) |
|
452 |
||
797
fddb78531f55
5211 cfg_cache needs to be able to live elsewhere
Brock Pytlik <bpytlik@sun.com>
parents:
742
diff
changeset
|
453 |
def test_cfg_file(self): |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
454 |
cfg_file = os.path.join(self.test_root, "cfg2") |
797
fddb78531f55
5211 cfg_cache needs to be able to live elsewhere
Brock Pytlik <bpytlik@sun.com>
parents:
742
diff
changeset
|
455 |
fh = open(cfg_file, "w") |
fddb78531f55
5211 cfg_cache needs to be able to live elsewhere
Brock Pytlik <bpytlik@sun.com>
parents:
742
diff
changeset
|
456 |
fh.close() |
2272
d81ea073d050
3617 Testsuite should allow choice for base port to use
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2230
diff
changeset
|
457 |
self.__dc.set_port(self.next_free_port) |
797
fddb78531f55
5211 cfg_cache needs to be able to live elsewhere
Brock Pytlik <bpytlik@sun.com>
parents:
742
diff
changeset
|
458 |
self.__dc.set_cfg_file(cfg_file) |
fddb78531f55
5211 cfg_cache needs to be able to live elsewhere
Brock Pytlik <bpytlik@sun.com>
parents:
742
diff
changeset
|
459 |
self.__dc.start() |
fddb78531f55
5211 cfg_cache needs to be able to live elsewhere
Brock Pytlik <bpytlik@sun.com>
parents:
742
diff
changeset
|
460 |
|
975
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
461 |
def test_writable_root(self): |
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
462 |
"""Tests whether the index and feed cache file are written to |
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
463 |
the writable root parameter.""" |
1899
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
464 |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
465 |
self.make_misc_files(TestPkgDepot.misc_files) |
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
466 |
writable_root = os.path.join(self.test_root, |
975
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
467 |
"writ_root") |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
468 |
o_index_dir = os.path.join(self._get_repo_index_dir(), "index") |
975
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
469 |
|
1020
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
470 |
timeout = 10 |
1507
b956ea23d3a6
11735 pkg history data files should not be executable
Richard Lowe <richlowe@richlowe.net>
parents:
1505
diff
changeset
|
471 |
|
975
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
472 |
def check_state(check_feed): |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
473 |
index_dir = os.path.join(self._get_repo_writ_dir(), |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
474 |
"index") |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
475 |
feed = os.path.join(writable_root, "publisher", "test", |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
476 |
"feed.xml") |
1020
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
477 |
found = not os.path.exists(o_index_dir) and \ |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
478 |
os.path.isdir(index_dir) and \ |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
479 |
(not check_feed or os.path.isfile(feed)) |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
480 |
start_time = time.time() |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
481 |
while not found and time.time() - start_time < timeout: |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
482 |
time.sleep(1) |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
483 |
found = not os.path.exists(o_index_dir) and \ |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
484 |
os.path.isdir(index_dir) and \ |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
485 |
(not check_feed or os.path.isfile(feed)) |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
486 |
|
975
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
487 |
self.assert_(not os.path.exists(o_index_dir)) |
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
488 |
self.assert_(os.path.isdir(index_dir)) |
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
489 |
if check_feed: |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
490 |
try: |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
491 |
self.assert_(os.path.isfile(feed)) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
492 |
except: |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
493 |
raise RuntimeError("Feed cache file " |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
494 |
"not found at '%s'." % feed) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
495 |
def get_feed(durl, pub=""): |
1020
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
496 |
start_time = time.time() |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
497 |
got = False |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
498 |
while not got and (time.time() - start_time) < timeout: |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
499 |
if pub: |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
500 |
pub = "%s/" % pub |
1020
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
501 |
try: |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
502 |
urllib2.urlopen("%s%s/feed" % (durl, |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
503 |
pub)) |
1020
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
504 |
got = True |
1968
c0540b1e4f7e
8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents:
1937
diff
changeset
|
505 |
except urllib2.HTTPError, e: |
c0540b1e4f7e
8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents:
1937
diff
changeset
|
506 |
self.debug(str(e)) |
1020
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
507 |
time.sleep(1) |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
508 |
self.assert_(got) |
1507
b956ea23d3a6
11735 pkg history data files should not be executable
Richard Lowe <richlowe@richlowe.net>
parents:
1505
diff
changeset
|
509 |
|
2272
d81ea073d050
3617 Testsuite should allow choice for base port to use
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2230
diff
changeset
|
510 |
self.__dc.set_port(self.next_free_port) |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
511 |
durl = self.__dc.get_depot_url() |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
512 |
|
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
513 |
repo = self.__dc.get_repo() |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
514 |
pub = repo.get_publisher("test") |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
515 |
pub_repo = pub.selected_repository |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
516 |
if not pub_repo: |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
517 |
pub_repo = publisher.Repository() |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
518 |
while pub.repositories: |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
519 |
pub.repositories.pop() |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
520 |
pub.repositories.append(pub_repo) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
521 |
pub_repo.origins = [durl] |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
522 |
repo.update_publisher(pub) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
523 |
|
975
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
524 |
self.__dc.set_writable_root(writable_root) |
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1715
diff
changeset
|
525 |
self.__dc.set_property("publisher", "prefix", "test") |
975
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
526 |
self.__dc.start() |
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
527 |
check_state(False) |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
528 |
self.pkgsend_bulk(durl, TestPkgDepot.quux10, refresh_index=True) |
1020
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
529 |
get_feed(durl) |
975
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
530 |
check_state(True) |
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
531 |
|
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
532 |
self.image_create(durl) |
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
533 |
self.pkg("search -r cat") |
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
534 |
self.__dc.stop() |
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
535 |
self.__dc.set_readonly() |
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
536 |
shutil.rmtree(writable_root) |
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
537 |
self.__dc.start() |
1020
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
538 |
get_feed(durl) |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
539 |
check_state(True) |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
540 |
self.pkg("search -r cat") |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
541 |
self.__dc.stop() |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
542 |
self.__dc.set_refresh_index() |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
543 |
shutil.rmtree(writable_root) |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
544 |
self.__dc.start() |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
545 |
check_state(False) |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
546 |
self.__dc.stop() |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
547 |
self.__dc.set_norefresh_index() |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
548 |
self.__dc.start() |
765f4ea49070
7729 writable-root support doesn't allow depot contents to be read only
Brock Pytlik <bpytlik@sun.com>
parents:
975
diff
changeset
|
549 |
get_feed(durl) |
975
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
550 |
check_state(True) |
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
551 |
self.pkg("search -r cat") |
346745ea94fe
2701 "scratch area" for depot
Brock Pytlik <bpytlik@sun.com>
parents:
933
diff
changeset
|
552 |
|
581 | 553 |
def testBadArgs(self): |
2272
d81ea073d050
3617 Testsuite should allow choice for base port to use
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2230
diff
changeset
|
554 |
self.__dc.set_port(self.next_free_port) |
581 | 555 |
self.__dc.set_readonly() |
556 |
self.__dc.set_rebuild() |
|
557 |
self.__dc.set_norefresh_index() |
|
558 |
||
559 |
self.assert_(self.__dc.start_expected_fail()) |
|
560 |
||
561 |
self.__dc.set_readonly() |
|
562 |
self.__dc.set_norebuild() |
|
563 |
self.__dc.set_refresh_index() |
|
564 |
||
565 |
self.assert_(self.__dc.start_expected_fail()) |
|
566 |
||
567 |
self.__dc.set_readonly() |
|
568 |
self.__dc.set_rebuild() |
|
569 |
self.__dc.set_refresh_index() |
|
570 |
||
571 |
self.assert_(self.__dc.start_expected_fail()) |
|
572 |
||
573 |
self.__dc.set_readwrite() |
|
574 |
self.__dc.set_rebuild() |
|
575 |
self.__dc.set_refresh_index() |
|
576 |
||
577 |
self.assert_(self.__dc.start_expected_fail()) |
|
578 |
||
579 |
self.__dc.set_mirror() |
|
580 |
self.__dc.set_rebuild() |
|
581 |
self.__dc.set_norefresh_index() |
|
582 |
||
583 |
self.assert_(self.__dc.start_expected_fail()) |
|
584 |
||
585 |
self.__dc.set_mirror() |
|
586 |
self.__dc.set_norebuild() |
|
587 |
self.__dc.set_refresh_index() |
|
588 |
||
589 |
self.assert_(self.__dc.start_expected_fail()) |
|
590 |
||
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
591 |
def test_disable_ops(self): |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
592 |
"""Verify that disable-ops works as expected.""" |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
593 |
|
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
594 |
# For this disabled case, /catalog/1/ should return |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
595 |
# a NOT_FOUND error. |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
596 |
self.__dc.set_disable_ops(["catalog/1"]) |
2272
d81ea073d050
3617 Testsuite should allow choice for base port to use
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2230
diff
changeset
|
597 |
self.__dc.set_port(self.next_free_port) |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
598 |
self.__dc.start() |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
599 |
durl = self.__dc.get_depot_url() |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
600 |
try: |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
601 |
urllib2.urlopen("%s/catalog/1/" % durl) |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
602 |
except urllib2.HTTPError, e: |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
603 |
self.assertEqual(e.code, httplib.NOT_FOUND) |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
604 |
self.__dc.stop() |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
605 |
|
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
606 |
# For this disabled case, all /catalog/ operations should return |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
607 |
# a NOT_FOUND error. |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
608 |
self.__dc.set_disable_ops(["catalog"]) |
2272
d81ea073d050
3617 Testsuite should allow choice for base port to use
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2230
diff
changeset
|
609 |
self.__dc.set_port(self.next_free_port) |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
610 |
self.__dc.start() |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
611 |
durl = self.__dc.get_depot_url() |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
612 |
for ver in (0, 1): |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
613 |
try: |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
614 |
urllib2.urlopen("%s/catalog/%d/" % (durl, ver)) |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
615 |
except urllib2.HTTPError, e: |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
616 |
self.assertEqual(e.code, httplib.NOT_FOUND) |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
617 |
self.__dc.stop() |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
618 |
|
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
619 |
# In the normal case, /catalog/1/ should return |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
620 |
# a FORBIDDEN error. |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
621 |
self.__dc.unset_disable_ops() |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
622 |
self.__dc.start() |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
623 |
durl = self.__dc.get_depot_url() |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
624 |
try: |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
625 |
urllib2.urlopen("%s/catalog/1/" % durl) |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
626 |
except urllib2.HTTPError, e: |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
627 |
self.assertEqual(e.code, httplib.FORBIDDEN) |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
628 |
self.__dc.stop() |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
629 |
|
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
630 |
# A bogus operation should prevent the depot from starting. |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
631 |
self.__dc.set_disable_ops(["no_such_op/0"]) |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
632 |
self.__dc.start_expected_fail() |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
633 |
self.assertFalse(self.__dc.is_alive()) |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
634 |
|
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
635 |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
636 |
class TestDepotOutput(pkg5unittest.SingleDepotTestCase): |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
637 |
# Since these tests are output sensitive, the depots should be purged |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
638 |
# after each one is run. |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
639 |
persistent_setup = False |
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
640 |
|
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
641 |
quux10 = """ |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
642 |
open [email protected],5.11-0 |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
643 |
add dir mode=0755 owner=root group=bin path=/bin |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
644 |
close """ |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
645 |
|
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
646 |
info10 = """ |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
647 |
open [email protected],5.11-0 |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
648 |
close """ |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
649 |
|
1899
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
650 |
file10 = """ |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
651 |
open [email protected],5.11-0 |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
652 |
add dir mode=0755 owner=root group=bin path=/var |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
653 |
add file tmp/file path=var/file mode=644 owner=root group=bin |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
654 |
close """ |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
655 |
|
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
656 |
system10 = """ |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
657 |
open system/[email protected],5.11-0 |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
658 |
add set name="description" value="Package to test package names with slashes" |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
659 |
add dir path=tmp/foo mode=0755 owner=root group=bin |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
660 |
add depend type=require fmri=pkg:/SUNWcsl |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
661 |
close """ |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
662 |
|
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
663 |
zfsextras10 = """ |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
664 |
open [email protected],5.11-0 |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
665 |
close """ |
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
666 |
|
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
667 |
zfsutils10 = """ |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
668 |
open zfs/[email protected],5.11-0 |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
669 |
close """ |
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
670 |
|
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
671 |
repo_cfg = { |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
672 |
"publisher": { |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
673 |
"prefix": "org.opensolaris.pending" |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
674 |
}, |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
675 |
} |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
676 |
|
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
677 |
pub_repo_cfg = { |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
678 |
"collection_type": "supplemental", |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
679 |
"description": |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
680 |
"Development packages for the contrib repository.", |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
681 |
"legal_uris": [ |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
682 |
"http://www.opensolaris.org/os/copyrights", |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
683 |
"http://www.opensolaris.org/os/tou", |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
684 |
"http://www.opensolaris.org/os/trademark" |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
685 |
], |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
686 |
"mirrors": [], |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
687 |
"name": """"Pending" Repository""", |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
688 |
"origins": [], # Has to be set during setUp for correct origin. |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
689 |
"refresh_seconds": 86400, |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
690 |
"registration_uri": "", |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
691 |
"related_uris": [ |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
692 |
"http://jucr.opensolaris.org/contrib", |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
693 |
"http://jucr.opensolaris.org/pending", |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
694 |
"http://pkg.opensolaris.org/contrib", |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
695 |
] |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
696 |
} |
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
697 |
|
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
698 |
def setUp(self): |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
699 |
pkg5unittest.SingleDepotTestCase.setUp(self) |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
700 |
|
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
701 |
# Prevent override of custom configuration; |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
702 |
# tests will set as needed. |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
703 |
self.dc.clear_property("publisher", "prefix") |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
704 |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
705 |
self.tpath = tempfile.mkdtemp(prefix="tpath", |
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1672
diff
changeset
|
706 |
dir=self.test_root) |
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
707 |
|
1899
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
708 |
self.make_misc_files("tmp/file") |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
709 |
|
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
710 |
def test_0_depot_bui_output(self): |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
711 |
"""Verify that a non-error response and valid HTML is returned |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
712 |
for each known BUI page in every available depot mode.""" |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
713 |
|
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
714 |
pub = "test" |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
715 |
self.dc.set_property("publisher", "prefix", pub) |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
716 |
|
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
717 |
# A list of tuples containing the name of the method used to set |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
718 |
# the mode, and then the method needed to unset that mode. |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
719 |
mode_methods = [ |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
720 |
("set_readwrite", None), |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
721 |
("set_mirror", "unset_mirror"), |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
722 |
("set_readonly", "set_readwrite"), |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
723 |
] |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
724 |
|
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
725 |
pages = [ |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
726 |
"index.shtml", |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
727 |
"en/catalog.shtml", |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
728 |
"en/index.shtml", |
1116
5eb1d9f5bd88
2741 advanced web-based package search capability desired
Shawn Walker <srw@sun.com>
parents:
1025
diff
changeset
|
729 |
"en/advanced_search.shtml", |
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
730 |
"en/search.shtml", |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
731 |
"en/stats.shtml", |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
732 |
] |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
733 |
|
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
734 |
repodir = self.dc.get_repodir() |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
735 |
durl = self.dc.get_depot_url() |
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
736 |
for with_packages in (False, True): |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
737 |
shutil.rmtree(repodir, ignore_errors=True) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
738 |
|
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
739 |
# Create repository and set publisher origins. |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
740 |
self.create_repo(self.dc.get_repodir()) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
741 |
self.pkgrepo("set -s %(repodir)s -p %(pub)s " |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
742 |
"repository/origins=%(durl)s" % locals()) |
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
743 |
|
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
744 |
if with_packages: |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
745 |
self.dc.set_readwrite() |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
746 |
self.dc.start() |
1895
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1850
diff
changeset
|
747 |
self.pkgsend_bulk(durl, (self.info10, |
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1850
diff
changeset
|
748 |
self.quux10, self.system10)) |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
749 |
self.dc.stop() |
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
750 |
|
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
751 |
for set_method, unset_method in mode_methods: |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
752 |
if set_method: |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
753 |
getattr(self.dc, set_method)() |
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
754 |
|
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
755 |
self.dc.start() |
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
756 |
for path in pages: |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
757 |
# Any error responses will cause an |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
758 |
# exception. |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
759 |
response = urllib2.urlopen( |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
760 |
"%s/%s" % (durl, path)) |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
761 |
|
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
762 |
fd, fpath = tempfile.mkstemp( |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
763 |
suffix="html", dir=self.tpath) |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
764 |
fp = os.fdopen(fd, "w") |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
765 |
fp.write(response.read()) |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
766 |
fp.close() |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
767 |
|
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
768 |
self.validate_html_file(fpath) |
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
769 |
|
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
770 |
self.dc.stop() |
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
771 |
if unset_method: |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
772 |
getattr(self.dc, unset_method)() |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
773 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
774 |
def __update_repo_config(self): |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
775 |
"""Helper function to generate test repository configuration.""" |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
776 |
# Find and load the repository configuration. |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
777 |
rpath = self.dc.get_repodir() |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
778 |
assert os.path.isdir(rpath) |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
779 |
rcpath = os.path.join(rpath, "cfg_cache") |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
780 |
|
1968
c0540b1e4f7e
8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents:
1937
diff
changeset
|
781 |
rc = sr.RepositoryConfig(target=rcpath) |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
782 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
783 |
# Update the configuration with our sample data. |
1968
c0540b1e4f7e
8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents:
1937
diff
changeset
|
784 |
cfgdata = self.repo_cfg |
c0540b1e4f7e
8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents:
1937
diff
changeset
|
785 |
for section in cfgdata: |
c0540b1e4f7e
8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents:
1937
diff
changeset
|
786 |
for prop in cfgdata[section]: |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
787 |
rc.set_property(section, prop, |
1968
c0540b1e4f7e
8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents:
1937
diff
changeset
|
788 |
cfgdata[section][prop]) |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
789 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
790 |
# Save it. |
1847
8305fabbb27d
15190 repository should avoid needless cfg_cache rewrites
Richard Lowe <richlowe@richlowe.net>
parents:
1736
diff
changeset
|
791 |
rc.write() |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
792 |
|
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
793 |
# Apply publisher properties and update. |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
794 |
repo = self.dc.get_repo() |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
795 |
try: |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
796 |
pub = repo.get_publisher("org.opensolaris.pending") |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
797 |
except sr.RepositoryUnknownPublisher: |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
798 |
pub = publisher.Publisher("org.opensolaris.pending") |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
799 |
repo.add_publisher(pub) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
800 |
|
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
801 |
pub_repo = pub.selected_repository |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
802 |
if not pub_repo: |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
803 |
pub_repo = publisher.Repository() |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
804 |
while pub.repositories: |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
805 |
pub.repositories.pop() |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
806 |
pub.repositories.append(pub_repo) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
807 |
|
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
808 |
for attr, val in self.pub_repo_cfg.iteritems(): |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
809 |
setattr(pub_repo, attr, val) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
810 |
repo.update_publisher(pub) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
811 |
|
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
812 |
def test_1_depot_publisher(self): |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
813 |
"""Verify the output of the depot /publisher operation.""" |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
814 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
815 |
# Now update the repository configuration while the depot is |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
816 |
# stopped so changes won't be overwritten on exit. |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
817 |
self.__update_repo_config() |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
818 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
819 |
# Start the depot. |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
820 |
self.dc.start() |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
821 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
822 |
durl = self.dc.get_depot_url() |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
823 |
purl = urlparse.urljoin(durl, "publisher/0") |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
824 |
entries = p5i.parse(location=purl) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
825 |
assert entries[0][0].prefix == "test" |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
826 |
assert entries[1][0].prefix == "org.opensolaris.pending" |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
827 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
828 |
# Now verify that the parsed response has the expected data. |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
829 |
pub, pkglist = entries[-1] |
1968
c0540b1e4f7e
8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents:
1937
diff
changeset
|
830 |
cfgdata = self.repo_cfg |
c0540b1e4f7e
8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents:
1937
diff
changeset
|
831 |
for prop in cfgdata["publisher"]: |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
832 |
self.assertEqual(getattr(pub, prop), |
1968
c0540b1e4f7e
8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents:
1937
diff
changeset
|
833 |
cfgdata["publisher"][prop]) |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
834 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
835 |
repo = pub.selected_repository |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
836 |
for prop, expected in self.pub_repo_cfg.iteritems(): |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
837 |
returned = getattr(repo, prop) |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
838 |
if prop.endswith("uris") or prop == "origins": |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
839 |
uris = [] |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
840 |
for u in returned: |
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1715
diff
changeset
|
841 |
uri = u.uri |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1715
diff
changeset
|
842 |
if uri.endswith("/"): |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1715
diff
changeset
|
843 |
uri = uri[:-1] |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1715
diff
changeset
|
844 |
uris.append(uri) |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
845 |
returned = uris |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
846 |
self.assertEqual(returned, expected) |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
847 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
848 |
def test_2_depot_p5i(self): |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
849 |
"""Verify the output of the depot /publisher operation.""" |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
850 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
851 |
# Now update the repository configuration while the depot is |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
852 |
# stopped so changes won't be overwritten on exit. |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
853 |
self.__update_repo_config() |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
854 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
855 |
# Start the depot. |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
856 |
self.dc.start() |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
857 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
858 |
# Then, publish some packages we can abuse for testing. |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
859 |
durl = self.dc.get_depot_url() |
1895
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1850
diff
changeset
|
860 |
plist = self.pkgsend_bulk(durl, (self.info10, self.quux10, |
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1850
diff
changeset
|
861 |
self.system10, self.zfsextras10, self.zfsutils10)) |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
862 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
863 |
# Now, for each published package, attempt to get a p5i file |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
864 |
# and then verify that the parsed response has the expected |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
865 |
# package information under the expected publisher. |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
866 |
for p in plist: |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
867 |
purl = urlparse.urljoin(durl, "p5i/0/%s" % p) |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
868 |
pub, pkglist = p5i.parse(location=purl)[0] |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
869 |
|
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
870 |
# p5i files contain non-qualified FMRIs as the FMRIs |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
871 |
# are already grouped by publisher. |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
872 |
nq_p = fmri.PkgFmri(p).get_fmri(anarchy=True, |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
873 |
include_scheme=False) |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
874 |
self.assertEqual(pkglist, [nq_p]) |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
875 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
876 |
# Try again, but only using package stems. |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
877 |
for p in plist: |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1151
diff
changeset
|
878 |
stem = fmri.PkgFmri(p).pkg_name |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
879 |
purl = urlparse.urljoin(durl, "p5i/0/%s" % stem) |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
880 |
pub, pkglist = p5i.parse(location=purl)[0] |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
881 |
self.assertEqual(pkglist, [stem]) |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
882 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
883 |
# Try again, but using wildcards (which will return a list of |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
884 |
# matching package stems). |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
885 |
purl = urlparse.urljoin(durl, "p5i/0/zfs*") |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
886 |
pub, pkglist = p5i.parse(location=purl)[0] |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
887 |
self.assertEqual(pkglist, ["zfs-extras", "zfs/utils"]) |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
888 |
|
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
889 |
# Finally, verify that a non-existent package will error out |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
890 |
# with a httplib.NOT_FOUND. |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
891 |
try: |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
892 |
urllib2.urlopen(urlparse.urljoin(durl, |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
893 |
"p5i/0/nosuchpackage")) |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
894 |
except urllib2.HTTPError, e: |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
895 |
if e.code != httplib.NOT_FOUND: |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
896 |
raise |
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1116
diff
changeset
|
897 |
|
1899
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
898 |
def test_3_headers(self): |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
899 |
"""Ensure expected headers are present for client operations |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
900 |
(excluding publication).""" |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
901 |
|
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
902 |
# Now update the repository configuration while the depot is |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
903 |
# stopped so changes won't be overwritten on exit. |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
904 |
self.__update_repo_config() |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
905 |
|
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
906 |
# Start the depot. |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
907 |
self.dc.start() |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
908 |
|
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
909 |
durl = self.dc.get_depot_url() |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
910 |
pfmri = fmri.PkgFmri(self.pkgsend_bulk(durl, self.file10, |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
911 |
refresh_index=True)[0], "5.11") |
1899
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
912 |
|
2065
314bed0b4ef8
16982 depot should be more cooperative about indexing during startup
Shawn Walker <shawn.walker@oracle.com>
parents:
2045
diff
changeset
|
913 |
# Wait for search indexing to complete. |
314bed0b4ef8
16982 depot should be more cooperative about indexing during startup
Shawn Walker <shawn.walker@oracle.com>
parents:
2045
diff
changeset
|
914 |
self.wait_repo(self.dc.get_repodir()) |
314bed0b4ef8
16982 depot should be more cooperative about indexing during startup
Shawn Walker <shawn.walker@oracle.com>
parents:
2045
diff
changeset
|
915 |
|
1899
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
916 |
def get_headers(req_path): |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
917 |
try: |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
918 |
rinfo = urllib2.urlopen(urlparse.urljoin(durl, |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
919 |
req_path)).info() |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
920 |
return rinfo.items() |
2045
9e45bddd5753
16840 depot should mark error responses as uncachable
johansen <johansen@opensolaris.org>
parents:
2044
diff
changeset
|
921 |
except urllib2.HTTPError, e: |
9e45bddd5753
16840 depot should mark error responses as uncachable
johansen <johansen@opensolaris.org>
parents:
2044
diff
changeset
|
922 |
return e.info().items() |
1899
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
923 |
except Exception, e: |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
924 |
raise RuntimeError("retrieval of %s " |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
925 |
"failed: %s" % (req_path, str(e))) |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
926 |
|
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
927 |
for req_path in ("publisher/0", 'search/0/%2Fvar%2Ffile', |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
928 |
'search/1/False_2_None_None_%2Fvar%2Ffile', |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
929 |
"versions/0", "manifest/0/%s" % pfmri.get_url_path(), |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
930 |
"catalog/0", "catalog/1/catalog.attrs", |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
931 |
"file/0/3aad0bca6f3a6f502c175700ebe90ef36e312d7e", |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
932 |
"filelist/0"): |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
933 |
hdrs = dict(get_headers(req_path)) |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
934 |
|
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
935 |
# Fields must be referenced in lowercase. |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
936 |
if req_path.startswith("filelist"): |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
937 |
self.assertEqual(hdrs.get("expires", ""), "0") |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
938 |
self.assertEqual(hdrs.get("cache-control", ""), |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
939 |
"no-cache, no-transform, must-revalidate") |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
940 |
self.assertEqual(hdrs.get("pragma", None), |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
941 |
"no-cache") |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
942 |
else: |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
943 |
cc = hdrs.get("cache-control", "") |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
944 |
self.assert_(cc.startswith("must-revalidate, " |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
945 |
"no-transform, max-age=")) |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
946 |
exp = hdrs.get("expires", None) |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
947 |
self.assertNotEqual(exp, None) |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
948 |
self.assert_(exp.endswith(" GMT")) |
ed3d412ef18a
15328 depot should attach HTTP cache control headers to responses
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
949 |
|
2045
9e45bddd5753
16840 depot should mark error responses as uncachable
johansen <johansen@opensolaris.org>
parents:
2044
diff
changeset
|
950 |
for req_path in ("catalog/1/catalog.hatters", |
9e45bddd5753
16840 depot should mark error responses as uncachable
johansen <johansen@opensolaris.org>
parents:
2044
diff
changeset
|
951 |
"file/0/3aad0bca6f3a6f502c175700ebe90ef36e312d7f"): |
9e45bddd5753
16840 depot should mark error responses as uncachable
johansen <johansen@opensolaris.org>
parents:
2044
diff
changeset
|
952 |
|
9e45bddd5753
16840 depot should mark error responses as uncachable
johansen <johansen@opensolaris.org>
parents:
2044
diff
changeset
|
953 |
hdrs = dict(get_headers(req_path)) |
9e45bddd5753
16840 depot should mark error responses as uncachable
johansen <johansen@opensolaris.org>
parents:
2044
diff
changeset
|
954 |
cc = hdrs.get("cache-control", None) |
9e45bddd5753
16840 depot should mark error responses as uncachable
johansen <johansen@opensolaris.org>
parents:
2044
diff
changeset
|
955 |
prg = hdrs.get("pragma", None) |
9e45bddd5753
16840 depot should mark error responses as uncachable
johansen <johansen@opensolaris.org>
parents:
2044
diff
changeset
|
956 |
self.assertEqual(cc, None) |
9e45bddd5753
16840 depot should mark error responses as uncachable
johansen <johansen@opensolaris.org>
parents:
2044
diff
changeset
|
957 |
self.assertEqual(prg, None) |
9e45bddd5753
16840 depot should mark error responses as uncachable
johansen <johansen@opensolaris.org>
parents:
2044
diff
changeset
|
958 |
|
1850
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
959 |
def test_bug_15482(self): |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
960 |
"""Test to make sure BUI search doesn't trigger a traceback.""" |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
961 |
|
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
962 |
# Now update the repository configuration while the depot is |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
963 |
# stopped so changes won't be overwritten on exit. |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
964 |
self.__update_repo_config() |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
965 |
|
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
966 |
# Start the depot. |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
967 |
self.dc.start() |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
968 |
|
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
969 |
# Then, publish some packages we can abuse for testing. |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
970 |
durl = self.dc.get_depot_url() |
2073
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
2065
diff
changeset
|
971 |
self.pkgsend_bulk(durl, self.quux10, refresh_index=True) |
1895
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1850
diff
changeset
|
972 |
|
1850
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
973 |
surl = urlparse.urljoin(durl, |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
974 |
"en/search.shtml?action=Search&token=*") |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
975 |
urllib2.urlopen(surl).read() |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
976 |
surl = urlparse.urljoin(durl, |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
977 |
"en/advanced_search.shtml?action=Search&token=*") |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
978 |
urllib2.urlopen(surl).read() |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
979 |
surl = urlparse.urljoin(durl, |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
980 |
"en/advanced_search.shtml?token=*&show=a&rpp=50&" |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
981 |
"action=Advanced+Search") |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
982 |
urllib2.urlopen(surl).read() |
0ddf4a6601cd
15482 Fix for bug 6177 breaks bui search
Brock Pytlik <bpytlik@sun.com>
parents:
1847
diff
changeset
|
983 |
|
2230
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
984 |
def test_address(self): |
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
985 |
"""Verify that depot address can be set.""" |
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
986 |
|
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
987 |
# Check that IPv6 address can be used. |
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
988 |
self.dc.set_address("::1") |
2272
d81ea073d050
3617 Testsuite should allow choice for base port to use
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2230
diff
changeset
|
989 |
self.dc.set_port(self.next_free_port) |
2230
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
990 |
self.dc.start() |
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
991 |
self.assert_(self.dc.is_alive()) |
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
992 |
self.assert_(self.dc.is_alive()) |
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
993 |
self.assert_(self.dc.is_alive()) |
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
994 |
|
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
995 |
# Check that we can retrieve something. |
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
996 |
durl = self.dc.get_depot_url() |
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
997 |
verdata = urllib2.urlopen("%s/versions/0/" % durl) |
76f30e842e82
15750 depot bind address should be configurable
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
998 |
|
817
45d075560318
2300 depot bui output tests needed
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
797
diff
changeset
|
999 |
|
581 | 1000 |
if __name__ == "__main__": |
1001 |
unittest.main() |