2025-02-12 19:00:25 +00:00
|
|
|
package endtoend_test
|
2025-01-15 19:45:51 +00:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"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-04-25 17:02:50 +00:00
|
|
|
t.Parallel()
|
2025-01-15 19:45:51 +00:00
|
|
|
ctx := context.Background()
|
|
|
|
|
|
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-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-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-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-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
|
|
|
|
|
|
|
|
test.PrintContainerLogs(t, c.API.Container)
|
2025-01-15 19:45:51 +00:00
|
|
|
}
|