From a17cdfe3eca1aa308809697ddc2c170a7cc6b501 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 27 Mar 2014 20:29:56 +0000 Subject: Convert unreadable-file cmdtest to yarn Doing this exposed a bug in yarn, which meant that the test needs a newer yarn to run. (Not yet released.) --- yarns/0030-basics.yarn | 19 +++++++++++++++++++ yarns/9000-implements.yarn | 33 +++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 12 deletions(-) (limited to 'yarns') diff --git a/yarns/0030-basics.yarn b/yarns/0030-basics.yarn index 936d3be8..0a04c98b 100644 --- a/yarns/0030-basics.yarn +++ b/yarns/0030-basics.yarn @@ -123,6 +123,25 @@ backup run. AND L, restored to X, matches manifest M +Backup when a file or directory is unreadable +--------------------------------------------- + +The backup shouldn't fail even if a file or directory is inaccessible. + + SCENARIO unreadable live data file + +We can't run this test as the `root` user, since then everything is +readable. + + ASSUMING not running as root + +Create some live data, and a file that is unreadable. + + GIVEN 1k of new data in directory L + AND file L/unreadable-file with permissions 000 + WHEN user U attempts to back up directory L to repository R + THEN the error message matches "RCE08AX.*L/unreadable-file" + Backup to roots at once ----------------------- diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn index 5591370f..26716143 100644 --- a/yarns/9000-implements.yarn +++ b/yarns/9000-implements.yarn @@ -1,4 +1,4 @@ -Test implementation + implementation =================== This chapter documents the generic, shared IMPLEMENTS sections for @@ -87,6 +87,12 @@ UTC format, as is common in Unix. os.utime(filename, (timestamp, timestamp)) ' +Create a file with given permissions. + + IMPLEMENTS GIVEN file (\S+) with permissions (\S+) + touch "$DATADIR/$MATCH_1" + chmod "$MATCH_2" "$DATADIR/$MATCH_1" + We need to manipulate extended attributes. IMPLEMENTS GIVEN file (\S+) has extended attribute (\S+) set to (\S+) @@ -213,6 +219,13 @@ addition to backing up, this makes a manifest of the data. IMPLEMENTS WHEN user (\S+) backs up directory (\S+) to repository (\S+) run_obnam "$MATCH_1" backup -r "$DATADIR/$MATCH_3" "$DATADIR/$MATCH_2" +A test may make a backup fail. Run without failing the test so the +failure may be inspected. + + IMPLEMENTS WHEN user (\S+) attempts to back up directory (\S+) to repository (\S+) + attempt run_obnam "$MATCH_1" \ + backup -r "$DATADIR/$MATCH_3" "$DATADIR/$MATCH_2" + We may also need to backup two directories at once. IMPLEMENTS WHEN user (\S+) backs up directories (\S+) and (\S+) to repository (\S+) @@ -256,15 +269,6 @@ that is unpredictable. run_obnam "$client" restore -r "$repo" \ --to "$to" --generation "$id" -We want to match the stdout against a regular expression. - - IMPLEMENTS THEN the output matches "(.+)" - echo ----------------------- - echo stdout being matched: - cat "$DATADIR/attempt.stdout" - echo ----------------------- - attempt_matches stdout "$MATCH_1" - We may also need to attempt a restore in a situation when we expect it to fail. @@ -550,8 +554,13 @@ by the user. IMPLEMENTS WHEN user (\S+) reads file (\S+) cat "$DATADIR/$MATCH_2" -Check on user group membership ------------------------------- +Check on user running test suite +-------------------------------- + +Some tests won't work correctly when `root` is running them. + + IMPLEMENTS ASSUMING not running as root + test "$(id -u)" != 0 Some tests, such as those for the FUSE plugin, require the user to be in a specific group. -- cgit v1.2.1