Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RuntimeError #1334

Merged
merged 2 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions connaisseur/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
from connaisseur.logging import ConnaisseurLoggingWrapper

if __name__ == "__main__":
# allow nested asyncio loops
nest_asyncio.apply()

LOG_LEVEL = os.environ.get("LOG_LEVEL", "INFO")

dictConfig(
Expand All @@ -36,9 +39,6 @@
certificate="/app/certs/tls.crt", private_key="/app/certs/tls.key"
)

# allow nested asyncio loops
nest_asyncio.apply()

# wrap Connaisseur with a layer that logs HTTP requests
app = ConnaisseurLoggingWrapper(APP, LOG_LEVEL)

Expand Down
8 changes: 1 addition & 7 deletions connaisseur/flask_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
"""
CONFIG = Config()

"""
Initiating and setting an event loop,
"""
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)

metrics = PrometheusMetrics(
APP,
defaults_prefix=NO_PREFIX,
Expand Down Expand Up @@ -70,7 +64,7 @@ def mutate():
Handle the '/mutate' path and accept CREATE and UPDATE requests.
Send a response back, which either denies or allows the request.
"""
result = loop.run_until_complete(__async_mutate())
result = asyncio.get_event_loop().run_until_complete(__async_mutate())
return result


Expand Down
3 changes: 2 additions & 1 deletion tests/integration/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ TIMEOUT=30
RETRY=3

## Backup helm/values.yaml
cp helm/values.yaml values.yaml.Backup
cp helm/values.yaml values.yaml.backup

## LOAD PUBLIC KEY
COSIGN_PUBLIC_KEY="$(printf -- "${COSIGN_PUBLIC_KEY//<br>/\\n }")"
Expand Down Expand Up @@ -607,5 +607,6 @@ fi
echo 'Cleaning up installation and test resources...'
make uninstall >/dev/null 2>&1 || true
kubectl delete all,cronjobs,daemonsets,jobs,replicationcontrollers,statefulsets,namespaces -luse="connaisseur-integration-test" -A >/dev/null
rm ghcr-values ghcr-validator
mv values.yaml.backup helm/values.yaml
echo 'Finished cleanup.'
Loading