summaryrefslogtreecommitdiff
path: root/tests/ovsdb-log.at
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2017-12-24 11:43:59 -0800
committerBen Pfaff <blp@ovn.org>2017-12-24 11:43:59 -0800
commit19b276cb4423b0cd723821eea0e91061080c76e5 (patch)
tree1aab323854667c7f55f0e6a910684cd225fa18d0 /tests/ovsdb-log.at
parent09de8591d28ef596e1c62cf0b6a2d6e6a8988e1e (diff)
downloadopenvswitch-19b276cb4423b0cd723821eea0e91061080c76e5.tar.gz
log: Allow client to specify magic.
Until now, the logging code in ovsdb has only supported a single file format, for OVSDB standalone database files. Upcoming commits will add support for another, incompatible format, which uses a different magic string for identification. This commit allows the logging code to support both formats. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
Diffstat (limited to 'tests/ovsdb-log.at')
-rw-r--r--tests/ovsdb-log.at27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ovsdb-log.at b/tests/ovsdb-log.at
index 3e7cdf828..c8efaaec1 100644
--- a/tests/ovsdb-log.at
+++ b/tests/ovsdb-log.at
@@ -73,6 +73,33 @@ file: read: end of log
AT_CHECK([test -f .file.~lock~])
AT_CLEANUP
+AT_SETUP([write one, reread - alternative magic])
+AT_KEYWORDS([ovsdb log])
+AT_CAPTURE_FILE([file])
+# Sometimes you just need more magic:
+# http://www.catb.org/jargon/html/magic-story.html
+AT_CHECK(
+ [[test-ovsdb --magic="MORE MAGIC" log-io file create 'write:[0]' 'write:[1]' 'write:[2]']], [0],
+ [[file: open successful
+file: write:[0] successful
+file: write:[1] successful
+file: write:[2] successful
+]], [ignore])
+AT_CHECK(
+ [test-ovsdb --magic="MORE MAGIC" log-io file read-only read read read read], [0],
+ [[file: open successful
+file: read: [0]
+file: read: [1]
+file: read: [2]
+file: read: end of log
+]], [ignore])
+AT_CHECK(
+ [test-ovsdb log-io file read-only], [1], [],
+ [test-ovsdb: ovsdb error: file: bad magic (unexpected kind of file)
+])
+AT_CHECK([test -f .file.~lock~])
+AT_CLEANUP
+
AT_SETUP([write one, reread, append])
AT_KEYWORDS([ovsdb log])
AT_CAPTURE_FILE([file])