Stop creating persistent uscon index
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/33f9460e Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/33f9460e Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/33f9460e Branch: refs/heads/master Commit: 33f9460eab874687ce3ffdfdee20ee04fa1b56a0 Parents: a224700 Author: Nick Wellnhofer <[email protected]> Authored: Sat Dec 24 14:26:09 2016 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Mon Jan 2 16:33:57 2017 +0100 ---------------------------------------------------------------------- perl/buildlib/Lucy/Test/TestUtils.pm | 13 ++++--------- perl/t/001-build_indexes.t | 17 +---------------- perl/t/701-uscon.t | 4 ++-- 3 files changed, 7 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/33f9460e/perl/buildlib/Lucy/Test/TestUtils.pm ---------------------------------------------------------------------- diff --git a/perl/buildlib/Lucy/Test/TestUtils.pm b/perl/buildlib/Lucy/Test/TestUtils.pm index 8216bfe..03f9f59 100644 --- a/perl/buildlib/Lucy/Test/TestUtils.pm +++ b/perl/buildlib/Lucy/Test/TestUtils.pm @@ -29,7 +29,6 @@ our @EXPORT_OK = qw( uscon_dir create_index create_uscon_index - persistent_test_index_loc init_test_index_loc get_uscon_docs utf8_test_strings @@ -64,12 +63,6 @@ sub remove_working_dir { return 1; } -# Return a location for a test index intended to be shared by multiple test -# files. It will be cleaned as above. -sub persistent_test_index_loc { - return catdir( $working_dir, 'persistent_test_index' ); -} - # Create a temporary test directory that will be removed at exit. sub init_test_index_loc { return tempdir( DIR => 't', CLEANUP => 1 ); @@ -157,8 +150,8 @@ sub _uscon_schema { } sub create_uscon_index { - my $folder - = Lucy::Store::FSFolder->new( path => persistent_test_index_loc() ); + my $dir = tempdir( DIR => 't', CLEANUP => 1 ); + my $folder = Lucy::Store::FSFolder->new( path => $dir ); my $indexer = Lucy::Index::Indexer->new( schema => _uscon_schema(), index => $folder, @@ -191,6 +184,8 @@ sub create_uscon_index { } $indexer->optimize; $indexer->commit; + + return $dir; } # Return 3 strings useful for verifying UTF-8 integrity. http://git-wip-us.apache.org/repos/asf/lucy/blob/33f9460e/perl/t/001-build_indexes.t ---------------------------------------------------------------------- diff --git a/perl/t/001-build_indexes.t b/perl/t/001-build_indexes.t index bcdc94e..c1153d0 100644 --- a/perl/t/001-build_indexes.t +++ b/perl/t/001-build_indexes.t @@ -17,15 +17,13 @@ use strict; use warnings; use lib 'buildlib'; -use Test::More tests => 4; +use Test::More tests => 2; use File::Spec::Functions qw( catfile ); use File::Find qw( find ); use Lucy::Test::TestUtils qw( working_dir create_working_dir remove_working_dir - create_uscon_index - persistent_test_index_loc ); remove_working_dir(); @@ -33,16 +31,3 @@ ok( !-e working_dir(), "Working dir doesn't exist" ); create_working_dir(); ok( -e working_dir(), "Working dir successfully created" ); -create_uscon_index(); - -my $path = persistent_test_index_loc(); -ok( -d $path, "created index directory" ); -my $num_cfmeta = 0; -find( - { no_chdir => 1, - wanted => sub { $num_cfmeta++ if $File::Find::name =~ /cfmeta/ }, - }, - $path -); -cmp_ok( $num_cfmeta, '>', 0, "at least one .cf file exists" ); - http://git-wip-us.apache.org/repos/asf/lucy/blob/33f9460e/perl/t/701-uscon.t ---------------------------------------------------------------------- diff --git a/perl/t/701-uscon.t b/perl/t/701-uscon.t index 436f3ae..4832b7d 100644 --- a/perl/t/701-uscon.t +++ b/perl/t/701-uscon.t @@ -18,10 +18,10 @@ use warnings; use lib 'buildlib'; use Test::More tests => 9; -use Lucy::Test::TestUtils qw( persistent_test_index_loc ); +use Lucy::Test::TestUtils qw( create_uscon_index ); my $searcher = Lucy::Search::IndexSearcher->new( - index => persistent_test_index_loc() ); + index => create_uscon_index() ); isa_ok( $searcher, 'Lucy::Search::IndexSearcher' ); my %searches = (
