github.com/weaviate/weaviate@v1.24.6/test/modules/qna-transformers/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 weaviateEndpoint = "WEAVIATE_ENDPOINT"
    24  
    25  func TestMain(m *testing.M) {
    26  	ctx := context.Background()
    27  	compose, err := docker.New().
    28  		WithWeaviate().
    29  		WithText2VecContextionary().
    30  		WithText2VecTransformers().
    31  		WithQnATransformers().
    32  		Start(ctx)
    33  	if err != nil {
    34  		panic(errors.Wrapf(err, "cannot start"))
    35  	}
    36  
    37  	os.Setenv(weaviateEndpoint, compose.GetWeaviate().URI())
    38  	code := m.Run()
    39  
    40  	if err := compose.Terminate(ctx); err != nil {
    41  		panic(errors.Wrapf(err, "cannot terminate"))
    42  	}
    43  
    44  	os.Exit(code)
    45  }