Skip to content

Commit 5ab478f

Browse files
committed
Add logging
1 parent 78cda13 commit 5ab478f

File tree

1 file changed

+0
-133
lines changed

1 file changed

+0
-133
lines changed

tests/framework_azure/test_application.py

Lines changed: 0 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# import asyncio
16-
# import os
17-
# import pathlib
18-
# import random
19-
# import socket
20-
# import subprocess
21-
# import time
22-
2315
# import pytest
2416
import requests
2517
from testing_support.db_settings import azurefunction_settings
@@ -28,18 +20,6 @@
2820
# validate_transaction_metrics,
2921
# )
3022

31-
# from urllib.request import urlopen
32-
33-
# from azure_functions_worker import main
34-
35-
# from newrelic.api.web_transaction import web_transaction
36-
37-
# from azure_functions_worker.main import start_async
38-
# from azure_functions_worker.utils.dependency import DependencyManager
39-
40-
41-
# from testing_support.util import instance_hostname
42-
4323
DB_SETTINGS = azurefunction_settings()[0]
4424
AZURE_HOST = DB_SETTINGS["host"]
4525
AZURE_PORT = DB_SETTINGS["port"]
@@ -113,116 +93,3 @@ def test_ping():
11393
# assert response.status_code == 200
11494
# assert response.text == "Hello, Reli!"
11595
# assert response.headers["Content-Type"] == "text/plain"
116-
117-
118-
# ATTEMPT #2
119-
120-
121-
# def available_port():
122-
# """
123-
# Get an available port on the local machine.
124-
# """
125-
# sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
126-
# sock.bind(("", 0))
127-
# port = sock.getsockname()[1]
128-
# sock.close()
129-
# return port
130-
131-
132-
# # @pytest.fixture(autouse=True, scope="module")
133-
# # def func_start_storage_emulator():
134-
# # # Emulate storage
135-
# # subprocess.Popen(["azurite", "--tableHost", "127.0.0.1"])
136-
137-
138-
# # PORT = available_port()
139-
# PORT = 7071
140-
141-
142-
# # @validate_transaction_metrics(
143-
# # "function_app:basic_page",
144-
# # group="AzureFunction",
145-
# # # scoped_metrics=_test_application_index_scoped_metrics
146-
# # )
147-
# # @pytest.fixture(autouse=True, scope="module")
148-
# def func_start_dispatcher():
149-
# # azure_function_command = os.path.join(os.environ["TOX_ENV_DIR"], "bin", "func")
150-
# # azure_function_command = "func"
151-
152-
# # cmd = ["cd", f"{os.getcwd()}/tests/framework_azure/", "&&", "func", "start"] #, "--port", str(PORT)]
153-
# cmd = ["func", "start"] # , "--port", str(PORT)]
154-
# # cmd = ["cd", f"{os.environ.get('TOX_ENV_DIR')}/tests/framework_azure", "&&", "func", "start", "--port", str(PORT)]
155-
# cmd_str = " ".join(cmd)
156-
# # cmd = f"cd tests/framework_azure && newrelic-admin run-program func start --port {str(PORT)}"
157-
158-
# try:
159-
# # runs but on different process from instrumentation.
160-
# # We need to do this, but somehow on the same process
161-
# # subprocess.Popen(cmd_str, shell=True, env=os.environ, cwd=f"{os.getcwd()}") # nosec # also passes but diff process
162-
# subprocess.Popen(cmd, env=os.environ, cwd=f"{os.getcwd()}") # passes, but diff process
163-
# # subprocess.run(cmd, shell=True, env=os.environ) # nosec
164-
# # os.system(cmd_str) # nosec
165-
166-
# except Exception as e:
167-
# print(f"Error: {e}")
168-
169-
170-
# # @validate_transaction_metrics(
171-
# # "function_app:basic_page",
172-
# # group="AzureFunction",
173-
# # # scoped_metrics=_test_application_index_scoped_metrics
174-
# # )
175-
# def test_basic_function():
176-
# # @validate_transaction_metrics(
177-
# # "function_app:basic_page",
178-
# # group="AzureFunction",
179-
# # # scoped_metrics=_test_application_index_scoped_metrics
180-
# # )
181-
# # def _test():
182-
# # func_start_dispatcher()
183-
184-
# # _test()
185-
# func_start_dispatcher()
186-
# # Wait until the connection is established before making the request.
187-
# for _ in range(50):
188-
# sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
189-
# try:
190-
# sock.connect(("127.0.0.1", PORT))
191-
# sock.close()
192-
# break
193-
# except (socket.error, ConnectionRefusedError) as e:
194-
# pass
195-
196-
# time.sleep(0.5)
197-
198-
# response = requests.get(f"http://127.0.0.1:{PORT}/basic?user=Reli")
199-
# assert response.status_code == 200
200-
# assert response.text == "Hello, Reli!"
201-
# assert response.headers["Content-Type"] == "text/plain"
202-
# # response = requests.get(f"http://127.0.0.1:{PORT}/basic?user=Bradlington")
203-
# # assert response.status_code == 200
204-
# # assert response.text == "Hello, Bradlington!"
205-
# # assert response.headers["Content-Type"] == "text/plain"
206-
207-
208-
# def get_open_port():
209-
# s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
210-
# s.bind(("", 0))
211-
# port = s.getsockname()[1]
212-
# s.close()
213-
# return port
214-
215-
216-
# # DependencyManager.initialize()
217-
# # DependencyManager.use_worker_dependencies()
218-
219-
# @pytest.fixture(autouse=True, scope="module")
220-
# def target_dispatcher():
221-
# return asyncio.run(
222-
# start_async(
223-
# host="127.0.0.1",
224-
# port=get_open_port(),
225-
# worker_id="deadbeef-cafe-10c8-ba11-50de7ec7ab1e",
226-
# request_id="ba5eba11-ba5e-bead-5elf-affab1e0babe",
227-
# )
228-
# )

0 commit comments

Comments
 (0)