0
0
Fork 0

added more index crud test

This commit is contained in:
Marty Schoch 2014-11-25 16:23:48 -05:00
parent 896cfd3b38
commit 72ee4147e6
3 changed files with 67 additions and 0 deletions

29
docs/old_build_script.txt Normal file
View File

@ -0,0 +1,29 @@
old build script
# remove old icu
sudo apt-get -y remove libicu48
# install snappy
sudo apt-get -y install libsnappy-dev
# install newer icu
curl -o /tmp/icu4c-53_1-RHEL6-x64.tgz http://download.icu-project.org/files/icu4c/53.1/icu4c-53_1-RHEL6-x64.tgz
sudo tar zxvf /tmp/icu4c-53_1-RHEL6-x64.tgz -C /
# install leveldb
curl -O https://leveldb.googlecode.com/files/leveldb-1.15.0.tar.gz
tar zxvf leveldb-1.15.0.tar.gz
cd leveldb-1.15.0
make
sudo cp --preserve=links libleveldb.* /usr/local/lib
sudo cp -r include/leveldb /usr/local/include/
sudo ldconfig
cd ..
#install cld2
cd analysis/token_filters/cld2
svn checkout http://cld2.googlecode.com/svn/trunk/ cld2-read-only
cd cld2-read-only/internal/
./compile_libs.sh
sudo cp *.so /usr/local/lib
sudo ldconfig
cd ../../../../..

View File

@ -38,6 +38,11 @@ cat acc.out integration-acc.out | go run docs/merge-coverprofile.go > merged.out
if [ -n "$COVERALLS" ]
then
goveralls -service drone.io -coverprofile=merged.out -repotoken $COVERALLS
fi
if [ -n "$COVERHTML" ]
then
go tool cover -html=merged.out
fi
rm -rf ./profile.out

View File

@ -115,6 +115,39 @@ func TestCrud(t *testing.T) {
if string(val) != "7" {
t.Errorf("expected '7', got '%s'", val)
}
// close the index, open it again, and try some more things
index.Close()
index, err = Open("testidx")
if err != nil {
t.Fatal(err)
}
count, err := index.DocCount()
if err != nil {
t.Fatal(err)
}
if count != 2 {
t.Errorf("expected doc count 2, got %d", count)
}
doc, err := index.Document("a")
if err != nil {
t.Fatal(err)
}
if doc == nil {
t.Errorf("expected doc not nil, got nil")
}
foundNameField := false
for _, field := range doc.Fields {
if field.Name() == "name" && string(field.Value()) == "marty" {
foundNameField = true
}
}
if !foundNameField {
t.Errorf("expected to find field named 'name' with value 'marty'")
}
}
func TestIndexCreateNewOverExisting(t *testing.T) {