dev/chroot-test/action/test1
author Paul Crowley <paul@lshift.net>
Sat, 18 Dec 2010 00:04:05 +0000
changeset 282 1239880543cf
parent 275 2e781d52f76e
child 302 020082c44cdf
permissions -rwxr-xr-x
Some improvements to the chroot test, try to make it work with Debian
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 ..
275
2e781d52f76e Subrepo support
Paul Crowley <paul@lshift.net>
parents: 272
diff changeset
    31
hg init realrepo
266
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    32
cd realrepo
270
28b355b7390e Change rules to test the hard case
Paul Crowley <paul@lshift.net>
parents: 269
diff changeset
    33
mkdir denied
28b355b7390e Change rules to test the hard case
Paul Crowley <paul@lshift.net>
parents: 269
diff changeset
    34
echo "This is a file" > content
28b355b7390e Change rules to test the hard case
Paul Crowley <paul@lshift.net>
parents: 269
diff changeset
    35
echo "This is a file not everyone can write to" > denied/cantwrite
275
2e781d52f76e Subrepo support
Paul Crowley <paul@lshift.net>
parents: 272
diff changeset
    36
hg init nested
2e781d52f76e Subrepo support
Paul Crowley <paul@lshift.net>
parents: 272
diff changeset
    37
echo "This is a file in a nested repo" > nested/content
2e781d52f76e Subrepo support
Paul Crowley <paul@lshift.net>
parents: 272
diff changeset
    38
hg add -R nested nested/content
2e781d52f76e Subrepo support
Paul Crowley <paul@lshift.net>
parents: 272
diff changeset
    39
hg commit -u test1 -R nested -m "Add files to the subrepo"
2e781d52f76e Subrepo support
Paul Crowley <paul@lshift.net>
parents: 272
diff changeset
    40
echo "nested = nested" > .hgsub
2e781d52f76e Subrepo support
Paul Crowley <paul@lshift.net>
parents: 272
diff changeset
    41
hg add content denied/cantwrite .hgsub
269
a09f1bc9a6cf Change back to non-Debian testing, fix test to work around NULL problem
Paul Crowley <paul@lshift.net>
parents: 268
diff changeset
    42
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
    43
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
    44
hg clone . ssh://chroothg/real/project
275
2e781d52f76e Subrepo support
Paul Crowley <paul@lshift.net>
parents: 272
diff changeset
    45
hg clone nested ssh://chroothg/real/project/nested
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    46
echo "Done for user test1"