예제 #1
0
func setupInitialData(mgr *manager.IndexManager, t *testing.T) {

	uuid, err := common.NewUUID()
	if err != nil {
		t.Fatal(err)
	}
	mgr.SetLocalValue("IndexerId", uuid.Str())

	// Add a new index definition : 100
	idxDefn := &common.IndexDefn{
		DefnId:          common.IndexDefnId(100),
		Name:            "metadata_provider_test_100",
		Using:           common.ForestDB,
		Bucket:          "Default",
		IsPrimary:       false,
		SecExprs:        []string{"Testing"},
		ExprType:        common.N1QL,
		PartitionScheme: common.HASH,
		PartitionKey:    "Testing"}

	if err := mgr.HandleCreateIndexDDL(idxDefn); err != nil {
		t.Fatal(err)
	}

	// Add a new index definition : 101
	idxDefn = &common.IndexDefn{
		DefnId:          common.IndexDefnId(101),
		Name:            "metadata_provider_test_101",
		Using:           common.ForestDB,
		Bucket:          "Default",
		IsPrimary:       false,
		SecExprs:        []string{"Testing"},
		ExprType:        common.N1QL,
		PartitionScheme: common.HASH,
		PartitionKey:    "Testing"}

	if err := mgr.HandleCreateIndexDDL(idxDefn); err != nil {
		t.Fatal(err)
	}
}