github.com/weaviate/weaviate@v1.24.6/test/modules/backup-gcs/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(envGCSCredentials, "") 33 t.Setenv(envGCSProjectID, gcsBackupJourneyProjectID) 34 t.Setenv(envGCSBucket, gcsBackupJourneyBucketName) 35 36 compose, err := docker.New(). 37 WithBackendGCS(gcsBackupJourneyBucketName). 38 WithText2VecContextionary(). 39 WithWeaviate(). 40 WithSecondWeaviate(). 41 Start(ctx) 42 require.Nil(t, err) 43 defer func() { 44 if err := compose.Terminate(ctx); err != nil { 45 t.Fatalf("failed to terminate test containers: %s", err.Error()) 46 } 47 }() 48 49 t.Log("post-instance env setup") 50 t.Setenv(envGCSEndpoint, compose.GetGCS().URI()) 51 t.Setenv(envGCSStorageEmulatorHost, compose.GetGCS().URI()) 52 moduleshelper.CreateGCSBucket(ctx, t, gcsBackupJourneyProjectID, gcsBackupJourneyBucketName) 53 helper.SetupClient(compose.GetWeaviate().URI()) 54 55 t.Run("backup-gcs", func(t *testing.T) { 56 journey.NodeMappingBackupJourneyTests_SingleNode_Backup(t, compose.GetWeaviate().URI(), 57 "gcs", gcsBackupJourneyClassName, gcsBackupJourneyBackupIDSingleNode, nil) 58 }) 59 60 // Now change our tests to use the second cluster and trigger a backup restore 61 helper.SetupClient(compose.GetSecondWeaviate().URI()) 62 63 t.Run("restore-gcs", func(t *testing.T) { 64 journey.NodeMappingBackupJourneyTests_SingleNode_Restore(t, compose.GetSecondWeaviate().URI(), 65 "gcs", gcsBackupJourneyClassName, gcsBackupJourneyBackupIDSingleNode, nil, map[string]string{ 66 docker.Weaviate: docker.SecondWeaviate, 67 }) 68 }) 69 }) 70 }