Beispiel #1
0
func TestUpdateMutations_AddField(t *testing.T) {
	log.Printf("In TestUpdateMutations_AddField()")

	var bucketName = "default"
	var indexName = "index_newField"
	var field = "newField"

	docsToCreate := generateDocs(1000, "users.prod")
	UpdateKVDocs(docsToCreate, docs)

	seed++
	log.Printf("Setting JSON docs in KV")
	kvutility.SetKeyValues(docsToCreate, "default", "", clusterconfig.KVAddress)

	err := secondaryindex.CreateSecondaryIndex(indexName, bucketName, indexManagementAddress, "", []string{field}, false, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)

	docScanResults := datautility.ExpectedScanAllResponse(docs, field)
	scanResults, err := secondaryindex.ScanAll(indexName, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	log.Printf("Count of scan results before add field mutations:  %d", len(scanResults))
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)

	// Create mutations with add fields
	AddFieldMutations(300, field) // Update documents by adding the indexed field

	docScanResults = datautility.ExpectedScanAllResponse(docs, field)
	scanResults, err = secondaryindex.ScanAll(indexName, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	log.Printf("Count of scan results after add field mutations:  %d", len(scanResults))
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)
}
Beispiel #2
0
// Test with large number of mutations
func TestLargeMutations(t *testing.T) {
	log.Printf("In TestLargeMutations()")
	var index1 = "indexmut_1"
	var index2 = "indexmut_2"
	var bucketName = "default"
	var field1 = "company"
	var field2 = "gender"

	e := secondaryindex.DropAllSecondaryIndexes(indexManagementAddress)
	FailTestIfError(e, "Error in DropAllSecondaryIndexes", t)

	docsToCreate := generateDocs(20000, "users.prod")
	UpdateKVDocs(docsToCreate, docs)
	kv.SetKeyValues(docsToCreate, "default", "", clusterconfig.KVAddress)

	err := secondaryindex.CreateSecondaryIndex(index1, bucketName, indexManagementAddress, "", []string{field1}, false, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)

	docScanResults := datautility.ExpectedScanAllResponse(docs, field1)
	scanResults, err := secondaryindex.ScanAll(index1, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)
	log.Printf("Len of expected and actual scan results are :  %d and %d", len(docScanResults), len(scanResults))

	for i := 0; i <= 10; i++ {
		log.Printf("ITERATION %v\n", i)

		docsToCreate = generateDocs(10000, "users.prod")
		UpdateKVDocs(docsToCreate, docs)
		kv.SetKeyValues(docsToCreate, "default", "", clusterconfig.KVAddress)

		err := secondaryindex.CreateSecondaryIndex(index2, bucketName, indexManagementAddress, "", []string{field2}, false, nil, true, defaultIndexActiveTimeout, nil)
		FailTestIfError(err, "Error in creating the index", t)

		docScanResults = datautility.ExpectedScanAllResponse(docs, field1)
		scanResults, err = secondaryindex.ScanAll(index1, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
		FailTestIfError(err, "Error in scan", t)
		err = tv.Validate(docScanResults, scanResults)
		FailTestIfError(err, "Error in scan result validation", t)
		log.Printf("Len of expected and actual scan results are :  %d and %d", len(docScanResults), len(scanResults))

		docScanResults = datautility.ExpectedScanAllResponse(docs, field2)
		scanResults, err = secondaryindex.ScanAll(index2, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
		FailTestIfError(err, "Error in scan", t)
		err = tv.Validate(docScanResults, scanResults)
		FailTestIfError(err, "Error in scan result validation", t)
		log.Printf("Len of expected and actual scan results are :  %d and %d", len(docScanResults), len(scanResults))

		err = secondaryindex.DropSecondaryIndex(index2, bucketName, indexManagementAddress)
		FailTestIfError(err, "Error in drop index", t)
	}
}
func TestLargeDocumentSize(t *testing.T) {
	log.Printf("In TestLargeDocumentSize()")

	u, _ := user.Current()
	datapath := filepath.Join(u.HomeDir, "testdata/TwitterFeed1.txt.gz")
	tc.DownloadDataFile(tc.IndexTypesTwitterFeed1JSONDataS3, datapath, true)
	largeDocs := datautility.LoadJSONFromCompressedFile(datapath, "id_str")
	UpdateKVDocs(largeDocs, docs)

	log.Printf("Length of docs and largeDocs = %d and %d", len(docs), len(largeDocs))

	bucketName := "default"
	index1 := "index_userscreenname"

	kvutility.SetKeyValues(largeDocs, bucketName, "", clusterconfig.KVAddress)

	err := secondaryindex.CreateSecondaryIndex(index1, bucketName, indexManagementAddress, "", []string{"`user`.screen_name"}, false, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)

	docScanResults := datautility.ExpectedScanAllResponse(docs, "user.screen_name")
	scanResults, err := secondaryindex.ScanAll(index1, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan 1: ", t)
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan 1:  result validation", t)
}
Beispiel #4
0
func TestCompositeIndex_NumAndString(t *testing.T) {
	log.Printf("In TestCompositeIndex()")

	var bucketName = "default"
	var indexName = "index_composite1"

	err := secondaryindex.CreateSecondaryIndex(indexName, bucketName, indexManagementAddress, "", []string{"age", "company"}, false, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)
	scanResults, err := secondaryindex.ScanAll(indexName, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	if len(scanResults) != len(docs) {
		log.Printf("ScanAll of composite index is wrong. Expected and actual num of results:  %d and %d", len(docs), len(scanResults))
		e := errors.New("ScanAll of composite index is wrong")
		FailTestIfError(e, "Error in TestCompositeIndex", t)

	}

	scanResults, err = secondaryindex.Range(indexName, bucketName, indexScanAddress, []interface{}{25, "F"}, []interface{}{30, "M"}, 3, true, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	// todo: validate the results

	addDocIfNotPresentInKV("User22a44f1c-3f15-4ada-9cf5-6c24a7690a37")

	docScanResults := make(tc.ScanResponse)
	docScanResults["User22a44f1c-3f15-4ada-9cf5-6c24a7690a37"] = []interface{}{25.0, "ZIGGLES"}
	scanResults, err = secondaryindex.Lookup(indexName, bucketName, indexScanAddress, []interface{}{25, "ZIGGLES"}, true, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)
}
Beispiel #5
0
func SkipTestPerfPrimaryIndexBuild_SimpleJson(t *testing.T) {
	log.Printf("In TestPerfInitialIndexBuild()")
	e := secondaryindex.DropAllSecondaryIndexes(indexManagementAddress)
	FailTestIfError(e, "Error in DropAllSecondaryIndexes", t)

	prodfile = filepath.Join(proddir, "test.prod")
	log.Printf("Generating JSON docs")
	count := 100000000
	keyValues := GenerateJsons(count, 1, prodfile, bagdir)
	log.Printf("Setting JSON docs in KV")
	kv.SetKeyValues(keyValues, "default", "", clusterconfig.KVAddress)

	var indexName = "index_primary"
	var bucketName = "default"

	log.Printf("Creating a 2i")
	start := time.Now()
	err := secondaryindex.CreateSecondaryIndex(indexName, bucketName, indexManagementAddress, "", nil, true, nil, true, 1500, nil)
	FailTestIfError(err, "Error in creating the index", t)
	elapsed := time.Since(start)
	log.Printf("Index build of %d user documents took %s\n", count, elapsed)
	scanResults, err := secondaryindex.ScanAll(indexName, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	if len(scanResults) != len(keyValues) {
		log.Printf("Len of scanResults is incorrect. Expected and Actual are: %d and %d", len(keyValues), len(scanResults))
		err = errors.New("Len of scanResults is incorrect.")
	}
	FailTestIfError(err, "Len of scanResults is incorrect", t)
}
Beispiel #6
0
func SkipTestPerfScanAllWithoutMutations_1M(t *testing.T) {
	log.Printf("In TestPerfQueryWithoutMutations_1M()")
	secondaryindex.DropAllSecondaryIndexes(indexManagementAddress)

	prodfile := "../../../../../prataprc/monster/prods/test.prod"
	bagdir := "../../../../../prataprc/monster/bags/"
	log.Printf("Generating JSON docs")
	count := 1000000
	keyValues := GenerateJsons(count, 1, prodfile, bagdir)
	log.Printf("Setting JSON docs in KV")
	kv.SetKeyValues(keyValues, "default", "", clusterconfig.KVAddress)

	var indexName = "index_company"
	var bucketName = "default"

	log.Printf("Creating a 2i")

	err := secondaryindex.CreateSecondaryIndex(indexName, bucketName, indexManagementAddress, "", []string{"company"}, false, nil, true, 1500, nil)
	FailTestIfError(err, "Error in creating the index", t)

	start := time.Now()
	scanResults, err := secondaryindex.ScanAll(indexName, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	elapsed := time.Since(start)
	log.Printf("ScalAll:: Len of scanResults is: %d", len(scanResults))
	log.Printf("ScanAll of %d user documents took %s\n", count, elapsed)
}
Beispiel #7
0
func TestMixedDatatypesScanAll(t *testing.T) {
	log.Printf("In TestMixedDatatypesScanAll()")
	log.Printf("Before test begin: Length of kv docs is %d", len(docs))
	field := "md_street"
	indexName := "index_mixeddt"
	bucketName := "default"

	e := secondaryindex.DropAllSecondaryIndexes(indexManagementAddress)
	FailTestIfError(e, "Error in DropAllSecondaryIndexes", t)

	docsToCreate := generateJSONSMixedDatatype(1000, "md_street")
	log.Printf("After generate docs: Length of kv docs is %d", len(docs))
	seed++
	log.Printf("Setting mixed datatypes JSON docs in KV")
	kvutility.SetKeyValues(docsToCreate, "default", "", clusterconfig.KVAddress)

	err := secondaryindex.CreateSecondaryIndex(indexName, bucketName, indexManagementAddress, "", []string{field}, false, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)

	docScanResults := datautility.ExpectedScanAllResponse(docs, field)
	scanResults, err := secondaryindex.ScanAll(indexName, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)
	log.Printf("Lengths of expected and actual scan results are:  %d and %d", len(docScanResults), len(scanResults))
	log.Printf("End: Length of kv docs is %d", len(docs))
}
Beispiel #8
0
// Test case for testing primary key values with longest length possible
func TestLargePrimaryKeyLength(t *testing.T) {
	log.Printf("In TestLargePrimaryKeyLength()")

	indexName := "index_LongPrimaryField"
	bucketName := "default"

	e := secondaryindex.DropAllSecondaryIndexes(indexManagementAddress)
	FailTestIfError(e, "Error in DropAllSecondaryIndexes", t)

	largePrimaryKeyDocs := generateLargePrimaryKeyDocs(1000, "docid")
	seed++
	log.Printf("Setting JSON docs in KV")
	kvutility.SetKeyValues(largePrimaryKeyDocs, "default", "", clusterconfig.KVAddress)

	// Create a primary index
	err := secondaryindex.CreateSecondaryIndex(indexName, bucketName, indexManagementAddress, "", nil, true, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)

	scanResults, err := secondaryindex.ScanAll(indexName, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	if len(scanResults) != len(docs) {
		log.Printf("Len of scanResults is incorrect. Expected and Actual are:  %d and %d", len(docs), len(scanResults))
		err = errors.New("Len of scanResults is incorrect.")
		FailTestIfError(err, "Len of scanResults is incorrect", t)
	}

	log.Printf("Lengths of num of docs and scanResults are:  %d and %d", len(docs), len(scanResults))
	log.Printf("End: Length of kv docs is %d", len(docs))
}
Beispiel #9
0
// Test case for testing secondary key field values as very huge
func TestLargeSecondaryKeyLength(t *testing.T) {
	log.Printf("In TestLargeSecondaryKeyLength()")

	field := "LongSecField"
	indexName := "index_LongSecField"
	bucketName := "default"

	e := secondaryindex.DropAllSecondaryIndexes(indexManagementAddress)
	FailTestIfError(e, "Error in DropAllSecondaryIndexes", t)

	largeKeyDocs := generateLargeSecondayKeyDocs(1000, field)
	seed++
	log.Printf("Setting JSON docs in KV")
	kvutility.SetKeyValues(largeKeyDocs, "default", "", clusterconfig.KVAddress)

	err := secondaryindex.CreateSecondaryIndex(indexName, bucketName, indexManagementAddress, "", []string{field}, false, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)

	docScanResults := datautility.ExpectedScanAllResponse(docs, field)
	scanResults, err := secondaryindex.ScanAll(indexName, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	log.Printf("ScanAll: Lengths of expected and actual scan results are:  %d and %d", len(docScanResults), len(scanResults))
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)

	docScanResults = datautility.ExpectedScanResponse_string(docs, field, "A", "zzzz", 3)
	scanResults, err = secondaryindex.Range(indexName, bucketName, indexScanAddress, []interface{}{"A"}, []interface{}{"zzzz"}, 3, true, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	log.Printf("Range: Lengths of expected and actual scan results are:  %d and %d", len(docScanResults), len(scanResults))
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)
	log.Printf("End: Length of kv docs is %d", len(docs))
}
Beispiel #10
0
func TestUpdateMutations_DataTypeChange(t *testing.T) {
	log.Printf("In TestUpdateMutations_DataTypeChange()")

	var bucketName = "default"
	var indexName = "index_isUserActive"
	var field = "isActive"

	docsToCreate := generateDocs(1000, "users.prod")
	UpdateKVDocs(docsToCreate, docs)

	seed++
	log.Printf("Setting JSON docs in KV")
	kvutility.SetKeyValues(docsToCreate, "default", "", clusterconfig.KVAddress)
	time.Sleep(2 * time.Second)

	err := secondaryindex.CreateSecondaryIndex(indexName, bucketName, indexManagementAddress, "", []string{field}, false, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)

	docScanResults := datautility.ExpectedScanAllResponse(docs, field)
	scanResults, err := secondaryindex.ScanAll(indexName, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)

	// Create mutations with delete fields
	DataTypeChangeMutations_BoolToString(200, field) // Update documents by changing datatype of the indexed field

	docScanResults = datautility.ExpectedScanAllResponse(docs, field)
	scanResults, err = secondaryindex.ScanAll(indexName, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)

	docScanResults = datautility.ExpectedScanResponse_string(docs, field, "true", "true", 3)
	scanResults, err = secondaryindex.Lookup(indexName, bucketName, indexScanAddress, []interface{}{"true"}, true, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)

	docScanResults = datautility.ExpectedScanResponse_string(docs, field, "false", "false", 3)
	scanResults, err = secondaryindex.Lookup(indexName, bucketName, indexScanAddress, []interface{}{"false"}, true, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)
}
Beispiel #11
0
func TestBucketFlush(t *testing.T) {
	log.Printf("In TestBucketFlush()")

	var bucketName = "default"
	indexNames := [...]string{"index_age", "index_gender", "index_city"}
	indexFields := [...]string{"age", "gender", "address.city"}

	e := secondaryindex.DropAllSecondaryIndexes(indexManagementAddress)
	FailTestIfError(e, "Error in DropAllSecondaryIndexes", t)
	kvutility.FlushBucket(bucketName, "", clusterconfig.Username, clusterconfig.Password, kvaddress)

	kvdocs := generateDocs(1000, "users.prod")
	kvutility.SetKeyValues(kvdocs, bucketName, "", clusterconfig.KVAddress)

	for i := 0; i < 3; i++ {
		err := secondaryindex.CreateSecondaryIndex(indexNames[i], bucketName, indexManagementAddress, "", []string{indexFields[i]}, false, nil, true, defaultIndexActiveTimeout, nil)
		FailTestIfError(err, "Error in creating the index", t)
		docScanResults := datautility.ExpectedScanAllResponse(kvdocs, indexFields[i])
		scanResults, err := secondaryindex.ScanAll(indexNames[i], bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
		err = tv.Validate(docScanResults, scanResults)
		FailTestIfError(err, "Error in scan result validation", t)
	}

	kvutility.FlushBucket(bucketName, "", clusterconfig.Username, clusterconfig.Password, kvaddress)
	time.Sleep(5 * time.Second)
	log.Printf("TestBucketFlush:: Flushed the bucket")

	for i := 0; i < 3; i++ {
		scanResults, err := secondaryindex.ScanAll(indexNames[i], bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
		FailTestIfError(err, "Error in scan ", t)
		if len(scanResults) != 0 {
			log.Printf("Scan results should be empty after bucket but it is : %v\n", scanResults)
			e := errors.New("Scan failed after bucket flush")
			FailTestIfError(e, "Error in TestBucketFlush", t)
		}
	}

	tc.ClearMap(docs)
}
Beispiel #12
0
func TestBasicArrayDataType_ScanAll(t *testing.T) {
	log.Printf("In TestBasicArrayDataType_ScanAll()")
	var indexName = "index_tags"
	var bucketName = "default"

	err := secondaryindex.CreateSecondaryIndex(indexName, bucketName, indexManagementAddress, "", []string{"tags"}, false, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)

	docScanResults := datautility.ExpectedScanAllResponse(docs, "tags")
	scanResults, err := secondaryindex.ScanAll(indexName, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)
}
Beispiel #13
0
func TestScanAllNestedField(t *testing.T) {
	log.Printf("In TestScanAllNestedField()")
	var index1 = "index_streetname"
	var bucketName = "default"

	err := secondaryindex.CreateSecondaryIndex(index1, bucketName, indexManagementAddress, "", []string{"address.streetaddress.streetname"}, false, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)

	docScanResults := datautility.ExpectedScanResponse_string(docs, "address.streetaddress.streetname", "A", "z", 3)
	log.Printf("Length of docScanResults = %d", len(docScanResults))
	scanResults, err := secondaryindex.ScanAll(index1, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	log.Printf("Length of scanResults = %d", len(scanResults))
	FailTestIfError(err, "Error in scan", t)
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)
}
Beispiel #14
0
func TestCompositeIndex_TwoNumberFields(t *testing.T) {
	log.Printf("In TestCompositeIndex()")

	var bucketName = "default"
	var indexName = "index_composite2"

	err := secondaryindex.CreateSecondaryIndex(indexName, bucketName, indexManagementAddress, "", []string{"latitude", "longitude"}, false, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)

	scanResults, err := secondaryindex.ScanAll(indexName, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	if len(scanResults) != len(docs) {
		log.Printf("ScanAll of composite index is wrong. Expected and actual num of results:  %d and %d", len(docs), len(scanResults))
		e := errors.New("ScanAll of composite index is wrong")
		FailTestIfError(e, "Error in TestCompositeIndex", t)

	}
}
Beispiel #15
0
func TestBasicPrimaryIndex(t *testing.T) {
	log.Printf("In TestBasicPrimaryIndex()")
	var indexName = "index_p1"
	var bucketName = "default"

	// Create a primary index
	err := secondaryindex.CreateSecondaryIndex(indexName, bucketName, indexManagementAddress, "", nil, true, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)

	// docScanResults := datautility.ExpectedScanResponse_float64(docs, "latitude", -67.373365, -67.373165, 0)
	scanResults, err := secondaryindex.ScanAll(indexName, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	if len(scanResults) != len(docs) {
		log.Printf("Len of scanResults is incorrect. Expected and Actual are %d and %d", len(docs), len(scanResults))
		err = errors.New("Len of scanResults is incorrect.")
	}
	FailTestIfError(err, "Len of scanResults is incorrect", t)
}
Beispiel #16
0
func TestIndexCreateWithWhere(t *testing.T) {
	log.Printf("In TestIndexCreateWithWhere()")
	var index1 = "index_ageabove30"
	var index2 = "index_ageteens"
	var index3 = "index_age35to45"
	var bucketName = "default"

	err := secondaryindex.CreateSecondaryIndex(index1, bucketName, indexManagementAddress, `age>30`, []string{"age"}, false, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)

	docScanResults := datautility.ExpectedScanResponse_float64(docs, "age", 31, 40, 1)
	scanResults, err := secondaryindex.Range(index1, bucketName, indexScanAddress, []interface{}{31}, []interface{}{40}, 1, true, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)
	log.Printf("Lengths of expected and actual scanReuslts are:  %d and %d", len(scanResults), len(docScanResults))

	err = secondaryindex.CreateSecondaryIndex(index2, bucketName, indexManagementAddress, `age > 12 AND age < 20`, []string{"age"}, false, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)

	docScanResults = datautility.ExpectedScanResponse_float64(docs, "age", 12, 20, 0)
	scanResults, err = secondaryindex.Range(index2, bucketName, indexScanAddress, []interface{}{12}, []interface{}{20}, 0, true, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)
	log.Printf("Lengths of expected and actual scanReuslts are:  %d and %d", len(scanResults), len(docScanResults))

	err = secondaryindex.CreateSecondaryIndex(index3, bucketName, indexManagementAddress, `age >= 35 AND age <= 45`, []string{"age"}, false, nil, true, defaultIndexActiveTimeout, nil)
	FailTestIfError(err, "Error in creating the index", t)

	docScanResults = datautility.ExpectedScanResponse_float64(docs, "age", 35, 45, 3)
	scanResults, err = secondaryindex.ScanAll(index3, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
	FailTestIfError(err, "Error in scan", t)
	err = tv.Validate(docScanResults, scanResults)
	FailTestIfError(err, "Error in scan result validation", t)
	log.Printf("Lengths of expected and actual scanReuslts are:  %d and %d", len(scanResults), len(docScanResults))
}