ignore bgp test in ci
This commit is contained in:
31
.github/workflows/go.yml
vendored
Normal file
31
.github/workflows/go.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
name: GoCast
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build and unit test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
- CI: 1
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Set up Go 1.x
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ^1.14
|
||||||
|
id: go
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: make
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: make test
|
||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/golang/protobuf/ptypes"
|
"github.com/golang/protobuf/ptypes"
|
||||||
@@ -18,8 +19,6 @@ type BgpListener struct {
|
|||||||
recvdPaths chan string
|
recvdPaths chan string
|
||||||
}
|
}
|
||||||
|
|
||||||
var listener *BgpListener
|
|
||||||
|
|
||||||
// NewBgpListener starts a local BGP server for testing purposes
|
// NewBgpListener starts a local BGP server for testing purposes
|
||||||
func NewBgpListener(localAS int) (*BgpListener, error) {
|
func NewBgpListener(localAS int) (*BgpListener, error) {
|
||||||
s := gobgp.NewBgpServer()
|
s := gobgp.NewBgpServer()
|
||||||
@@ -71,6 +70,14 @@ func (l *BgpListener) Shutdown() error {
|
|||||||
// if the test timeouts are very small. It also needs to be run as
|
// if the test timeouts are very small. It also needs to be run as
|
||||||
// root (sudo)
|
// root (sudo)
|
||||||
func TestBgpNew(t *testing.T) {
|
func TestBgpNew(t *testing.T) {
|
||||||
|
if os.Getenv("CI") != "" {
|
||||||
|
t.Skip("Skipping testing in CI environment")
|
||||||
|
}
|
||||||
|
listener, err := NewBgpListener(22222)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
defer listener.Shutdown()
|
||||||
a := assert.New(t)
|
a := assert.New(t)
|
||||||
c := config.BgpConfig{
|
c := config.BgpConfig{
|
||||||
LocalAS: 11111,
|
LocalAS: 11111,
|
||||||
|
|||||||
@@ -54,17 +54,10 @@ func TestMain(m *testing.M) {
|
|||||||
case "test_add_fail":
|
case "test_add_fail":
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
default:
|
default:
|
||||||
fmt.Println("success")
|
break
|
||||||
}
|
}
|
||||||
if os.Getenv("test_name") != "" {
|
if os.Getenv("test_name") != "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var err error
|
os.Exit(m.Run())
|
||||||
listener, err = NewBgpListener(22222)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
code := m.Run()
|
|
||||||
listener.Shutdown()
|
|
||||||
os.Exit(code)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user