add git pull worker
This commit is contained in:
parent
70cfd89fc4
commit
15e74d47e3
5 changed files with 71 additions and 37 deletions
|
|
@ -1,36 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestServer(t *testing.T) {
|
||||
s := NewServer()
|
||||
|
||||
serverCtx, serverStopCtx := context.WithCancel(context.Background())
|
||||
sig := make(chan os.Signal, 1)
|
||||
signal.Notify(sig, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
|
||||
|
||||
// start server 3 minute and stop
|
||||
go func() {
|
||||
time.Sleep(180 * time.Second)
|
||||
serverStopCtx()
|
||||
}()
|
||||
|
||||
// start server
|
||||
go func() {
|
||||
err := s.Run()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}()
|
||||
|
||||
// stop server
|
||||
<-serverCtx.Done()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue