~ubuntu-branches/ubuntu/trusty/kstart/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/k5start/afs-t.in

  • Committer: Bazaar Package Importer
  • Author(s): Russ Allbery
  • Date: 2008-04-23 14:25:55 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080423142555-5vrmy64hjq4w54wh
Tags: 3.12-1
* New upstream release.
  - krenew now copies the ticket cache when running a command.
  - Fix command-line parsing problems in k4start and k5start.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
# $Id: afs-t.in 4094 2008-04-10 23:35:48Z rra $
 
3
#
 
4
# Tests for k5start with AFS.
 
5
#
 
6
# Written by Russ Allbery <rra@stanford.edu>
 
7
# Copyright 2008 Board of Trustees, Leland Stanford Jr. University
 
8
#
 
9
# See LICENSE for licensing terms.
 
10
 
 
11
BEGIN { our $total = 7 }
 
12
use Test::More tests => $total;
 
13
 
 
14
# Load our test utility programs.
 
15
require '@abs_top_builddir@/tests/libtest.pl';
 
16
 
 
17
# The full path to the newly-built k5start client.
 
18
our $K5START = '@abs_top_builddir@/k5start';
 
19
 
 
20
# The path to our data directory, which contains the keytab to use to test.
 
21
our $DATA = '@abs_top_builddir@/tests/data';
 
22
 
 
23
SKIP: {
 
24
    skip 'no keytab configuration', $total unless -f "$DATA/test.keytab";
 
25
    skip 'no current AFS tokens', $total unless tokens();
 
26
    my $principal = contents ("$DATA/test.principal");
 
27
 
 
28
    # Don't overwrite the user's ticket cache.
 
29
    $ENV{KRB5CCNAME} = 'krb5cc_test';
 
30
 
 
31
    # Basic token test.
 
32
    unlink 'krb5cc_test';
 
33
    my ($out, $err, $status)
 
34
        = command ($K5START, '-tqUf', "$DATA/test.keytab", '--', 'tokens');
 
35
    skip 'not built with AFS support', $total
 
36
        if ($err eq
 
37
            "k5start: cannot create PAG: AFS support is not available\n");
 
38
    is ($status, 0, 'k5start -t succeeds');
 
39
    is ($err, '', ' with no errors');
 
40
    like ($out, qr/^(User\'s \([^\)]+\) )?[Tt]okens for /m,
 
41
          ' and the right output');
 
42
    my ($default, $service) = klist ();
 
43
    is ($default, undef, ' and the normal ticket cache is untouched');
 
44
 
 
45
    # Set the token program to something that doesn't obtain tokens.
 
46
    # Everything should still work, but we should have no tokens.
 
47
    $ENV{KINIT_PROG} = '/bin/true';
 
48
    ($out, $err, $status)
 
49
        = command ($K5START, '-tqUf', "$DATA/test.keytab", '--', 'tokens');
 
50
    is ($status, 0, 'k5start -t succeeds with no aklog');
 
51
    is ($err, '', ' with no errors');
 
52
    unlike ($out, qr/^(User\'s \([^\)]+\) )?[Tt]okens for /m,
 
53
            ' and we have no tokens');
 
54
}