Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raft/add tenants ec journey #4798

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions test/acceptance/replication/crud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ func immediateReplicaCRUD(t *testing.T) {
helper.CreateClass(t, articleClass)
})

time.Sleep(1 * time.Second) // remove once eventual consistency has been addressed

t.Run("InsertParagraphsBatch", func(t *testing.T) {
t.Run("CreateObjectsOnNode-3", func(t *testing.T) {
batch := make([]*models.Object, len(paragraphIDs))
Expand Down
69 changes: 69 additions & 0 deletions test/acceptance/replication/mt_ec_journey.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// _ _
// __ _____ __ ___ ___ __ _| |_ ___
// \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
// \ V V / __/ (_| |\ V /| | (_| | || __/
// \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
//
// Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
//
// CONTACT: [email protected]
//

package replication

import (
"context"
"fmt"
"testing"
"time"

"github.com/stretchr/testify/require"
"github.com/weaviate/weaviate/entities/models"
"github.com/weaviate/weaviate/test/docker"
"github.com/weaviate/weaviate/test/helper"
"github.com/weaviate/weaviate/test/helper/sample-schema/articles"
)

func multiTenancyEventualConsistency(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()

compose, err := docker.New().
With3NodeCluster().
WithText2VecContextionary().
Start(ctx)
require.Nil(t, err)
defer func() {
if err := compose.Terminate(ctx); err != nil {
t.Fatalf("failed to terminate test containers: %s", err.Error())
}
}()

helper.SetupClient(compose.ContainerURI(1))
paragraphClass := articles.ParagraphsClass()

paragraphClass.ReplicationConfig = &models.ReplicationConfig{
Factor: 3,
}
paragraphClass.MultiTenancyConfig = &models.MultiTenancyConfig{
Enabled: true,
}
helper.CreateClass(t, paragraphClass)

t.Run("Execute journey", func(t *testing.T) {
for i := 0; i < 100; i++ {
tenantName := fmt.Sprintf("tenant-%v", i)
t.Run(fmt.Sprintf("InsertParagraphs/%v", tenantName), func(t *testing.T) {
helper.CreateTenants(t, paragraphClass.Class, []*models.Tenant{{Name: tenantName, ActivityStatus: "HOT"}})
objects := make([]*models.Object, 1000)
for i := 0; i < 1000; i++ {
objects[i] = (*models.Object)(articles.NewParagraph().
WithContents(fmt.Sprintf("paragraph#%d", i)).
WithTenant(tenantName).
Object())
}
helper.CreateObjectsBatch(t, objects)
})
}
})
}
2 changes: 0 additions & 2 deletions test/acceptance/replication/multi_tenancy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ func multiTenancyEnabled(t *testing.T) {
helper.CreateClass(t, articleClass)
})

time.Sleep(1 * time.Second) // remove once eventual consistency has been addressed

t.Run("AddTenants", func(t *testing.T) {
tenants := []*models.Tenant{{Name: tenantID.String()}}
helper.CreateTenants(t, paragraphClass.Class, tenants)
Expand Down
2 changes: 0 additions & 2 deletions test/acceptance/replication/read_repair_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ func readRepair(t *testing.T) {
helper.CreateClass(t, articleClass)
})

time.Sleep(time.Second) // remove once eventual consistency has been addressed

t.Run("InsertParagraphs/Node-1", func(t *testing.T) {
batch := make([]*models.Object, len(paragraphIDs))
for i, id := range paragraphIDs {
Expand Down
1 change: 1 addition & 0 deletions test/acceptance/replication/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ func TestReplication(t *testing.T) {
t.Run("ReadRepair", readRepair)
t.Run("GraphqlSearch", graphqlSearch)
t.Run("MultiTenancy", multiTenancyEnabled)
t.Run("MultiTenancyEventualConsistency", multiTenancyEventualConsistency)
}