Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
af578d1
Merge branch 'master' into CI-container-logs
Superskyyy Feb 17, 2022
2ceab90
test error intentional
Superskyyy Feb 17, 2022
c11f82b
test error intentional
Superskyyy Feb 17, 2022
2e6e4fd
test error intentional
Superskyyy Feb 17, 2022
8b82be0
test error intentional
Superskyyy Feb 17, 2022
fea6ca6
test error intentional
Superskyyy Feb 17, 2022
bc4a883
test error intentional
Superskyyy Feb 17, 2022
93916ca
test error intentional
Superskyyy Feb 17, 2022
5f7aaef
test error intentional
Superskyyy Feb 17, 2022
4f75ca1
test error intentional
Superskyyy Feb 17, 2022
b3e1627
test error intentional
Superskyyy Feb 17, 2022
1a62940
test error intentional
Superskyyy Feb 17, 2022
e3cffe2
Updated submodule protocol
Superskyyy Feb 17, 2022
b475c41
test error intentional
Superskyyy Feb 17, 2022
bd5111b
test error intentional
Superskyyy Feb 17, 2022
d4e49fa
test error intentional
Superskyyy Feb 17, 2022
fa21700
test error intentional
Superskyyy Feb 17, 2022
2b52b72
test error intentional
Superskyyy Feb 17, 2022
4f1bb04
test error intentional
Superskyyy Feb 17, 2022
c7522d4
test error intentional
Superskyyy Feb 17, 2022
254b0ee
test error intentional
Superskyyy Feb 17, 2022
1d26ace
test error intentional
Superskyyy Feb 17, 2022
327dfab
test error intentional
Superskyyy Feb 17, 2022
0640b20
test error intentional
Superskyyy Feb 17, 2022
3b02266
test error intentional
Superskyyy Feb 17, 2022
4ac50b0
test error intentional
Superskyyy Feb 17, 2022
63fcab4
test error intentional
Superskyyy Feb 17, 2022
1fe92ca
test error intentional
Superskyyy Feb 17, 2022
f372297
test error intentional
Superskyyy Feb 17, 2022
67b7a87
test error intentional
Superskyyy Feb 17, 2022
5110236
test error intentional
Superskyyy Feb 17, 2022
c066bda
test error intentional
Superskyyy Feb 17, 2022
082e92e
test error intentional
Superskyyy Feb 17, 2022
f82beae
add timeout to requests bassed connections
Superskyyy Feb 17, 2022
ca9e995
add timeout to requests bassed connections
Superskyyy Feb 17, 2022
41b542a
add timeout to requests bassed connections
Superskyyy Feb 17, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
name: Plugin and Unit Tests
needs: prep-plugin-and-unit-tests
runs-on: ubuntu-latest
timeout-minutes: 60
timeout-minutes: 30
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
Expand Down
6 changes: 5 additions & 1 deletion skywalking/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ def install():
plugin.install()
logger.debug('Successfully installed plugin %s', modname)
except Exception:
logger.warning('failed to install plugin %s', modname)
logger.warning(
'plugin %s failed to install, please disregard this warning '
'if the corresponding package was not used in your project',
modname
)
traceback.print_exc() if logger.isEnabledFor(logging.DEBUG) else None


Expand Down
43 changes: 21 additions & 22 deletions tests/plugin/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,34 @@ def prepare():


@pytest.fixture
def docker_compose(request, prepare, version):
# type: (FixtureRequest, Callable, str) -> None

def docker_compose(request: FixtureRequest, prepare: Callable, version: str) -> None:
module = request.module
cwd = dirname(inspect.getfile(module))

if version:
with open(os.path.join(cwd, 'requirements.txt'), mode='w') as req:
req.write(version)

compose = DockerCompose(filepath=cwd)

compose.start()
with DockerCompose(filepath=cwd) as compose:
exception = None
exception_delay = 0
stdout, stderr = None, None
for _ in range(10):
try:
time.sleep(10)
prepare()
exception = None
break
except Exception as e:
exception_delay += 10
exception = e
stdout, stderr = compose.get_logs()

