Loading .gitlab-ci.yml +4 −4 Original line number Diff line number Diff line Loading @@ -71,13 +71,13 @@ variables: before_script: - *test-scripts test-ping: test-health: extends: .test-base script: # test: ping responds pong - response_status=`curl -s -o "resp.txt" -w "%{http_code}" http://aws-auth-provider/ping` # test: GET /health responds 200 / "ok" - response_status=`curl -s -o "resp.txt" -w "%{http_code}" http://aws-auth-provider/health` - assert_eq "200" $response_status - assert_eq "pong" $(cat resp.txt) - assert_eq "ok" $(cat resp.txt) # test: get token with implicit env detection fails if no credentials are passed (error 401) test-token-no-creds-fails: Loading app/main.py +4 −3 Original line number Diff line number Diff line Loading @@ -2,11 +2,11 @@ import logging import os import re import tempfile from functools import cache from http import HTTPStatus from typing import Optional import boto3 from botocore.config import Config from fastapi import FastAPI, HTTPException, Query, Request, Response from fastapi.encoders import jsonable_encoder from fastapi.exceptions import RequestValidationError Loading Loading @@ -101,9 +101,9 @@ def getenv_checked(name: str) -> Optional[str]: return None if value == f"${name}" else value @app.get("/ping", response_class=PlainTextResponse) @app.get("/health", response_class=PlainTextResponse) def ping(): return "pong" return "ok" @app.exception_handler(Exception) Loading Loading @@ -133,6 +133,7 @@ async def request_validation_exception_handler( @app.get("/ecr/token", response_class=PlainTextResponse) @cache def get_ecr_token( env_ctx: str = Query(default=None, alias="env_ctx"), region: str = Query(default=None, alias="region"), Loading Loading
.gitlab-ci.yml +4 −4 Original line number Diff line number Diff line Loading @@ -71,13 +71,13 @@ variables: before_script: - *test-scripts test-ping: test-health: extends: .test-base script: # test: ping responds pong - response_status=`curl -s -o "resp.txt" -w "%{http_code}" http://aws-auth-provider/ping` # test: GET /health responds 200 / "ok" - response_status=`curl -s -o "resp.txt" -w "%{http_code}" http://aws-auth-provider/health` - assert_eq "200" $response_status - assert_eq "pong" $(cat resp.txt) - assert_eq "ok" $(cat resp.txt) # test: get token with implicit env detection fails if no credentials are passed (error 401) test-token-no-creds-fails: Loading
app/main.py +4 −3 Original line number Diff line number Diff line Loading @@ -2,11 +2,11 @@ import logging import os import re import tempfile from functools import cache from http import HTTPStatus from typing import Optional import boto3 from botocore.config import Config from fastapi import FastAPI, HTTPException, Query, Request, Response from fastapi.encoders import jsonable_encoder from fastapi.exceptions import RequestValidationError Loading Loading @@ -101,9 +101,9 @@ def getenv_checked(name: str) -> Optional[str]: return None if value == f"${name}" else value @app.get("/ping", response_class=PlainTextResponse) @app.get("/health", response_class=PlainTextResponse) def ping(): return "pong" return "ok" @app.exception_handler(Exception) Loading Loading @@ -133,6 +133,7 @@ async def request_validation_exception_handler( @app.get("/ecr/token", response_class=PlainTextResponse) @cache def get_ecr_token( env_ctx: str = Query(default=None, alias="env_ctx"), region: str = Query(default=None, alias="region"), Loading