Skip to content

Commit

Permalink
🐛 Fix Firebase tokens doc name
Browse files Browse the repository at this point in the history
  • Loading branch information
michprev committed Dec 9, 2024
1 parent 0aba6bb commit f8bd21f
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions wake/testing/pytest_plugin_multiprocess_server.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import logging
import multiprocessing
import multiprocessing.connection
import os
import pickle
import shutil
import signal
import logging
from contextlib import nullcontext
from pathlib import Path
from typing import Dict, List, Optional, Tuple, Union
Expand All @@ -16,20 +16,20 @@

from wake.cli.console import console
from wake.config import WakeConfig
from wake.core import get_logger
from wake.testing.coverage import (
CoverageHandler,
IdeFunctionCoverageRecord,
IdePosition,
export_merged_ide_coverage,
write_coverage,
)
from wake.core import get_logger

logger = get_logger(__name__)

from .pytest_plugin_multiprocess import PytestWakePluginMultiprocess
from firebase_admin import credentials, db, initialize_app, messaging

from firebase_admin import credentials, messaging, initialize_app, db
from .pytest_plugin_multiprocess import PytestWakePluginMultiprocess


class PytestWakePluginMultiprocessServer:
Expand Down Expand Up @@ -77,17 +77,21 @@ def __init__(
self._session_id = str(uuid4())

if remote and config.api_keys.get("wake_remote") is not None:
cred = credentials.Certificate(config.global_config_path.parent / "fuzz-firebase-adminsdk.json")
cred = credentials.Certificate(
config.global_config_path.parent / "fuzz-firebase-adminsdk.json"
)
initialize_app(
cred,
{
"databaseURL": "https://wake-remote-default-rtdb.europe-west1.firebasedatabase.app/"
}
},
)

x = db.reference("/")
try:
self._firebase_token = x.child("tokens").child(config.api_keys["wake_remote"]).get()
self._firebase_token = (
x.child("token").child(config.api_keys["wake_remote"]).get()
)
if self._firebase_token is None:
logger.warning("No Firebase token found for remote server.")
except Exception as e:
Expand Down Expand Up @@ -143,7 +147,7 @@ def pytest_sessionstart(self, session: pytest.Session):
notification=messaging.Notification(
title="New fuzzing session started",
body=f"{self._proc_count} tasks",
)
),
)
messaging.send(message)

Expand Down Expand Up @@ -268,7 +272,7 @@ def pytest_runtestloop(self, session: pytest.Session):
notification=messaging.Notification(
title=f"Exception {exception_info[0]}",
body=f"Process #{index}",
)
),
)
messaging.send(message)

Expand Down Expand Up @@ -307,7 +311,7 @@ def pytest_runtestloop(self, session: pytest.Session):
notification=messaging.Notification(
title="Breakpoint reached",
body=f"Process #{index}",
)
),
)
messaging.send(message)

Expand Down Expand Up @@ -381,7 +385,7 @@ def pytest_runtestloop(self, session: pytest.Session):
notification=messaging.Notification(
title="Internal pytest error",
body=f"Process #{index}",
)
),
)
messaging.send(message)

Expand Down

0 comments on commit f8bd21f

Please sign in to comment.