mirror of https://github.com/sunface/rust-course
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
471 B
30 lines
471 B
package api
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/mafanr/g"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestTfeStartStop(t *testing.T) {
|
|
p := &Proxy{}
|
|
g.InitConfig("../tfe.conf")
|
|
g.InitLogger()
|
|
|
|
go func() {
|
|
p.Start()
|
|
}()
|
|
|
|
time.Sleep(2 * time.Second)
|
|
|
|
resp, err := http.Get("http://localhost:" + g.Conf.Common.Port + "/service/api?service_id=" + g.TEST_API_NAME)
|
|
assert.NoError(t, err)
|
|
assert.Equal(t, 200, resp.StatusCode)
|
|
|
|
p.Shutdown()
|
|
}
|