Exemple #1
0
func TestDataInput(t *testing.T) {
	api.Default = api.NewPipeline("Default")
	api.Default.Run(func(input interface{}) {})

	_, err := http.Post("http://localhost:8080/", "text/json", strings.NewReader(""))
	assert.NoError(t, err)
}
Exemple #2
0
func TestHealth(t *testing.T) {
	api.Default = api.NewPipeline("Default")

	resp, err := http.Get("http://localhost:8080/health")
	assert.Equal(t, resp.StatusCode, http.StatusNotModified)
	assert.NoError(t, err)

	api.Default.Run(func(input interface{}) {})
	resp, err = http.Get("http://localhost:8080/health")
	assert.Equal(t, resp.StatusCode, http.StatusOK)
	assert.NoError(t, err)

	api.Default.Stop()
	resp, err = http.Get("http://localhost:8080/health")
	assert.Equal(t, resp.StatusCode, http.StatusServiceUnavailable)
	assert.NoError(t, err)
}