github.com/weaviate/weaviate@v1.24.6/test/modules/reranker-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  		WithRerankerTransformers().
    31  		Start(ctx)
    32  	if err != nil {
    33  		panic(errors.Wrapf(err, "cannot start"))
    34  	}
    35  
    36  	os.Setenv(weaviateEndpoint, compose.GetWeaviate().URI())
    37  	code := m.Run()
    38  
    39  	if err := compose.Terminate(ctx); err != nil {
    40  		panic(errors.Wrapf(err, "cannot terminate"))
    41  	}
    42  
    43  	os.Exit(code)
    44  }