-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a new oci-env profile with a "jwt proxy" for testing the dab client code in CI. No-Issue Signed-off-by: James Tanner <[email protected]>
- Loading branch information
Showing
19 changed files
with
528 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import action_lib | ||
|
||
env = action_lib.OCIEnvIntegrationTest( | ||
envs=[ | ||
{ | ||
"env_file": "dab_jwt.compose.env", | ||
"run_tests": True, | ||
"db_restore": None, | ||
"test_script": "/src/galaxy_ng/profiles/dab_jwt/run_integration.sh" | ||
} | ||
] | ||
) |
20 changes: 20 additions & 0 deletions
20
dev/oci_env_integration/oci_env_configs/dab_jwt.compose.env
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
COMPOSE_PROFILE=galaxy_ng/base:galaxy_ng/dab_jwt | ||
COMPOSE_PROJECT_NAME=ci-dab-proxy | ||
|
||
DEV_SOURCE_PATH=galaxy_ng | ||
COMPOSE_BINARY=docker | ||
SETUP_TEST_DATA=0 | ||
UPDATE_UI=0 | ||
ENABLE_SIGNING=1 | ||
HUB_API_ROOT=http://jwtproxy:8080/api/galaxy | ||
|
||
DJANGO_SUPERUSER_USERNAME=admin | ||
DJANGO_SUPERUSER_PASSWORD=admin | ||
|
||
PULP_GALAXY_API_PATH_PREFIX=/api/galaxy | ||
PULP_ANALYTICS=false | ||
|
||
# proxy config ... | ||
API_PORT=5001 | ||
JWT_PROXY_PORT=8080 | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import pytest | ||
|
||
|
||
@pytest.mark.deployment_standalone | ||
@pytest.mark.skipif( | ||
not os.getenv("ENABLE_DAB_TESTS"), | ||
reason="Skipping test because ENABLE_DAB_TESTS is not set" | ||
) | ||
def test_dab_collection_download_url_hostnames(settings, galaxy_client, published): | ||
""" | ||
We want the download url to point at the gateway | ||
""" | ||
gc = galaxy_client("admin") | ||
cv_url = 'v3/plugin/ansible/content/published/collections/index/' | ||
cv_url += f'{published.namespace}/{published.name}/versions/{published.version}' | ||
cv_info = gc.get(cv_url) | ||
download_url = cv_info['download_url'] | ||
assert download_url.startswith(gc.galaxy_root) | ||
|
||
# try to GET the tarball ... | ||
dl_resp = gc.get(download_url, parse_json=False) | ||
assert dl_resp.status_code == 200 | ||
assert dl_resp.headers.get('Content-Type') == 'application/gzip' | ||
|
||
# make sure the final redirect was through the gateway ... | ||
expected_url = gc.galaxy_root.replace('/api/galaxy/', '') | ||
assert dl_resp.url.startswith(expected_url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# galaxy_ng/dab | ||
|
||
## Usage | ||
|
||
This profile is used for running Galaxy NG with the JWT authentication integrations provided by django-ansible-base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
services: | ||
jwtproxy: | ||
build: | ||
context: "{SRC_DIR}/galaxy_ng/profiles/dab_jwt/proxy" | ||
ports: | ||
- "{JWT_PROXY_PORT}:{JWT_PROXY_PORT}" | ||
environment: | ||
UPSTREAM_URL: "http://pulp:{API_PORT}" | ||
PROXY_PORT: "{JWT_PROXY_PORT}" | ||
volumes: | ||
- "{SRC_DIR}/galaxy_ng/profiles/dab_jwt/proxy:/app:rw" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
galaxy_ng/base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[build] | ||
bin = "proxy" | ||
cmd = "go build -o proxy proxy.go" | ||
full_bin = "./proxy" | ||
|
||
exclude_regex = ["*.swp"] | ||
|
||
[run] | ||
cmd = "./proxy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM golang:alpine | ||
|
||
# hot reloads ... | ||
RUN go install github.com/cosmtrek/air@latest | ||
|
||
RUN mkdir -p /app | ||
WORKDIR /app | ||
|
||
CMD ["air"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module mockproxy | ||
|
||
go 1.16 | ||
|
||
require ( | ||
github.com/golang-jwt/jwt/v4 v4.4.1 | ||
github.com/google/uuid v1.6.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
github.com/golang-jwt/jwt/v4 v4.4.1 h1:pC5DB52sCeK48Wlb9oPcdhnjkz1TKt1D/P7WKJ0kUcQ= | ||
github.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= | ||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= | ||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= |
Oops, something went wrong.