github.com/weaviate/weaviate@v1.24.6/test/modules/backup-filesystem/multi_tenant_backup_test.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  package test
    13  
    14  import (
    15  	"context"
    16  	"fmt"
    17  	"testing"
    18  	"time"
    19  
    20  	"github.com/stretchr/testify/require"
    21  	"github.com/weaviate/weaviate/test/docker"
    22  	"github.com/weaviate/weaviate/test/helper/journey"
    23  )
    24  
    25  const numTenants = 50
    26  
    27  func Test_MultiTenantBackup(t *testing.T) {
    28  	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
    29  	defer cancel()
    30  
    31  	t.Run("single node", func(t *testing.T) {
    32  		compose, err := docker.New().
    33  			WithBackendFilesystem().
    34  			WithText2VecContextionary().
    35  			WithWeaviate().
    36  			Start(ctx)
    37  		require.Nil(t, err)
    38  
    39  		defer func() {
    40  			if err := compose.Terminate(ctx); err != nil {
    41  				t.Fatalf("failed to terminate test containers: %s", err.Error())
    42  			}
    43  		}()
    44  
    45  		t.Run("backup-filesystem", func(t *testing.T) {
    46  			tenantNames := make([]string, numTenants)
    47  			for i := range tenantNames {
    48  				tenantNames[i] = fmt.Sprintf("Tenant%d", i)
    49  			}
    50  
    51  			journey.BackupJourneyTests_SingleNode(t,
    52  				compose.GetWeaviate().URI(), "filesystem", fsBackupJourneyClassName,
    53  				fsBackupJourneyBackupIDSingleNode, tenantNames)
    54  		})
    55  	})
    56  }