exception = None
exception_delay = 100
for _ in range(0, 10):
try:
prepare()
exception = None
break
except Exception as e:
time.sleep(10)
exception = e
if exception:
time.sleep(exception_delay)
compose.stop()
raise Exception(f"""Wait time exceeded {exception_delay} secs. Exception {exception}""")
if exception:
print(f'STDOUT:\n{stdout.decode("utf-8")}')
print('==================================')
print(f'STDERR:\n{stderr.decode("utf-8")}')

yield compose
raise Exception(f"""Wait time exceeded {exception_delay} secs. Exception {exception}""")

compose.stop()
yield compose
2 changes: 1 addition & 1 deletion tests/plugin/data/sw_elasticsearch/test_elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/users')
return lambda *_: requests.get('http://0.0.0.0:9090/users', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/data/sw_kafka/test_kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/users')
return lambda *_: requests.get('http://0.0.0.0:9090/users', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/data/sw_mysqlclient/services/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@app.route('/users', methods=['POST', 'GET'])
def application():
res = requests.post('http://provider:9091/users')
res = requests.post('http://provider:9091/users', timeout=5)
return jsonify(res.json())

PORT = 9090
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/data/sw_mysqlclient/test_mysqlclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/users')
return lambda *_: requests.get('http://0.0.0.0:9090/users', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/data/sw_psycopg/services/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@app.route('/users', methods=['POST', 'GET'])
def application():
res = requests.post('http://provider:9091/users')
res = requests.post('http://provider:9091/users', timeout=5)
return jsonify(res.json())

PORT = 9090
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/data/sw_psycopg/test_psycopg.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/users')
return lambda *_: requests.get('http://0.0.0.0:9090/users', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/data/sw_psycopg2/services/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@app.route('/users', methods=['POST', 'GET'])
def application():
res = requests.post('http://provider:9091/users')
res = requests.post('http://provider:9091/users', timeout=5)
return jsonify(res.json())

PORT = 9090
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/data/sw_psycopg2/test_psycopg2.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/users')
return lambda *_: requests.get('http://0.0.0.0:9090/users', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
6 changes: 3 additions & 3 deletions tests/plugin/data/sw_pymongo/services/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

@app.route('/users', methods=['POST', 'GET'])
def application():
requests.get('http://provider:9091/insert_many')
requests.get('http://provider:9091/find_one')
res = requests.get('http://provider:9091/delete_one')
requests.get('http://provider:9091/insert_many', timeout=5)
requests.get('http://provider:9091/find_one', timeout=5)
res = requests.get('http://provider:9091/delete_one', timeout=5)
return jsonify(res.json())

PORT = 9090
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/data/sw_pymongo/test_pymongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/users')
return lambda *_: requests.get('http://0.0.0.0:9090/users', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/data/sw_pymysql/services/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@app.route('/users', methods=['POST', 'GET'])
def application():
res = requests.post('http://provider:9091/users')
res = requests.post('http://provider:9091/users', timeout=5)
return jsonify(res.json())

PORT = 9090
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/data/sw_pymysql/test_pymysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/users')
return lambda *_: requests.get('http://0.0.0.0:9090/users', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/data/sw_rabbitmq/test_rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/users')
return lambda *_: requests.get('http://0.0.0.0:9090/users', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/data/sw_redis/services/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@app.route('/users', methods=['POST', 'GET'])
def application():
res = requests.post('http://provider:9091/users')
res = requests.post('http://provider:9091/users', timeout=5)
return jsonify(res.json())

PORT = 9090
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/data/sw_redis/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/users')
return lambda *_: requests.get('http://0.0.0.0:9090/users', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
4 changes: 3 additions & 1 deletion tests/plugin/docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ version: '2.1'

services:
collector:
image: ghcr.io/apache/skywalking-agent-test-tool/mock-collector:5acb890f225ca37ee60675ce3e330545e23e3cbc
image: ghcr.io/apache/skywalking-agent-test-tool/mock-collector:092c6a3c753684b5a301baf5bcb1965f2dfaf79d
ports:
- 19876:19876
- 12800:12800
Expand All @@ -40,6 +40,8 @@ services:
environment:
SW_AGENT_COLLECTOR_BACKEND_SERVICES: collector:19876
SW_AGENT_LOGGING_LEVEL: DEBUG
# Agent test tool does not support profiling, TODO: address in e2e ref: #155
SW_AGENT_PROFILE_ACTIVE: 'False'
networks:
- beyond
command: ['python3', '/entrypoint.py']
2 changes: 1 addition & 1 deletion tests/plugin/http/sw_aiohttp/test_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture # pyre-ignore
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/skywalking')
return lambda *_: requests.get('http://0.0.0.0:9090/skywalking', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/http/sw_http/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.post('http://0.0.0.0:9090')
return lambda *_: requests.post('http://0.0.0.0:9090', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/http/sw_http_wsgi/test_http_wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.post('http://0.0.0.0:9090')
return lambda *_: requests.post('http://0.0.0.0:9090', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/http/sw_requests/services/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def do_POST(self): # noqa
self.send_header('Content-Type', 'application/json; charset=utf-8')
self.end_headers()

res = requests.post('http://provider:9091/users')
res = requests.post('http://provider:9091/users', timeout=5)
self.wfile.write(str(res.json()).encode('utf8'))

PORT = 9090
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/http/sw_requests/test_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.post('http://0.0.0.0:9090')
return lambda *_: requests.post('http://0.0.0.0:9090', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/http/sw_urllib3/test_urllib3.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/users')
return lambda *_: requests.get('http://0.0.0.0:9090/users', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/web/sw_django/services/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


def index(request):
res = requests.post('http://provider:9091/users')
res = requests.post('http://provider:9091/users', timeout=5)
return JsonResponse(res.json())


Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/web/sw_django/test_django.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/users?test=test1&test=test2&test2=test2')
return lambda *_: requests.get('http://0.0.0.0:9090/users?test=test1&test=test2&test2=test2', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/web/sw_falcon/services/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@hug.get('/users')
def get():
res = requests.get('http://provider:9091/users')
res = requests.get('http://provider:9091/users', timeout=5)
return res.json()


Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/web/sw_falcon/test_falcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/users')
return lambda *_: requests.get('http://0.0.0.0:9090/users', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/web/sw_fastapi/services/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@app.get('/users')
async def application():
res = requests.get('http://provider:9091/users')
res = requests.get('http://provider:9091/users', timeout=5)
return res.json()

uvicorn.run(app, host='0.0.0.0', port=9090)
2 changes: 1 addition & 1 deletion tests/plugin/web/sw_fastapi/test_fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/users?test=test1&test=test2&test2=test2')
return lambda *_: requests.get('http://0.0.0.0:9090/users?test=test1&test=test2&test2=test2', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
4 changes: 2 additions & 2 deletions tests/plugin/web/sw_flask/services/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ def application():

@runnable(op='/test')
def post():
requests.post('http://provider:9091/users')
requests.post('http://provider:9091/users', timeout=5)

from threading import Thread
t = Thread(target=post)
t.start()

res = requests.post('http://provider:9091/users')
res = requests.post('http://provider:9091/users', timeout=5)

t.join()

Expand Down
4 changes: 2 additions & 2 deletions tests/plugin/web/sw_flask/test_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/users?test=test1&test=test2&test2=test2')
return lambda *_: requests.get('http://0.0.0.0:9090/users?test=test1&test=test2&test2=test2', timeout=5)


class TestPlugin(TestPluginBase):
@pytest.mark.parametrize('version', get_test_vector(lib_name='flask', support_matrix=support_matrix))
def test_plugin(self, docker_compose, version):
self.validate()

response = requests.get('http://0.0.0.0:9090/users')
response = requests.get('http://0.0.0.0:9090/users', timeout=5)
assert response.status_code == 200
assert response.json()['correlation'] == 'correlation'
2 changes: 1 addition & 1 deletion tests/plugin/web/sw_pyramid/test_pyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture
def prepare():
# type: () -> Callable
return lambda *_: requests.get('http://0.0.0.0:9090/pyramid')
return lambda *_: requests.get('http://0.0.0.0:9090/pyramid', timeout=5)


class TestPlugin(TestPluginBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/web/sw_sanic/services/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

@app.route('/users', methods=['GET'])
async def application(req):
res = requests.get('http://provider:9091/users')
res = requests.get('http://provider:9091/users', timeout=5)
return response.json(res.json())

PORT = 9090
Expand Down
Loading