aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/Makefile3
-rw-r--r--scripts/testbed.py30
2 files changed, 20 insertions, 13 deletions
diff --git a/scripts/Makefile b/scripts/Makefile
index d34bf46d..0d79fbbb 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -53,4 +53,5 @@ rpki/relaxng.py: left-right-schema.rng up-down-schema.rng make-relaxng.py
#test:: all ; sh -x rootd.sh run
-test:: all ; python testbed.py
+test:: all
+ python testbed.py -y testbed.1.yaml
diff --git a/scripts/testbed.py b/scripts/testbed.py
index 65b9b968..71fe3c67 100644
--- a/scripts/testbed.py
+++ b/scripts/testbed.py
@@ -8,7 +8,9 @@ Usage: python rpkid.py [ { -c | --config } config_file ]
[ { -h | --help } ]
[ { -y | --yaml } yaml_script ]
-Default configuration file is testbed.conf, override with --config option.
+Default config_file is testbed.conf, override with --config option.
+
+Default yaml_script is testbed.yaml, override with -yaml option.
yaml_script is a YAML file describing the tests to be run, and is
intended to be implementation agnostic.
@@ -27,7 +29,7 @@ cfg_file = "testbed.conf"
yaml_script = None
-opts,argv = getopt.getopt(sys.argv[1:], "c:hy?", ["config=", "help", "yaml"])
+opts,argv = getopt.getopt(sys.argv[1:], "c:hy:?", ["config=", "help", "yaml="])
for o,a in opts:
if o in ("-h", "--help", "-?"):
print __doc__
@@ -42,8 +44,18 @@ if argv:
cfg = rpki.config.parser(cfg_file, "testbed")
+# Load the YAML script early, so we can report errors ASAP
+
if yaml_script is None:
- yaml_script = cfg.get("yaml_script", "../testbed.1.yaml")
+ yaml_script = cfg.get("yaml_script", "testbed.yaml")
+
+try:
+ yaml_script = [y for y in yaml.safe_load_all(open(yaml_script))]
+except:
+ print __doc__
+ raise
+
+# Most filenames in the following are relative to the working directory.
testbed_name = cfg.get("testbed_name", "testbed")
testbed_dir = cfg.get("testbed_dir", testbed_name + ".dir")
@@ -93,9 +105,7 @@ def main():
subprocess.check_call(("rm", "-rf", "publication"))
- y = [y for y in yaml.safe_load_all(open(yaml_script))]
-
- db = allocation_db(y.pop(0))
+ db = allocation_db(yaml_script.pop(0))
# Construct biz keys and certs for this script to use
@@ -181,12 +191,12 @@ def main():
# If we've run out of deltas to apply, we're done
- if not y:
+ if not yaml_script:
break
# Apply next deltas and resync IRDBs
- db.apply_delta(y.pop(0))
+ db.apply_delta(yaml_script.pop(0))
for a in db.engines:
a.sync_sql()
@@ -757,7 +767,3 @@ rootd_fmt_3 = '''\
'''
main()
-
-# Local Variables:
-# compile-command: "python testbed.py"
-# End:
07' href='#n207'>207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250