micro/web/web_test.go
Asim Aslam 563768b58a
v3 refactor (#1868)
* Move to v3

Co-authored-by: Ben Toogood <bentoogood@gmail.com>
2020-07-27 13:22:00 +01:00

44 lines
631 B
Go

package web_test
import (
"context"
"fmt"
"sync"
"testing"
"time"
"github.com/micro/go-micro/v3/logger"
"github.com/micro/go-micro/v3/web"
)
func TestWeb(t *testing.T) {
for i := 0; i < 3; i++ {
fmt.Println("Test nr", i)
testFunc()
}
}
func testFunc() {
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*250)
defer cancel()
w := web.NewService(
web.Context(ctx),
web.HandleSignal(false),
)
//s.Init()
//w.Init()
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
err := w.Run()
if err != nil {
logger.Errorf("web run error: %v", err)
}
}()
wg.Wait()
}