summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/02-commands-config.yarn91
-rw-r--r--testing/gitano-test-tool.in34
-rw-r--r--testing/keys/alice@main_rsa27
-rw-r--r--testing/keys/alice@main_rsa.pub1
-rw-r--r--testing/keys/testinstance@adminkey_rsa27
-rw-r--r--testing/keys/testinstance@adminkey_rsa.pub1
-rw-r--r--testing/keys/testinstance@other_rsa27
-rw-r--r--testing/keys/testinstance@other_rsa.pub1
-rw-r--r--testing/library.yarn8
9 files changed, 211 insertions, 6 deletions
diff --git a/testing/02-commands-config.yarn b/testing/02-commands-config.yarn
index f282cb0..fb8f61f 100644
--- a/testing/02-commands-config.yarn
+++ b/testing/02-commands-config.yarn
@@ -1 +1,92 @@
<!-- -*- markdown -*- -->
+config ---- View and change configuration for a repository (Takes a repo)
+=========================================================================
+
+The `config` command allows the repository's configuration file (clod) to be
+queried and updated from the command line without cloning, editing, and pushing
+the `refs/gitano/admin` branch.
+
+Initially there are three configuration values set for a project, namely that
+of its owner, description and `HEAD` reference. We can check these out
+directly, allowing us to verify the initial configuration. However, the config
+stored is a generic clod configuration so we should also verify everything we
+can about the behaviour from there.
+
+Viewing initial `config` for a repo
+-----------------------------------
+
+Initially configuration for owner, description and `HEAD` are supplied to a
+repository when created. `HEAD` is defaulted to `refs/heads/master` but the
+owner can be set via the person running the create.
+
+ SCENARIO Viewing initial `config` for a repo
+
+ GIVEN a standard instance
+ WHEN testinstance adminkey runs create testrepo
+ AND testinstance adminkey runs config testrepo show
+ THEN stderr is empty
+ AND stdout contains project.owner: admin
+ AND stdout contains project.head: refs/heads/master
+
+Configuration changes stick
+---------------------------
+
+When setting configuration variables we expect those values to stick. As such
+we configure a test repository with a value which is not default and then check
+for it.
+
+ SCENARIO Configuration changes stick
+
+ GIVEN a standard instance
+ WHEN testinstance adminkey runs create testrepo
+ AND testinstance adminkey runs config testrepo set project.head refs/heads/trunk
+ AND testinstance adminkey runs config testrepo show
+ THEN stderr is empty
+ AND stdout contains project.head: refs/heads/trunk
+
+Changes to `HEAD` and description hit the filesystem
+----------------------------------------------------
+
+Since the project's description affects things outside of Gitano, verify that
+when changing configuration, all relevant hook sections are run to update the
+outside world.
+
+ SCENARIO Changes to `HEAD` and description hit the filesystem
+
+ GIVEN a standard instance
+ WHEN testinstance adminkey runs create testrepo
+ AND testinstance adminkey runs config testrepo set project.head refs/heads/trunk
+ AND testinstance adminkey runs config testrepo set project.description foobar
+ THEN server-side testrepo.git file description contains foobar
+ AND server-side testrepo.git file HEAD contains refs/heads/trunk
+
+Manipulating list values is possible
+------------------------------------
+
+Clod can contain lists in values. Lists are always one-level and can have
+new items appended...
+
+ SCENARIO Manipulating list values is possible
+
+ GIVEN a standard instance
+ WHEN testinstance adminkey runs create testrepo
+ AND testinstance adminkey runs config testrepo set foo.* hello
+ AND testinstance adminkey runs config testrepo set foo.* world
+ AND testinstance adminkey runs config testrepo show
+ THEN stderr is empty
+ AND stdout contains foo.i_1: hello
+ AND stdout contains foo.i_2: world
+
+...and removed in any order...
+
+ WHEN testinstance adminkey runs config testrepo rm foo.i_1
+ AND testinstance adminkey runs config testrepo show
+ THEN stderr is empty
+ AND stdout contains foo.i_1: world
+
+ WHEN testinstance adminkey runs config testrepo rm foo.i_1
+ AND testinstance adminkey runs config testrepo show
+ THEN stderr is empty
+ AND stdout does not contain foo.i_
+
+FIXME: Once we have ruleset control, add more here perhaps
diff --git a/testing/gitano-test-tool.in b/testing/gitano-test-tool.in
index 8436dd6..e892474 100644
--- a/testing/gitano-test-tool.in
+++ b/testing/gitano-test-tool.in
@@ -109,12 +109,28 @@ end
function cmd_createsshkey(username, keyname, optionaltype)
optionaltype = optionaltype or "rsa"
- run_program {
- "ssh-keygen", "-q",
- "-t", optionaltype,
- "-C", username .. "-" .. optionaltype .. "@" .. keyname,
- "-f", ssh_key_file(username, keyname),
- "-N", "" }
+ local targetkey = ssh_key_file(username, keyname)
+ local sourcekey = table.concat {
+ "testing/keys/", username, "@", keyname, "_", optionaltype }
+ local fh = io.open(sourcekey, "r")
+ if not fh then
+ run_program {
+ "ssh-keygen", "-q",
+ "-t", optionaltype,
+ "-C", username .. "-" .. optionaltype .. "@" .. keyname,
+ "-f", sourcekey,
+ "-N", "" }
+ fh = assert(io.open(sourcekey, "r"))
+ end
+ local ofh = assert(io.open(targetkey, "w"))
+ ofh:write(fh:read("*a"))
+ fh:close()
+ ofh:close()
+ fh = assert(io.open(sourcekey .. ".pub", "r"))
+ ofh = assert(io.open(targetkey .. ".pub", "w"))
+ ofh:write(fh:read("*a"))
+ fh:close()
+ ofh:close()
end
function cmd_setupstandard(owning_user, master_key)
@@ -122,6 +138,7 @@ function cmd_setupstandard(owning_user, master_key)
local fh = io.open(clodname, "w")
fh:write('setup.batch "true"\n')
fh:write(('paths.pubkey %q\n'):format(ssh_key_file(owning_user, master_key) .. ".pub"))
+ fh:write(('paths.repos %q\n'):format(user_home(owning_user) .. "/repos"))
fh:write('site.name "Gitano Test Instance"\n')
fh:write('log.prefix "gitano-test"\n')
fh:write(('admin.keyname %q\n'):format(master_key))
@@ -174,6 +191,11 @@ function cmd_findtoken()
print(token)
end
+function cmd_serverlocation(repo)
+ local h = user_home("testinstance")
+ print(table.concat({h, "repos", repo}, "/"))
+end
+
local cmd = table.remove(argv, 1)
if _G['cmd_' .. cmd] then
_G['cmd_' .. cmd](unpack(argv))
diff --git a/testing/keys/alice@main_rsa b/testing/keys/alice@main_rsa
new file mode 100644
index 0000000..2533124
--- /dev/null
+++ b/testing/keys/alice@main_rsa
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEArgw+4pBPFz7BVbdBtdkKo9TZ3fjnEu8pn+FLp5UpYiQJpIIG
+DG5wDxZAb/ZrP2gL+Ay3vW9UDrRYoC80fCXpxZ5iqz+EEFj1jtrJJEGqR19oByNk
+/CCcb9dmiFwvI9Spd5iC2HXqV8JoCX4cziyo349FB55ljuk+ZOLRTn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STZzkFVgJ8ibJ3P6khECgYB1SmRZJElN0v8SfDD0Ku8IVqzhuJ+bPdc3ePWI
+nUY+Ossmz2vtsBk5Mbdg6wzbfS95RwEdEDe6OwT+itg8YwzqjAKxU0yxSfh1DDLh
+E22/KmDTB3RHZdYG5zMVyIt3I2grmaGG3JcPIa1DzjmqyMAN37yHubMRF8faDNOY
+MWsHgQKBgERVOwB/shfQhMN3peXezA/fcIfKUknDgGkduNAVXgstvc1LgISca7qZ
+WClUv2exSE9+8BVpliLUE2PuV07+o0mH8vlRSAAIanHC/N2uBakTHQL9FiM3h49y
+uNPjUaAOejKbpcRv+4a19nAuVDUOTGMqLvU6gm+ZCAUSwtAqHoAW
+-----END RSA PRIVATE KEY-----
diff --git a/testing/keys/alice@main_rsa.pub b/testing/keys/alice@main_rsa.pub
new file mode 100644
index 0000000..68707f5
--- /dev/null
+++ b/testing/keys/alice@main_rsa.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuDD7ikE8XPsFVt0G12Qqj1Nnd+OcS7ymf4UunlSliJAmkggYMbnAPFkBv9ms/aAv4DLe9b1QOtFigLzR8JenFnmKrP4QQWPWO2skkQapHX2gHI2T8IJxv12aIXC8j1Kl3mILYdepXwmgJfhzOLKjfj0UHnmWO6T5k4tFOf11FtTR8lTdbgYWlOY1jmMEBvZ898MUcS5DYKXOUIOZGruaF2dSoXv8gVyij0OidaeXkY7OAbNcqvZ/NVXxxhmYA7V89D84MuqfLWIRjFxwNYwl8kyxQwd48rBLscye2mDIgEsW7PHLBUKvTXjUiqfmefxRHFoxNPrrfWjrGzY+IxZKf alice-rsa@main
diff --git a/testing/keys/testinstance@adminkey_rsa b/testing/keys/testinstance@adminkey_rsa
new file mode 100644
index 0000000..4bca3a1
--- /dev/null
+++ b/testing/keys/testinstance@adminkey_rsa
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEAuIyfjWjhMBAiIcG4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ZaIGSYNa
+1Ey4Au0492Wk7f9ySui+lBU8d+jDbKVdJhwf3gXlUqVUgqElWN+QSU0BN5Wnr6S3
+EwGgzNBwgiuydxvmIa6JEyJBXO63rldraR/8g3Lorvt2dz7vrznUina5lw8JXWWu
+9F08KsaElIimyTWTZ3wMjhkCgYAz42sMhi/jqJZdoxeyFiJLuyiaa5VJIszSDBvp
+gMdJyz7jBjM0yhuo6bt3VcRFV8WLM/8IfcfifdJL5DLp5OAPSuvdJErPnrbqwiYQ
+oVTrXCHW6BNAFbEvbeWm5q3dbvzLwdx9cOnFk+W759ikF7Dp7DObouiqnchAgLIZ
+av7JXQKBgQC/ze3gpuceQqAdCuCuxm1HDRuHLYaUluHPaRTa58R9odwrp25+kQDx
+e7m40FOUtqWqKbc31W9g1wOCL/dL0v/7BBi/I1sejXKAym2ljG4ydLIqwtw7GaLS
+h0927YxoVeamLIFOrEXzGCyFdGPKuJsC494ybsNHLUtggr5hn7biIg==
+-----END RSA PRIVATE KEY-----
diff --git a/testing/keys/testinstance@adminkey_rsa.pub b/testing/keys/testinstance@adminkey_rsa.pub
new file mode 100644
index 0000000..95705b0
--- /dev/null
+++ b/testing/keys/testinstance@adminkey_rsa.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4jJ+NaOEwECIhwbhm+xXzoS5aL3bXfbV74Xm9B284HPJRCv9HQ9f/n3w1fgD/HqTsNEt7FsD1Ba7pCAT6zsssJD1hfZ8e16dQc9FVbXfZjs3Dn+wB3EWQigmSjal6oWr6U9Dh9zpRLVAvSLmmOPRxXKTDbvLwpwXeh5vgxXBs90SG7v65Z6FRQ7RKUzzjpAKvUn7U8lW1oZddgI5p3AfAkoXLmL5IQcN6JNzp4uIDY+W9ObWjo6bjl9wjL/HNpuxGjSEgWD7ga3za+XecWCHqgi+3C82hh6vC++t/b/Z6cqZSvTNYAPOFaIr9RVWSeAdJx7k/fd2fhaQHZnJe18YP testinstance-rsa@adminkey
diff --git a/testing/keys/testinstance@other_rsa b/testing/keys/testinstance@other_rsa
new file mode 100644
index 0000000..32e9cdf
--- /dev/null
+++ b/testing/keys/testinstance@other_rsa
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEA18K3qYsgwrEcTJfeY82Ww0jSMl1v1KDhw41CI6/EwPpk160S
+AhPdxpuzTg24Anx+J/b+VdhrQhbXPJFlH3vGSygde7DVBbFHGmGb/h7cFz7Rg4O/
+xkLqUbTDX9tP0V3u2C/sEONXqTaSiiiCb7+E/aS6vf34GsiPMT9UXMWE7ZIiEZIq
+zz2T4b9GM13NR3+jbCOVbQgCiEvylG8GIuska5OTG2e/s1IgMcKvpWXpp9sCk0Oq
+6WAjaI7kgbHE9TqhwA2ADfpPS8xvBKmwGnpcp7qfdLwvPlV6NrFo6o0Atc764khz
+EYOQP1iDXKvurNsGr9YJyc/j6gYIuCBquOjCuwIDAQABAoIBAQCyjw3qPR7eoS6X
+YLQGipUzhmeWkOdE4+QTLytGV2eQgWjFaRDXMVO/0wlgFlBrllXdgzZXGyUg68Ay
++uziUk/30PodbGnPLTh358HuW+GvRyijG3yxep1rAxsRkHGNBpzswzQtgcgBXQ2H
+UyEnlCtesl5tb+pNWB/RFOUfZcOty1ZryV6JJ5JFkiXsujaA69pSGBjpm/cjMP2y
+KSOUxQkS4NZzDAKuQsnehyHKa1+7bp0lXFXU3ZWr/7KkrCjczTdD/F26nZuxbFX6
+8PC+h4lG0fx/nGlqdg/7g75x8htJHKpv4tcwQy7APbRp9HSoRRdcIv9LqzpSs/KW
+71LfubUBAoGBAO00zZDy9YPlsIAr/Wu4je+HNXDmDLltD4Y6UvkUQwbT3WdblG8h
+38jTUcGDVFCuo4ulPuqihOGdK+zj8E9yVQUwVDsz2nKyMaBEIgsACl0yc7glN6Gl
+WDE9H9XycNxub8WEEs0VNmG4PxOhaX36TZSEm1rsQbJkUtgaSjkS/2aBAoGBAOja
+8AYS8sUC1DbuseA+Q1k7deLHWWFmTX3L5pVykTlmERnDCGvHHtzAJ7PFp5NcwDvn
+7W20JsK+KMo3n+4fTwmovKK7wkpdMpx1eiR2JDujAg98Eg37nxqzpcHSVT0fvPNG
+jmOj8Nza6lis/wkOc918q+yCs7GveI05V9IlyKM7AoGAVoAp8pDW/VlWavcfvBea
+Et4wm9IYk8n0nlNIjLJZ2vSJybY4w+oLbHW7W6EjryRwWW1SK0hGwuuI6CMbMC2W
+WYUNQmWfZLIcrMAL1g0WunO6hU11IwpjxdjvchquE4RmWBXYsVbp9Oq2fdcf3CPa
+BK3y5U5AiuhQ2aOEq5mE74ECgYEAhdXwx0z0xE+P8dLX4e9nfk4yv5mcweKu/3LG
+oXcsCTWk9o2mtWvJTVAUgbtFSemxg70WNkupS51IjJHUFmVgZEjbwxzv2xYeFNdg
+0LwmrzBN6uCA8BCDrjE7QF/IJk2rqJgRFywPMKGSuE0WePoZlmAl4NZuud4FCAbB
+d0PIQikCgYAOH6SeG4MB2cvtragsS/p2gw+ItTbMh4hiGZePcS3iAIDSPKHt3ixn
+PwK7pklW8bkkUGrRI7qCHfEC5kAyoV+u1U63CH+/HE3SAtpEevGtFROSrVUNZ1o6
+FcgKw4NB/vy0PVVPBx3onJGEjac0HIwcTG5du1+m3v8DVBhvATssOw==
+-----END RSA PRIVATE KEY-----
diff --git a/testing/keys/testinstance@other_rsa.pub b/testing/keys/testinstance@other_rsa.pub
new file mode 100644
index 0000000..33bb3f8
--- /dev/null
+++ b/testing/keys/testinstance@other_rsa.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXwrepiyDCsRxMl95jzZbDSNIyXW/UoOHDjUIjr8TA+mTXrRICE93Gm7NODbgCfH4n9v5V2GtCFtc8kWUfe8ZLKB17sNUFsUcaYZv+HtwXPtGDg7/GQupRtMNf20/RXe7YL+wQ41epNpKKKIJvv4T9pLq9/fgayI8xP1RcxYTtkiIRkirPPZPhv0YzXc1Hf6NsI5VtCAKIS/KUbwYi6yRrk5MbZ7+zUiAxwq+lZemn2wKTQ6rpYCNojuSBscT1OqHADYAN+k9LzG8EqbAaelynup90vC8+VXo2sWjqjQC1zvriSHMRg5A/WINcq+6s2wav1gnJz+PqBgi4IGq46MK7 testinstance-rsa@other
diff --git a/testing/library.yarn b/testing/library.yarn
index c49021e..89e8da1 100644
--- a/testing/library.yarn
+++ b/testing/library.yarn
@@ -37,6 +37,14 @@ Repository access
IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? clones ([^ ]+) as ([^ ]+)
$GTT cloneviassh $MATCH_1 $MATCH_2 "$MATCH_3" "$MATCH_4"
+Server-side repository checking for behind-the-scenes work
+----------------------------------------------------------
+
+ IMPLEMENTS THEN server-side ([^ ]+) file ([^ ]+) contains (.+)
+ cd "$($GTT serverlocation $MATCH_1)"
+ grep -q "$MATCH_3" "$MATCH_2"
+
+
Clone manipulation
------------------