Skip to content

Commit

Permalink
add tests to check descale RF and verbose replication ac tests
Browse files Browse the repository at this point in the history
  • Loading branch information
moogacs authored and aliszka committed May 14, 2024
1 parent cd8d1be commit b43fe35
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion test/acceptance/replication/crud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/weaviate/weaviate/client/objects"
"github.com/weaviate/weaviate/client/schema"
"github.com/weaviate/weaviate/entities/models"
"github.com/weaviate/weaviate/entities/schema/crossref"
"github.com/weaviate/weaviate/test/docker"
Expand Down Expand Up @@ -339,7 +340,7 @@ func eventualReplicaCRUD(t *testing.T) {
createObjects(t, compose.GetWeaviate().URI(), batch)
})

t.Run("configure classes to replicate to node 3", func(t *testing.T) {
t.Run("configure classes to replicate to node 2 and 3", func(t *testing.T) {
ac := helper.GetClass(t, "Article")
ac.ReplicationConfig = &models.ReplicationConfig{
Factor: 3,
Expand Down Expand Up @@ -473,6 +474,23 @@ func eventualReplicaCRUD(t *testing.T) {
startNodeAt(ctx, t, compose, 2)
})
})

t.Run("configure classes to decrease replication factor should fail", func(t *testing.T) {
ac := helper.GetClass(t, "Article")
ac.ReplicationConfig = &models.ReplicationConfig{
Factor: 2,
}

params := schema.NewSchemaObjectsUpdateParams().
WithObjectClass(ac).WithClassName(ac.Class)
resp, err := helper.Client(t).Schema.SchemaObjectsUpdate(params, nil)
assert.NotNil(t, err)
helper.AssertRequestFail(t, resp, err, func() {
errResponse, ok := err.(*schema.SchemaObjectsUpdateUnprocessableEntity)
assert.True(t, ok)
assert.Equal(t, fmt.Sprintf("scale \"%s\" from 3 replicas to 2: scaling in not supported yet", ac.Class), errResponse.Payload.Error[0].Message)
})
})
})
}

Expand Down
2 changes: 1 addition & 1 deletion test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ function run_acceptance_graphql_tests() {

function run_acceptance_replication_tests() {
for pkg in $(go list ./.../ | grep 'test/acceptance/replication'); do
if ! go test -count 1 -race "$pkg"; then
if ! go test -count 1 -v -race "$pkg"; then
echo "Test for $pkg failed" >&2
return 1
fi
Expand Down

0 comments on commit b43fe35

Please sign in to comment.