未验证 提交 26879f83 编写于 作者: K kezhenxu94 提交者: GitHub

Polish the test framework for simplicity of local test (#28)

- Extract as many commonly-used codes as possible
- Rename the test class to a more general one as contributors tend to copy-paste w/o modifying the class name
上级 bdcf6188
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
version: '2.1'
services:
collector:
build:
context: .
dockerfile: Dockerfile.tool
ports:
- 19876:19876
- 12800:12800
networks:
- beyond
healthcheck:
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/12800"]
interval: 5s
timeout: 60s
retries: 120
agent:
build:
context: ../../../
dockerfile: tests/plugin/docker/Dockerfile.agent
environment:
SW_AGENT_COLLECTOR_BACKEND_SERVICES: collector:19876
SW_AGENT_LOGGING_LEVEL: DEBUG
networks:
- beyond
command: ['python3', '/entrypoint.py']
......@@ -19,33 +19,18 @@ version: '2.1'
services:
collector:
build:
context: ../docker
dockerfile: Dockerfile.tool
ports:
- 19876:19876
- 12800:12800
networks:
- beyond
healthcheck:
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/12800"]
interval: 5s
timeout: 60s
retries: 120
extends:
service: collector
file: ../docker/docker-compose.base.yml
provider:
build:
context: ../../../
dockerfile: tests/plugin/docker/Dockerfile.agent
networks:
- beyond
extends:
service: agent
file: ../docker/docker-compose.base.yml
ports:
- 9091:9091
volumes:
- ./services/provider.py:/app/provider.py
environment:
SW_AGENT_COLLECTOR_BACKEND_SERVICES: collector:19876
command: ['python3', '/app/provider.py']
- ./services/provider.py:/entrypoint.py
depends_on:
collector:
condition: service_healthy
......@@ -56,18 +41,13 @@ services:
retries: 120
consumer:
build:
context: ../../../
dockerfile: tests/plugin/docker/Dockerfile.agent
networks:
- beyond
extends:
service: agent
file: ../docker/docker-compose.base.yml
ports:
- 9090:9090
volumes:
- ./services/consumer.py:/app/consumer.py
environment:
SW_AGENT_COLLECTOR_BACKEND_SERVICES: collector:19876
command: ['python3', '/app/consumer.py']
- ./services/consumer.py:/entrypoint.py
depends_on:
collector:
condition: service_healthy
......
......@@ -21,7 +21,6 @@ from skywalking import agent, config
if __name__ == '__main__':
config.service_name = 'consumer'
config.logging_level = 'DEBUG'
agent.start()
import socketserver
......
......@@ -21,7 +21,6 @@ from skywalking import agent, config
if __name__ == '__main__':
config.service_name = 'provider'
config.logging_level = 'DEBUG'
agent.start()
import socketserver
......
......@@ -26,7 +26,7 @@ from testcontainers.compose import DockerCompose
from tests.plugin import BasePluginTest
class TestRequestPlugin(BasePluginTest):
class TestPlugin(BasePluginTest):
@classmethod
def setUpClass(cls):
cls.compose = DockerCompose(filepath=dirname(abspath(__file__)))
......
......@@ -19,33 +19,18 @@ version: '2.1'
services:
collector:
build:
context: ../docker
dockerfile: Dockerfile.tool
ports:
- 19876:19876
- 12800:12800
networks:
- beyond
healthcheck:
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/12800"]
interval: 5s
timeout: 60s
retries: 120
extends:
service: collector
file: ../docker/docker-compose.base.yml
provider:
build:
context: ../../../
dockerfile: tests/plugin/docker/Dockerfile.agent
networks:
- beyond
extends:
service: agent
file: ../docker/docker-compose.base.yml
ports:
- 9091:9091
volumes:
- ./services/provider.py:/app/provider.py
environment:
SW_AGENT_COLLECTOR_BACKEND_SERVICES: collector:19876
command: ['python3', '/app/provider.py']
- ./services/provider.py:/entrypoint.py
depends_on:
collector:
condition: service_healthy
......@@ -56,18 +41,13 @@ services:
retries: 120
consumer:
build:
context: ../../../
dockerfile: tests/plugin/docker/Dockerfile.agent
networks:
- beyond
extends:
service: agent
file: ../docker/docker-compose.base.yml
ports:
- 9090:9090
volumes:
- ./services/consumer.py:/app/consumer.py
environment:
SW_AGENT_COLLECTOR_BACKEND_SERVICES: collector:19876
command: ['python3', '/app/consumer.py']
- ./services/consumer.py:/entrypoint.py
depends_on:
collector:
condition: service_healthy
......
......@@ -21,7 +21,6 @@ from skywalking import agent, config
if __name__ == '__main__':
config.service_name = 'consumer'
config.logging_level = 'DEBUG'
agent.start()
import socketserver
......
......@@ -21,7 +21,6 @@ from skywalking import agent, config
if __name__ == '__main__':
config.service_name = 'provider'
config.logging_level = 'DEBUG'
agent.start()
from werkzeug import Request, Response
......
......@@ -26,7 +26,7 @@ from testcontainers.compose import DockerCompose
from tests.plugin import BasePluginTest
class TestRequestPlugin(BasePluginTest):
class TestPlugin(BasePluginTest):
@classmethod
def setUpClass(cls):
cls.compose = DockerCompose(filepath=dirname(abspath(__file__)))
......
......@@ -19,33 +19,18 @@ version: '2.1'
services:
collector:
build:
context: ../docker
dockerfile: Dockerfile.tool
ports:
- 19876:19876
- 12800:12800
networks:
- beyond
healthcheck:
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/12800"]
interval: 5s
timeout: 60s
retries: 120
extends:
service: collector
file: ../docker/docker-compose.base.yml
provider:
build:
context: ../../../
dockerfile: tests/plugin/docker/Dockerfile.agent
networks:
- beyond
extends:
service: agent
file: ../docker/docker-compose.base.yml
ports:
- 9091:9091
volumes:
- ./services/provider.py:/app/provider.py
environment:
SW_AGENT_COLLECTOR_BACKEND_SERVICES: collector:19876
command: ['python3', '/app/provider.py']
- ./services/provider.py:/entrypoint.py
depends_on:
collector:
condition: service_healthy
......@@ -56,18 +41,13 @@ services:
retries: 120
consumer:
build:
context: ../../../
dockerfile: tests/plugin/docker/Dockerfile.agent
networks:
- beyond
extends:
service: agent
file: ../docker/docker-compose.base.yml
ports:
- 9090:9090
volumes:
- ./services/consumer.py:/app/consumer.py
environment:
SW_AGENT_COLLECTOR_BACKEND_SERVICES: collector:19876
command: ['python3', '/app/consumer.py']
- ./services/consumer.py:/entrypoint.py
depends_on:
collector:
condition: service_healthy
......
......@@ -21,7 +21,6 @@ from skywalking import agent, config
if __name__ == '__main__':
config.service_name = 'consumer'
config.logging_level = 'DEBUG'
agent.start()
import socketserver
......
......@@ -21,7 +21,6 @@ from skywalking import agent, config
if __name__ == '__main__':
config.service_name = 'provider'
config.logging_level = 'DEBUG'
agent.start()
import socketserver
......
......@@ -26,7 +26,7 @@ from testcontainers.compose import DockerCompose
from tests.plugin import BasePluginTest
class TestRequestPlugin(BasePluginTest):
class TestPlugin(BasePluginTest):
@classmethod
def setUpClass(cls):
cls.compose = DockerCompose(filepath=dirname(abspath(__file__)))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册