github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/store/etcdv3/mercury_test.go (about)

     1  package etcdv3
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  	"time"
     7  
     8  	"github.com/projecteru2/core/engine/factory"
     9  	"github.com/projecteru2/core/types"
    10  
    11  	"github.com/stretchr/testify/assert"
    12  )
    13  
    14  func NewMercury(t *testing.T) *Mercury {
    15  	config := types.Config{}
    16  	config.LockTimeout = 10 * time.Second
    17  	config.GlobalTimeout = 30 * time.Second
    18  	config.Etcd = types.EtcdConfig{
    19  		Machines:   []string{"127.0.0.1:2379"},
    20  		Prefix:     "/eru-test",
    21  		LockPrefix: "/eru-test-lock",
    22  	}
    23  	config.ProbeTarget = "8.8.8.8:80"
    24  	config.MaxConcurrency = 100000
    25  	//	config.Docker.CertPath = "/tmp"
    26  
    27  	ctx, cancel := context.WithCancel(context.Background())
    28  	defer cancel()
    29  	factory.InitEngineCache(ctx, config, nil)
    30  
    31  	m, err := New(config, t)
    32  	assert.NoError(t, err)
    33  	return m
    34  }