IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 20, 2009, 11:15:20 AM (17 years ago)
Author:
jhoblitt
Message:

merge neb_distrib_20081210

Location:
trunk/Nebulous-Server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server

  • trunk/Nebulous-Server/t/13_server_rename_object.t

    r17717 r23932  
    88use warnings FATAL => qw( all );
    99
    10 use Test::More tests => 6;
     10use Test::More tests => 8;
    1111
    1212use lib qw( ./t ./lib );
    1313
     14use File::Basename qw( basename );
    1415use Nebulous::Server;
    1516use Test::Nebulous;
     
    2122);
    2223
     24use Test::DBUnit dsn => $NEB_DB, username => $NEB_USER, password => $NEB_PASS;
     25
    2326Test::Nebulous->setup;
    2427
    2528{
     29    my $key = "bar";
    2630    my $uri = $neb->create_object("foo");
    2731
    28     $neb->rename_object("foo", "bar");
     32    $neb->rename_object("foo", $key);
    2933
    30     eval {
    31         $neb->find_objects('^foo$');
    32     };
    33     like($@, qr/no keys found/, "old key name");
     34    expected_dataset_ok(
     35        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
     36        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 1],
     37    );
     38}
    3439
    35     my $keys = $neb->find_objects('^bar$');
    36     is(scalar @$keys, 1, 'number of keys found');
     40Test::Nebulous->setup;
     41
     42{
     43    my $key = "a/bar";
     44    my $uri = $neb->create_object("foo");
     45
     46    $neb->rename_object("foo", $key);
     47
     48    expected_dataset_ok(
     49        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
     50        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
     51        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 2],
     52    );
     53}
     54
     55Test::Nebulous->setup;
     56
     57{
     58    my $key = "bar";
     59    my $uri = $neb->create_object("a/foo");
     60
     61    $neb->rename_object("a/foo", $key);
     62
     63    expected_dataset_ok(
     64        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
     65        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
     66        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 1],
     67    );
    3768}
    3869
     
    73104like($@, qr/2 were expected/, "too many params");
    74105
     106# test attempting to rename a key in such a way to cause the distributed
     107# storage db to change
     108# this must be the last test as we're messing with the $neb object
     109eval {
     110    $neb->config->add_db(
     111        dbindex     => 1,
     112        dsn         => $NEB_DB,
     113        dbuser      => $NEB_USER,
     114        dbpasswd    => $NEB_PASS,
     115    );
     116
     117    $neb->create_object("a/foo");
     118    $neb->rename_object("a/foo", "g/bar");
     119};
     120like($@, qr/rename objects across distributed database boundaries/, "rename between databases");
     121
    75122Test::Nebulous->cleanup;
Note: See TracChangeset for help on using the changeset viewer.