From 020fc2222c810a3545bf558b10e53af7c7aa3e1c Mon Sep 17 00:00:00 2001 From: "Franz Heinzmann (Frando)" Date: Fri, 16 Aug 2019 15:24:13 +0200 Subject: [PATCH] Fix tests --- src-rust/index.rs | 11 +++++------ test/segments.js | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src-rust/index.rs b/src-rust/index.rs index ad76e89..f53618a 100644 --- a/src-rust/index.rs +++ b/src-rust/index.rs @@ -285,14 +285,12 @@ impl IndexHandle { }; save_metas(&metas, self.index.directory_mut())?; } else { - return Err(TantivyError::InvalidArgument( - "segment already indexed".to_string(), - )); + return Err(TantivyError::InvalidArgument("Segment exists.".to_string())); } if !self.index.searchable_segment_ids()?.contains(&segment_id) { return Err(TantivyError::InvalidArgument( - "not possible to add segment".to_string(), + "Adding segment failed.".to_string(), )); } Ok(()) @@ -340,8 +338,9 @@ fn move_segment() { .unwrap(); let handle1 = catalog.get_index(&"testindex1".to_string()).unwrap(); - handle1.ensure_writer().unwrap(); - let mut writer1 = handle1.writer.take().unwrap(); + + let writer_lock1 = handle1.get_writer().unwrap(); + let mut writer1 = writer_lock1.write().unwrap(); // create a new tantivy Document to push this doc to index1 let mut doc = Document::new(); diff --git a/test/segments.js b/test/segments.js index 3a26add..e971dc4 100644 --- a/test/segments.js +++ b/test/segments.js @@ -1,11 +1,10 @@ const test = require('tape') const { tempdir, copyFiles } = require('./lib/util') const { getSchema, getDocs, getDocs2 } = require('./lib/fixtures') -const fs = require('fs') const Sonar = require('..') -test('basic indexing and query', async t => { +test.only('basic indexing and query', async t => { const [dir, cleanup] = await tempdir() const catalog = new Sonar(dir) const schema = getSchema()