mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-20 19:38:39 +00:00
aptly serve command: handle publishing of repositories, with system test.
This commit is contained in:
8
system/t07_serve/VerifySnapshot1Test_gold
Normal file
8
system/t07_serve/VerifySnapshot1Test_gold
Normal file
@@ -0,0 +1,8 @@
|
||||
Serving published repositories, recommended apt sources list:
|
||||
|
||||
# ./maverick (main) [amd64, i386] publishes [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick
|
||||
deb http://127.0.0.1:8765/ maverick main
|
||||
# debian/maverick (main) [amd64, i386] publishes [snap2]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick
|
||||
deb http://127.0.0.1:8765/debian/ maverick main
|
||||
|
||||
Starting web server at: 127.0.0.1:8765 (press Ctrl+C to quit)...
|
||||
5
system/t07_serve/VerifySnapshot1Test_http
Normal file
5
system/t07_serve/VerifySnapshot1Test_http
Normal file
@@ -0,0 +1,5 @@
|
||||
<pre>
|
||||
<a href="debian/">debian/</a>
|
||||
<a href="dists/">dists/</a>
|
||||
<a href="pool/">pool/</a>
|
||||
</pre>
|
||||
1
system/t07_serve/VerifySnapshot2Test_gold
Normal file
1
system/t07_serve/VerifySnapshot2Test_gold
Normal file
@@ -0,0 +1 @@
|
||||
No published repositories, unable to serve.
|
||||
64
system/t07_serve/__init__.py
Normal file
64
system/t07_serve/__init__.py
Normal file
@@ -0,0 +1,64 @@
|
||||
"""
|
||||
Testing serving public repo
|
||||
"""
|
||||
|
||||
import httplib
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import shlex
|
||||
import time
|
||||
|
||||
from lib import BaseTest
|
||||
|
||||
|
||||
class VerifySnapshot1Test(BaseTest):
|
||||
"""
|
||||
serve public: two publishes, verify HTTP
|
||||
"""
|
||||
fixtureDB = True
|
||||
fixturePool = True
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap1 from mirror gnuplot-maverick",
|
||||
"aptly snapshot create snap2 from mirror gnuplot-maverick",
|
||||
"aptly publish snapshot snap1",
|
||||
"aptly publish snapshot snap2 debian",
|
||||
]
|
||||
runCmd = "aptly serve -listen=127.0.0.1:8765"
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
proc = subprocess.Popen(shlex.split(self.runCmd), stderr=subprocess.STDOUT, stdout=subprocess.PIPE, bufsize=0)
|
||||
|
||||
try:
|
||||
time.sleep(1)
|
||||
|
||||
conn = httplib.HTTPConnection("127.0.0.1", 8765)
|
||||
conn.request("GET", "/")
|
||||
r = conn.getresponse()
|
||||
if r.status != 200:
|
||||
raise Exception("Expected status 200 != %d" % r.status)
|
||||
self.http_response = r.read()
|
||||
|
||||
output = os.read(proc.stdout.fileno(), 8192)
|
||||
|
||||
finally:
|
||||
proc.send_signal(signal.SIGINT)
|
||||
proc.wait()
|
||||
|
||||
if proc.returncode != 2:
|
||||
raise Exception("exit code %d != %d (output: %s)" % (proc.returncode, 2, output))
|
||||
self.output = output
|
||||
except Exception, e:
|
||||
raise Exception("Running command %s failed: %s" % (self.runCmd, str(e)))
|
||||
|
||||
def check(self):
|
||||
self.check_output()
|
||||
self.verify_match(self.get_gold('http'), self.http_response)
|
||||
|
||||
|
||||
class VerifySnapshot2Test(BaseTest):
|
||||
"""
|
||||
serve public: no publishes
|
||||
"""
|
||||
runCmd = "aptly serve -listen=127.0.0.1:8765"
|
||||
Reference in New Issue
Block a user