mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-07 02:07:58 +00:00
Add vendor folder to git
This commit is contained in:
parent
66cf5eaafb
commit
183585f56f
6916 changed files with 2629581 additions and 1 deletions
45
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/main_test.go
generated
vendored
Normal file
45
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/main_test.go
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
server "github.com/grpc-ecosystem/grpc-gateway/examples/server"
|
||||
)
|
||||
|
||||
func runServers() <-chan error {
|
||||
ch := make(chan error, 2)
|
||||
go func() {
|
||||
if err := server.Run(); err != nil {
|
||||
ch <- fmt.Errorf("cannot run grpc service: %v", err)
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
if err := Run(":8080"); err != nil {
|
||||
ch <- fmt.Errorf("cannot run gateway service: %v", err)
|
||||
}
|
||||
}()
|
||||
return ch
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
errCh := runServers()
|
||||
|
||||
ch := make(chan int, 1)
|
||||
go func() {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
ch <- m.Run()
|
||||
}()
|
||||
|
||||
select {
|
||||
case err := <-errCh:
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
case status := <-ch:
|
||||
os.Exit(status)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue