github.com/weaviate/weaviate@v1.24.6/test/modules/backup-azure/node_mapping_backup_journey_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  	"testing"
    17  	"time"
    18  
    19  	"github.com/stretchr/testify/require"
    20  	"github.com/weaviate/weaviate/test/docker"
    21  	"github.com/weaviate/weaviate/test/helper"
    22  	"github.com/weaviate/weaviate/test/helper/journey"
    23  	moduleshelper "github.com/weaviate/weaviate/test/helper/modules"
    24  )
    25  
    26  func Test_NodeMappingBackupJourney(t *testing.T) {
    27  	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
    28  	defer cancel()
    29  
    30  	t.Run("single node", func(t *testing.T) {
    31  		t.Log("pre-instance env setup")
    32  		t.Setenv(envAzureContainer, azureBackupJourneyContainerName)
    33  
    34  		compose, err := docker.New().
    35  			WithBackendAzure(azureBackupJourneyContainerName).
    36  			WithText2VecContextionary().
    37  			WithWeaviate().
    38  			WithSecondWeaviate().
    39  			Start(ctx)
    40  		require.Nil(t, err)
    41  
    42  		t.Log("post-instance env setup")
    43  		azuriteEndpoint := compose.GetAzurite().URI()
    44  		t.Setenv(envAzureEndpoint, azuriteEndpoint)
    45  		moduleshelper.CreateAzureContainer(ctx, t, azuriteEndpoint, azureBackupJourneyContainerName)
    46  		helper.SetupClient(compose.GetWeaviate().URI())
    47  
    48  		t.Run("backup-azure", func(t *testing.T) {
    49  			journey.NodeMappingBackupJourneyTests_SingleNode_Backup(t, compose.GetWeaviate().URI(),
    50  				"azure", azureBackupJourneyClassName, azureBackupJourneyBackupIDSingleNode, nil)
    51  		})
    52  
    53  		// Now change our tests to use the second cluster and trigger a backup restore
    54  		helper.SetupClient(compose.GetSecondWeaviate().URI())
    55  
    56  		t.Run("restore-azure", func(t *testing.T) {
    57  			journey.NodeMappingBackupJourneyTests_SingleNode_Restore(t, compose.GetSecondWeaviate().URI(),
    58  				"azure", azureBackupJourneyClassName, azureBackupJourneyBackupIDSingleNode, nil, map[string]string{
    59  					docker.Weaviate: docker.SecondWeaviate,
    60  				})
    61  		})
    62  
    63  		require.Nil(t, compose.Terminate(ctx))
    64  	})
    65  }