github.com/zooyer/miskit@v1.0.71/sdk/ice/ice_test.go (about)

     1  package ice
     2  
     3  import (
     4  	"context"
     5  	"github.com/zooyer/miskit/log"
     6  	"testing"
     7  	"time"
     8  )
     9  
    10  func TestNew(t *testing.T) {
    11  	var (
    12  		config = log.Config{
    13  			Level: "DEBUG",
    14  		}
    15  		stdout    = log.NewStdoutRecorder(log.TextFormatter(true))
    16  		logger, _ = log.New(config, nil)
    17  	)
    18  	logger.SetDefaultRecorder(stdout)
    19  
    20  	var option = Option{
    21  		AppID:     622660,
    22  		AppSecret: "d566d332f9c78479baba83a6af7f6c45",
    23  		Addr:      "192.168.1.10:8804",
    24  		Retry:     1,
    25  		Logger:    logger,
    26  		Timeout:   time.Second,
    27  	}
    28  	ice := New(option)
    29  
    30  	for i := 0; i < 20; i++ {
    31  		id, err := ice.GenID(context.Background())
    32  		if err != nil {
    33  			t.Fatal(err)
    34  		}
    35  
    36  		t.Log(id)
    37  	}
    38  }