dev/chroot-test/action/test1
author Paul Crowley <paul@lshift.net>
Fri, 17 Dec 2010 18:19:31 +0000
changeset 273 7bae88583a53
parent 272 f7c64f03cd60
child 275 2e781d52f76e
permissions -rwxr-xr-x
Merge in testing code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
266
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     1
#!/bin/sh
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     2
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     3
set -e
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     4
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     5
cd
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     6
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     7
cat > .ssh/config <<__END__
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     8
Host chroothg
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     9
Hostname localhost
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    10
User hg
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    11
Port 2222
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    12
__END__
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    13
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    14
echo "Cloning hgadmin..."
266
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    15
hg clone ssh://chroothg/hgadmin
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    16
echo "Updating hgadmin..."
266
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    17
cd hgadmin
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    18
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    19
cat > access.conf <<__END__
270
28b355b7390e Change rules to test the hard case
Paul Crowley <paul@lshift.net>
parents: 269
diff changeset
    20
read user=restricted/** file=denied/**
28b355b7390e Change rules to test the hard case
Paul Crowley <paul@lshift.net>
parents: 269
diff changeset
    21
write user=restricted/**
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    22
__END__
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    23
mkdir -p keys/restricted
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    24
cp /home/test2/.ssh/id_rsa.pub keys/restricted/test2
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    25
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    26
hg add keys/restricted/test2 access.conf
266
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    27
hg commit -u test1 -m "Added user test2"
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    28
echo "Push"
266
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    29
hg push
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    30
cd ..
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    31
mkdir realrepo
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    32
cd realrepo
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    33
hg init .
270
28b355b7390e Change rules to test the hard case
Paul Crowley <paul@lshift.net>
parents: 269
diff changeset
    34
mkdir denied
28b355b7390e Change rules to test the hard case
Paul Crowley <paul@lshift.net>
parents: 269
diff changeset
    35
echo "This is a file" > content
28b355b7390e Change rules to test the hard case
Paul Crowley <paul@lshift.net>
parents: 269
diff changeset
    36
echo "This is a file not everyone can write to" > denied/cantwrite
28b355b7390e Change rules to test the hard case
Paul Crowley <paul@lshift.net>
parents: 269
diff changeset
    37
hg add content denied/cantwrite
269
a09f1bc9a6cf Change back to non-Debian testing, fix test to work around NULL problem
Paul Crowley <paul@lshift.net>
parents: 268
diff changeset
    38
hg commit -u test1 -m "Add files to the repo"
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    39
echo "Pushing changes"
266
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    40
hg clone . ssh://chroothg/real/project
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    41
echo "Done for user test1"