Skip to content

Commit 949c455

Browse files
committed
Delete script tests which are noisy and confusing
These tests assume failure, but they don't clobber the logs. This leads to verbose output that is confusing. It looks like errors are being produced and that the test suite is ignoring them.
1 parent b9059c2 commit 949c455

File tree

1 file changed

+0
-119
lines changed

1 file changed

+0
-119
lines changed

t/lib/MetaCPAN/TestServer.pm

-119
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ sub setup {
6464

6565
$self->es_client;
6666

67-
# Run the Delete Index Tests before mapping deployment
68-
$self->test_delete_mappings;
69-
7067
# Deploy project mappings
7168
$self->put_mappings;
7269
}
@@ -355,102 +352,6 @@ sub prepare_user_test_data {
355352
);
356353
}
357354

358-
sub test_delete_mappings {
359-
my $self = $_[0];
360-
361-
$self->test_delete_fails;
362-
$self->test_delete_all;
363-
}
364-
365-
sub test_delete_fails {
366-
my $self = $_[0];
367-
368-
my $iexitcode;
369-
my $irunok;
370-
371-
subtest 'delete all not permitted' => sub {
372-
373-
# mapping script - delete indices
374-
{
375-
local @ARGV = qw(mapping --delete --all);
376-
local %ENV = (%ENV);
377-
378-
delete $ENV{'PLACK_ENV'};
379-
delete $ENV{'MOJO_MODE'};
380-
381-
$irunok = MetaCPAN::Script::Runner::run;
382-
$iexitcode = $MetaCPAN::Script::Runner::EXIT_CODE;
383-
}
384-
385-
ok( !$irunok, "delete all fails" );
386-
is( $iexitcode, 1, "Exit Code '1' - Permission Error" );
387-
};
388-
}
389-
390-
sub test_delete_all {
391-
my $self = $_[0];
392-
393-
subtest 'delete all deletes unknown index' => sub {
394-
subtest 'create index' => sub {
395-
my $smockindexjson = q({
396-
"mock_index" : {
397-
"properties" : {
398-
"mock_field" : {
399-
"index" : "not_analyzed",
400-
"ignore_above" : 2048,
401-
"type" : "string"
402-
}
403-
}
404-
}
405-
});
406-
407-
local @ARGV = (
408-
'mapping', '--create_index',
409-
'mock_index', '--patch_mapping',
410-
$smockindexjson
411-
);
412-
413-
ok(
414-
MetaCPAN::Script::Runner::run,
415-
"creation 'mock_index' succeeds"
416-
);
417-
is( $MetaCPAN::Script::Runner::EXIT_CODE,
418-
0, "Exit Code '0' - No Error" );
419-
};
420-
subtest 'info shows unknonwn index' => sub {
421-
local @ARGV = ( 'mapping', '--show_cluster_info' );
422-
my $mapping = MetaCPAN::Script::Mapping->new_with_options(
423-
$self->_config );
424-
425-
ok( $mapping->run, "show info succeeds" );
426-
is( $mapping->exit_code, 0, "Exit Code '0' - No Error" );
427-
428-
ok( defined $mapping->indices_info, 'Index Info built' );
429-
ok( defined $mapping->indices_info->{'mock_index'},
430-
'Unknown Index printed' );
431-
};
432-
subtest 'delete all succeeds' => sub {
433-
local @ARGV = qw(mapping --delete --all);
434-
435-
ok( MetaCPAN::Script::Runner::run, "delete all succeeds" );
436-
is( $MetaCPAN::Script::Runner::EXIT_CODE,
437-
0, "Exit Code '0' - No Error" );
438-
};
439-
subtest 'info does not show unknown index' => sub {
440-
local @ARGV = ( 'mapping', '--show_cluster_info' );
441-
my $mapping = MetaCPAN::Script::Mapping->new_with_options(
442-
$self->_config );
443-
444-
ok( $mapping->run, "show info succeeds" );
445-
is( $mapping->exit_code, 0, "Exit Code '0' - No Error" );
446-
447-
ok( defined $mapping->indices_info, 'Index Info built' );
448-
ok( !defined $mapping->indices_info->{'mock_index'},
449-
'Unknown Index not printed' );
450-
};
451-
};
452-
}
453-
454355
sub test_mappings {
455356
my $self = $_[0];
456357

@@ -473,16 +374,6 @@ sub test_index_missing {
473374
ok( $mapping->run, "deletion 'cover' succeeds" );
474375
is( $mapping->exit_code, 0, "Exit Code '0' - No Error" );
475376
};
476-
subtest 'mapping verification fails' => sub {
477-
local @ARGV = qw(mapping --verify);
478-
my $mapping
479-
= MetaCPAN::Script::Mapping->new_with_options(
480-
$self->_config );
481-
482-
is( $mapping->run, 0, "verification execution fails" );
483-
is( $mapping->exit_code, 1,
484-
"Exit Code '1' - Verification Error" );
485-
};
486377
subtest 're-create cover index' => sub {
487378
local @ARGV = (
488379
'mapping', '--create_index',
@@ -536,16 +427,6 @@ sub test_field_mismatch {
536427

537428
is( $mapping->exit_code, 0, "Exit Code '0' - No Error" );
538429
};
539-
subtest 'field verification fails' => sub {
540-
local @ARGV = qw(mapping --verify);
541-
my $mapping
542-
= MetaCPAN::Script::Mapping->new_with_options(
543-
$self->_config );
544-
545-
is( $mapping->run, 0, "verification fails" );
546-
is( $mapping->exit_code, 1,
547-
"Exit Code '1' - Verification Error" );
548-
};
549430
subtest 'mapping re-establish field' => sub {
550431
local @ARGV = (
551432
'mapping', '--update_index',

0 commit comments

Comments
 (0)