Merged in feature/permit-integration-1 (pull request #172)

Permit integration - part 1

* WIP permit integration

* slim down build

* Merge branch 'main' of bitbucket.org:aarete/query-orchestration into feature/permit-integration-1

* omit swagger from auth

* clean build

* comment

* part 1 completed

this is the initial permitio parts and tests without integration. Also testing.md since we have a new test target `task test:permitio`

* feature flag for no jwt validation

* permit integration

* fix ci unit tests

* ci fix

* build fix

* fix home handler

* fix redirect

* test fix

* update docs for auth
This commit is contained in:
Jay Brown
2025-07-11 19:27:14 +00:00
parent 673ba503c8
commit 2ff6e05ffc
53 changed files with 2800 additions and 292 deletions
+26 -3
View File
@@ -9,6 +9,7 @@ import (
queryapi "queryorchestration/api/queryAPI"
"queryorchestration/internal/database/repository"
"queryorchestration/internal/serviceconfig"
"queryorchestration/internal/test"
"github.com/labstack/echo/v4"
@@ -20,9 +21,10 @@ func TestCreateClient(t *testing.T) {
t.Parallel()
cfg := &ControllerConfig{}
test.CreateDB(t, cfg)
initializeTestConfig(t, cfg)
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc)
cons := queryapi.NewControllers(svc, cfg)
body := queryapi.ClientCreate{
Name: "example_name",
@@ -48,9 +50,10 @@ func TestGetClient(t *testing.T) {
t.Parallel()
cfg := &ControllerConfig{}
test.CreateDB(t, cfg)
initializeTestConfig(t, cfg)
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc)
cons := queryapi.NewControllers(svc, cfg)
id := "client_id"
@@ -81,9 +84,10 @@ func TestUpdateClient(t *testing.T) {
t.Parallel()
cfg := &ControllerConfig{}
test.CreateDB(t, cfg)
initializeTestConfig(t, cfg)
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc)
cons := queryapi.NewControllers(svc, cfg)
id := "client_id"
@@ -110,6 +114,25 @@ func TestUpdateClient(t *testing.T) {
assert.Equal(t, "new_name", client.Name)
}
func initializeTestConfig(t testing.TB, cfg *ControllerConfig) {
// Reset the singleton config state for testing
serviceconfig.ResetConfigInitOnceTestOnly()
// Initialize the base configuration
err := serviceconfig.InitializeConfig(cfg)
require.NoError(t, err)
// Initialize auth configuration with test defaults
cfg.SetAuthUserPoolID("test-pool-id")
cfg.SetAuthClientID("test-client-id")
cfg.SetAuthClientSecret("test-client-secret")
cfg.SetAuthDomain("https://test-domain.com")
cfg.SetAuthRegion("us-east-1")
err = cfg.InitializeAuthConfig("http://localhost:8080", cfg.GetLogger())
require.NoError(t, err)
}
func createContext(t testing.TB) (echo.Context, *httptest.ResponseRecorder) {
return createContextWithJSONBody(t, struct{}{})
}