summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2017-03-04 11:11:35 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2017-03-04 16:48:58 +0000
commitc52e58bfaf84662c004c390c9a2fa800e3e5078a (patch)
treece103e7fcd46f262abe2abb3aec3621886df5562 /testing
parent00b36703facf94642868ab8dea4785d4e162f3bc (diff)
downloadgitano-c52e58bfaf84662c004c390c9a2fa800e3e5078a.tar.gz
adds a test covering the rest of treediff/*
Diffstat (limited to 'testing')
-rw-r--r--testing/03-treedelta-rules.yarn77
-rw-r--r--testing/admin-patches/must-add-FOO.patch13
-rw-r--r--testing/admin-patches/must-modify-FOO.patch13
-rw-r--r--testing/admin-patches/must-remove-FOO.patch13
-rw-r--r--testing/admin-patches/must-rename-from-FOO.patch13
-rw-r--r--testing/admin-patches/must-rename-to-FOO.patch13
6 files changed, 142 insertions, 0 deletions
diff --git a/testing/03-treedelta-rules.yarn b/testing/03-treedelta-rules.yarn
index f96524e..fada9ff 100644
--- a/testing/03-treedelta-rules.yarn
+++ b/testing/03-treedelta-rules.yarn
@@ -169,3 +169,80 @@ and finally we ensure that renaming it *back* works too...
THEN the output contains master -> master
FINALLY the instance is torn down
+
+Now that we know that `treediff/targets` works in all cases, we ensure that
+the particular `treediff/*` element is also populated for the given activity
+
+ SCENARIO any change must affect FOO with specificity
+ GIVEN a standard instance
+ AND 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
+
+ GIVEN testinstance using adminkey has patched gitano-admin with must-add-FOO.patch
+
+First up, when we try an empty commit we can't push it...
+
+ WHEN alice, using main, expecting failure, pushes an empty commit in testrepo
+ THEN stderr contains Needs a FOO
+
+Next, when a FOO is added, it should turn up in `treediff/added`
+
+ WHEN alice applies add-a-FOO.patch in testrepo
+ AND alice, using main, pushes testrepo to testrepo.git
+ THEN the output contains new branch
+
+But its mere presence in `start_tree` shouldn't allow empty commits...
+
+ WHEN alice, using main, expecting failure, pushes an empty commit in testrepo
+ THEN stderr contains Needs a FOO
+
+Now we verify that altering the content turns up in `treediff/modified`
+
+ GIVEN testinstance using adminkey has patched gitano-admin with the reverse of must-add-FOO.patch
+ AND testinstance using adminkey has patched gitano-admin with must-modify-FOO.patch
+
+ WHEN alice applies change-a-FOO.patch in testrepo
+ AND alice, using main, pushes testrepo to testrepo.git
+ THEN the output contains master -> master
+
+Next, when the FOO gets removed, it should show in `treediff/deleted`
+
+ GIVEN testinstance using adminkey has patched gitano-admin with the reverse of must-modify-FOO.patch
+ AND testinstance using adminkey has patched gitano-admin with must-remove-FOO.patch
+
+ WHEN alice reverts change-a-FOO.patch in testrepo
+ AND alice reverts add-a-FOO.patch in testrepo
+ AND alice, using main, pushes testrepo to testrepo.git
+ THEN the output contains master -> master
+
+Next we need to rename a FOO, to do that, first add it back...
+
+ GIVEN testinstance using adminkey has patched gitano-admin with the reverse of must-remove-FOO.patch
+
+ WHEN alice applies add-a-FOO.patch in testrepo
+ AND alice, using main, pushes testrepo to testrepo.git
+ THEN the output contains master -> master
+
+and then check that renaming the FOO causes it to turn up in `treediff/renamed`
+
+ GIVEN testinstance using adminkey has patched gitano-admin with must-rename-from-FOO.patch
+
+ WHEN alice applies rename-a-FOO.patch in testrepo
+ AND alice, using main, pushes testrepo to testrepo.git
+ THEN the output contains master -> master
+
+and finally we ensure that renaming it *back* works too...
+
+ GIVEN testinstance using adminkey has patched gitano-admin with the reverse of must-rename-from-FOO.patch
+ AND testinstance using adminkey has patched gitano-admin with must-rename-to-FOO.patch
+
+ WHEN alice reverts rename-a-FOO.patch in testrepo
+ AND alice, using main, pushes testrepo to testrepo.git
+ THEN the output contains master -> master
+
+ FINALLY the instance is torn down
diff --git a/testing/admin-patches/must-add-FOO.patch b/testing/admin-patches/must-add-FOO.patch
new file mode 100644
index 0000000..845f864
--- /dev/null
+++ b/testing/admin-patches/must-add-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 "Needs a FOO" op_is_normal ![treediff/added 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/admin-patches/must-modify-FOO.patch b/testing/admin-patches/must-modify-FOO.patch
new file mode 100644
index 0000000..4dd35b7
--- /dev/null
+++ b/testing/admin-patches/must-modify-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 "Needs a FOO" op_is_normal ![treediff/modified 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/admin-patches/must-remove-FOO.patch b/testing/admin-patches/must-remove-FOO.patch
new file mode 100644
index 0000000..e21aa73
--- /dev/null
+++ b/testing/admin-patches/must-remove-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 "Needs a FOO" op_is_normal ![treediff/deleted 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/admin-patches/must-rename-from-FOO.patch b/testing/admin-patches/must-rename-from-FOO.patch
new file mode 100644
index 0000000..121ebde
--- /dev/null
+++ b/testing/admin-patches/must-rename-from-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 "Needs a FOO" op_is_normal ![treediff/renamed 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/admin-patches/must-rename-to-FOO.patch b/testing/admin-patches/must-rename-to-FOO.patch
new file mode 100644
index 0000000..5566474
--- /dev/null
+++ b/testing/admin-patches/must-rename-to-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 "Needs a FOO" op_is_normal ![treediff/renamedto 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