diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-02-12 14:20:47 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-02-12 14:20:47 +0000 |
commit | 5ab106a7e6a3b4d0ff46bab75524553455c2485e (patch) | |
tree | c8e54b091a2c3bfa17da96312fe797e62ae8df51 /testing | |
parent | 6380cd5f376453b7c61100b2ca8fd173471b72a1 (diff) | |
download | gitano-5ab106a7e6a3b4d0ff46bab75524553455c2485e.tar.gz |
adds an initial treedelta test
Diffstat (limited to 'testing')
-rw-r--r-- | testing/03-treedelta-rules.yarn | 34 | ||||
-rw-r--r-- | testing/admin-patches/no-create-FOO.patch | 13 | ||||
-rw-r--r-- | testing/content-patches/add-a-FOO.patch | 7 |
3 files changed, 54 insertions, 0 deletions
diff --git a/testing/03-treedelta-rules.yarn b/testing/03-treedelta-rules.yarn new file mode 100644 index 0000000..e7c0def --- /dev/null +++ b/testing/03-treedelta-rules.yarn @@ -0,0 +1,34 @@ +<!-- -*- markdown -*- --> + +Using the tree deltas in rules +============================== + +Gitano is able to use the tree deltas produced by changes in ref tips when +evaluating whether or not an update is permitted. Since the tree deltas can be +expensive to generate, we only trigger generation of them on demand. As such +they are an area of the code where errors could easily trickle in unless we +keep a close eye on things. + +Start and Target trees +---------------------- + +The first part of the treedelta support are the gitano/starttree and +gitano/targetttee lists. These contain the flattened entry names for +everything in the trees. + + SCENARIO may not create files called FOO + GIVEN a standard instance + AND testinstance using adminkey has patched gitano-admin with no-create-FOO.patch + GIVEN a unix user called alice + AND alice has keys called main + + WHEN testinstance, using adminkey, adds user alice, using alice main + AND testinstance adminkey runs create testrepo alice + AND alice, using main, clones testrepo as testrepo + THEN alice testrepo has no file called FOO + + WHEN alice applies add-a-FOO.patch in testrepo + AND alice, using main, expecting failure, pushes testrepo to testrepo.git + THEN stderr contains No FOOs allowed + + FINALLY the instance is torn down diff --git a/testing/admin-patches/no-create-FOO.patch b/testing/admin-patches/no-create-FOO.patch new file mode 100644 index 0000000..b5d79a4 --- /dev/null +++ b/testing/admin-patches/no-create-FOO.patch @@ -0,0 +1,13 @@ +diff --git a/rules/project.lace b/rules/project.lace +index aafa17c..388766a 100644 +--- a/rules/project.lace ++++ b/rules/project.lace +@@ -43,6 +43,8 @@ include global:remoteconfigchecks op_is_config + # Okay, if we're altering the admin ref, in we go + include global:adminchecks is_admin_ref + ++deny "No FOOs allowed" op_is_normal [target_tree is FOO] ++ + # Now we're into branch operations. Owners can do any normal operation + # Normal ops are create/delete/fastforward on refs + allow "Owners can create refs" op_is_normal is_owner diff --git a/testing/content-patches/add-a-FOO.patch b/testing/content-patches/add-a-FOO.patch new file mode 100644 index 0000000..bb7d8a8 --- /dev/null +++ b/testing/content-patches/add-a-FOO.patch @@ -0,0 +1,7 @@ +diff --git a/FOO b/FOO +new file mode 100644 +index 0000000..ee5a5f2 +--- /dev/null ++++ b/FOO +@@ -0,0 +1 @@ ++This is a FOO |