2025-02-12 19:00:25 +00:00
|
|
|
package endtoend_test
|
2025-01-15 19:45:51 +00:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"net/http"
|
|
|
|
|
"testing"
|
|
|
|
|
|
2025-03-19 11:54:14 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
|
2025-03-05 12:05:46 +00:00
|
|
|
"queryorchestration/internal/test"
|
|
|
|
|
|
2025-01-15 19:45:51 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
2025-03-17 18:14:15 +00:00
|
|
|
func TestQueryAPIAccessories(t *testing.T) {
|
2025-06-03 13:52:10 +00:00
|
|
|
ctx := t.Context()
|
2025-01-15 19:45:51 +00:00
|
|
|
|
2025-04-02 18:50:03 +00:00
|
|
|
cfg := &Config{}
|
|
|
|
|
|
2025-04-22 14:40:16 +00:00
|
|
|
c, cleanup := test.CreateAPINetwork(t, ctx, cfg, test.QueryAPI)
|
2025-01-15 19:45:51 +00:00
|
|
|
defer cleanup()
|
|
|
|
|
|
2025-04-22 14:40:16 +00:00
|
|
|
resp, err := http.Get(fmt.Sprintf("%s/swagger/doc.json", c.API.URI))
|
2025-03-19 11:54:14 +00:00
|
|
|
require.NoError(t, err)
|
2025-06-23 15:58:20 +00:00
|
|
|
defer resp.Body.Close()
|
2025-01-15 19:45:51 +00:00
|
|
|
assert.NotNil(t, resp)
|
|
|
|
|
assert.Equal(t, http.StatusOK, resp.StatusCode)
|
|
|
|
|
|
2025-04-22 14:40:16 +00:00
|
|
|
resp, err = http.Get(fmt.Sprintf("%s/swagger/doc.yaml", c.API.URI))
|
2025-03-19 11:54:14 +00:00
|
|
|
require.NoError(t, err)
|
2025-06-23 15:58:20 +00:00
|
|
|
defer resp.Body.Close()
|
2025-01-15 19:45:51 +00:00
|
|
|
assert.NotNil(t, resp)
|
|
|
|
|
assert.Equal(t, http.StatusOK, resp.StatusCode)
|
|
|
|
|
|
2025-04-22 14:40:16 +00:00
|
|
|
resp, err = http.Get(fmt.Sprintf("%s/swagger/index.html", c.API.URI))
|
2025-03-19 11:54:14 +00:00
|
|
|
require.NoError(t, err)
|
2025-06-23 15:58:20 +00:00
|
|
|
defer resp.Body.Close()
|
2025-01-15 19:45:51 +00:00
|
|
|
assert.NotNil(t, resp)
|
|
|
|
|
assert.Equal(t, http.StatusOK, resp.StatusCode)
|
2025-02-21 17:05:37 +00:00
|
|
|
|
2025-04-22 14:40:16 +00:00
|
|
|
resp, err = http.Get(fmt.Sprintf("%s/metrics", c.API.URI))
|
2025-03-19 11:54:14 +00:00
|
|
|
require.NoError(t, err)
|
2025-06-23 15:58:20 +00:00
|
|
|
defer resp.Body.Close()
|
2025-02-21 17:05:37 +00:00
|
|
|
assert.NotNil(t, resp)
|
|
|
|
|
assert.Equal(t, http.StatusOK, resp.StatusCode)
|
2025-05-05 09:31:21 +00:00
|
|
|
|
2025-06-09 23:30:06 +00:00
|
|
|
resp, err = http.Get(fmt.Sprintf("%s/health", c.API.URI))
|
|
|
|
|
require.NoError(t, err)
|
2025-06-23 15:58:20 +00:00
|
|
|
defer resp.Body.Close()
|
2025-06-09 23:30:06 +00:00
|
|
|
assert.NotNil(t, resp)
|
|
|
|
|
assert.Equal(t, http.StatusOK, resp.StatusCode)
|
|
|
|
|
|
2025-05-05 09:31:21 +00:00
|
|
|
test.PrintContainerLogs(t, c.API.Container)
|
2025-01-15 19:45:51 +00:00
|
|
|
}
|