From ab48a6d810b4c8d7c9df351f91441fe3dd577818 Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Thu, 13 Feb 2014 21:53:40 +0800 Subject: [PATCH] test updated --- test/instructions.act | 72 ++++++++++++++++++++++++------------------- test/repomon_test.py | 15 ++++++--- 2 files changed, 51 insertions(+), 36 deletions(-) diff --git a/test/instructions.act b/test/instructions.act index 0297fb3..b2b75cc 100644 --- a/test/instructions.act +++ b/test/instructions.act @@ -1,51 +1,59 @@ base_dir: /var/cache/pacman/pkg +# wait for server to start +wait -# i686 and x86_64 packages +# x86_64 packages add: any zip-3.0-3-x86_64.pkg.tar.xz -add: x86_64 zip-3.0-3-i686.pkg.tar.xz wait checky: x86_64/zip-3.0-3-x86_64.pkg.tar.xz -checky: i686/zip-3.0-3-i686.pkg.tar.xz checkp: x86_64 zip=3.0-3 -checkp: i686 zip=3.0-3 # 'any' package -add: i686 ydcv-0.3-1-any.pkg.tar.xz +add: x86_64 youtube-dl-2014.01.28.1-1-any.pkg.tar.xz wait -checky: any/ydcv-0.3-1-any.pkg.tar.xz -checky: i686/ydcv-0.3-1-any.pkg.tar.xz -checky: x86_64/ydcv-0.3-1-any.pkg.tar.xz -checkp: x86_64 ydcv=0.3-1 -checkp: i686 ydcv=0.3-1 +checky: any/youtube-dl-2014.01.28.1-1-any.pkg.tar.xz +checky: i686/youtube-dl-2014.01.28.1-1-any.pkg.tar.xz +checky: x86_64/youtube-dl-2014.01.28.1-1-any.pkg.tar.xz +checkp: x86_64 youtube-dl=2014.01.28.1-1 +checkp: i686 youtube-dl=2014.01.28.1-1 # update a package -add: any ydcv-0.3.2-1-any.pkg.tar.xz +add: any youtube-dl-2014.01.29-1-any.pkg.tar.xz wait -checky: any/ydcv-0.3.2-1-any.pkg.tar.xz -checky: i686/ydcv-0.3.2-1-any.pkg.tar.xz -checky: x86_64/ydcv-0.3.2-1-any.pkg.tar.xz -checkp: x86_64 ydcv=0.3.2-1 -checkp: i686 ydcv=0.3.2-1 +checky: any/youtube-dl-2014.01.29-1-any.pkg.tar.xz +checky: i686/youtube-dl-2014.01.29-1-any.pkg.tar.xz +checky: x86_64/youtube-dl-2014.01.29-1-any.pkg.tar.xz +checkp: x86_64 youtube-dl=2014.01.29-1 +checkp: i686 youtube-dl=2014.01.29-1 # downgrade and remove -add: i686 ydcv-0.3.1-1-any.pkg.tar.xz -remove: any ydcv-0.3-1-any.pkg.tar.xz +add: x86_64 youtube-dl-2014.01.29-1-any.pkg.tar.xz +remove: any youtube-dl-2014.01.28.1-1-any.pkg.tar.xz wait -checkn: any/ydcv-0.3-1-any.pkg.tar.xz -checkn: i686/ydcv-0.3-1-any.pkg.tar.xz -checkn: x86_64/ydcv-0.3-1-any.pkg.tar.xz -checkp: x86_64 ydcv=0.3.1-1 -checkp: i686 ydcv=0.3.1-1 +checkn: any/youtube-dl-2014.01.28.1-1-any.pkg.tar.xz +checkn: i686/youtube-dl-2014.01.28.1-1-any.pkg.tar.xz +checkn: x86_64/youtube-dl-2014.01.28.1-1-any.pkg.tar.xz +checkp: x86_64 youtube-dl=2014.01.29-1 +checkp: i686 youtube-dl=2014.01.29-1 # completely remove packages -remove: any ydcv-0.3.1-1-any.pkg.tar.xz -remove: i686 zip-3.0-3-i686.pkg.tar.xz +remove: any youtube-dl-2014.01.29-1-any.pkg.tar.xz +remove: x86_64 zip-3.0-3-x86_64.pkg.tar.xz wait -checkn: any/ydcv-0.3.1-1-any.pkg.tar.xz -checkn: i686/ydcv-0.3.1-1-any.pkg.tar.xz -checkn: x86_64/ydcv-0.3.1-1-any.pkg.tar.xz -checkp: x86_64 ydcv=null -checkp: i686 ydcv=null -checkp: any ydcv=null +checkn: any/youtube-dl-2014.01.29-1-any.pkg.tar.xz +checkn: i686/youtube-dl-2014.01.29-1-any.pkg.tar.xz +checkn: x86_64/youtube-dl-2014.01.29-1-any.pkg.tar.xz +checkp: x86_64 youtube-dl=null +checkp: i686 youtube-dl=null +checkp: any youtube-dl=null checkp: i686 zip=null -checkp: x86_64 zip=3.0-3 +checkp: x86_64 zip=null + +# add then, while adding, remove it +# look at the log carefully! +add: x86_64 linux-3.12.8-1-x86_64.pkg.tar.xz +racing-wait +remove: x86_64 linux-3.12.8-1-x86_64.pkg.tar.xz +wait +checkn: x86_64/linux-3.12.8-1-x86_64.pkg.tar.xz +checkp: x86_64 linux=null diff --git a/test/repomon_test.py b/test/repomon_test.py index 266eb83..2e3196d 100755 --- a/test/repomon_test.py +++ b/test/repomon_test.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# vim:fileencoding=utf-8 import os import sys @@ -26,6 +25,13 @@ class WaitCommand(Command): logging.info('waiting for %d seconds...', t) time.sleep(t) +class RacingWaitCommand(Command): + cmd = 'racing-wait' + def run(self): + t = self.ctx['wait_time'] + 0.3 + logging.info('Racing-waiting for %s seconds...', t) + time.sleep(t) + class BaseDirCommand(Command): cmd = 'base_dir' def run(self): @@ -110,6 +116,9 @@ def run_action_file(conf, actlines): cmd = cmd.rstrip(':') try: cmdmap[cmd](ctx, args) + except KeyboardInterrupt: + logging.info('Interrupted.') + break except: logging.error('error running action: %s', l, exc_info=True) logging.info('done running action file.') @@ -119,10 +128,8 @@ class Server: self.conffile = conffile def start(self): - server_path = os.path.join('.', os.path.normpath(os.path.join(__file__, '../../archreposrv'))) - logging.debug('server path: %s', server_path) logging.info('starting server...') - self.p = subprocess.Popen([server_path, self.conffile]) + self.p = subprocess.Popen(['archreposrv', self.conffile]) def stop(self): logging.info('quitting server...')