comparison random-index.t @ 109:d125e51ea596

Tests: add random index module test for symlink issue.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 14 Oct 2009 04:33:27 +0400
parents
children 51f3c88b2930
comparison
equal deleted inserted replaced
108:93a8f4202b16 109:d125e51ea596
1 #!/usr/bin/perl
2
3 # (C) Maxim Dounin
4
5 # Tests for random index module.
6
7 ###############################################################################
8
9 use warnings;
10 use strict;
11
12 use Test::More;
13
14 BEGIN { use FindBin; chdir($FindBin::Bin); }
15
16 use lib 'lib';
17 use Test::Nginx;
18
19 ###############################################################################
20
21 select STDERR; $| = 1;
22 select STDOUT; $| = 1;
23
24 my $t = Test::Nginx->new()->has('--with-http_random_index_module')->plan(1)
25 ->write_file_expand('nginx.conf', <<'EOF');
26
27 %%TEST_GLOBALS%%
28
29 master_process off;
30 daemon off;
31
32 events {
33 }
34
35 http {
36 %%TEST_GLOBALS_HTTP%%
37
38 server {
39 listen 127.0.0.1:8080;
40 server_name localhost;
41
42 location / {
43 random_index on;
44 }
45 }
46 }
47
48 EOF
49
50 my $d = $t->testdir();
51
52 mkdir("$d/x");
53 mkdir("$d/x/test-dir");
54 symlink("$d/x/test-dir", "$d/x/test-dir-link");
55
56 $t->write_file('test-file', 'RIGHT');
57 symlink("$d/test-file", "$d/x/test-file-link");
58
59 $t->run();
60
61 ###############################################################################
62
63 TODO: {
64 local $TODO = 'not yet';
65
66 like(http_get('/x/'), qr/RIGHT/s, 'file');
67
68 }
69
70 ###############################################################################