github.com/weaviate/weaviate@v1.24.6/test/modules/text2vec-contextionary/setup_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 "os" 17 "testing" 18 19 "github.com/pkg/errors" 20 "github.com/weaviate/weaviate/test/docker" 21 ) 22 23 const ( 24 weaviateNode1Endpoint = "WEAVIATE1_ENDPOINT" 25 weaviateNode2Endpoint = "WEAVIATE2_ENDPOINT" 26 ) 27 28 func TestMain(m *testing.M) { 29 ctx := context.Background() 30 compose, err := docker.New(). 31 WithWeaviateCluster().WithText2VecContextionary(). 32 Start(ctx) 33 if err != nil { 34 panic(errors.Wrapf(err, "cannot start")) 35 } 36 37 os.Setenv(weaviateNode1Endpoint, compose.GetWeaviate().URI()) 38 os.Setenv(weaviateNode2Endpoint, compose.GetWeaviateNode2().URI()) 39 code := m.Run() 40 41 if err := compose.Terminate(ctx); err != nil { 42 panic(errors.Wrapf(err, "cannot terminate")) 43 } 44 45 os.Exit(code) 46 }