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: use different tests for the demos #1523

Merged
merged 1 commit into from
Feb 4, 2022
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
5 changes: 3 additions & 2 deletions resources/scripts/pytest_otel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,15 @@ publish: package

## @help:demo-start-DEMO_NAME:Starts the demo from the demo folder, DEMO_NAME is the name of the demo type folder in the docs/demos folder (jaeger, elastic).
.PHONY: demo-start-%
demo-start-%:
demo-start-%: virtualenv install
$(MAKE) demo-stop-$*
mkdir -p $(DEMO_DIR)/$*/build
touch $(DEMO_DIR)/$*/build/tests.json
docker-compose -f $(DEMO_DIR)/$*/docker-compose.yml up -d
. $(DEMO_DIR)/$*/demo.env;\
env | grep OTEL;\
$(MAKE) test
source $(VENV)/bin/activate;\
pytest --capture=no docs/demos/test/test_demo.py || echo "Demo execution finished you can access to http://localhost:5601 to check the traces";

## @help:demo-stop-DEMO_NAME:Stops the demo from the demo folder, DEMO_NAME is the name of the demo type folder in the docs/demos folder (jaeger, elastic).
.PHONY: demo-stop-%
Expand Down
35 changes: 35 additions & 0 deletions resources/scripts/pytest_otel/docs/demos/test/test_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

pytest_plugins = ["pytester"]

import time
import logging
import pytest


def test_basic():
time.sleep(5)
pass

def test_success():
assert True

def test_failure():
assert 1 < 0

def test_failure_code():
d = 1/0
pass

@pytest.mark.skip
def test_skip():
assert True

@pytest.mark.xfail(reason="foo bug")
def test_xfail():
assert False

@pytest.mark.xfail(run=False)
def test_xfail_no_run():
assert False