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

[CI] Add binary run tests #22

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

[CI] Add binary run tests #22

wants to merge 10 commits into from

Conversation

Herklos
Copy link
Member

@Herklos Herklos commented Feb 17, 2021

No description provided.

@Herklos Herklos force-pushed the feature/add-tests branch 12 times, most recently from 717751d to b3feada Compare February 20, 2021 11:10
Copy link
Member

@GuillaumeDSM GuillaumeDSM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pytest.fixture
def start_binary():
clear_octobot_previous_folders()
with TemporaryFile() as output, TemporaryFile() as err:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

terminate_binary(binary_process, output, err)


def create_binary(binary_options, output_file, err_file):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this function be named 'start_binary' ?

preexec_fn=os.setsid if not is_on_windows() else None)


def terminate_binary(binary_process, output_file, err_file):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

with TemporaryFile() as output, TemporaryFile() as err:
binary_process = create_binary("", output, err)
yield
terminate_binary(binary_process, output, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should put this call in a finally

time.sleep(LOG_CONTENT_TEST_WAITING_TIME)
log_content = get_log_file_content()
logger.debug(log_content)
assert "BALANCE PROFITABILITY :" in log_content
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great tests !

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could add while loop for the test_version_endpoint, test_evaluation_state_created and test_balance_profitability_updated instead of time.sleep() to speed up the test when possible ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that there is a lot of time to save, but it would be a great improvement.

@Herklos Herklos force-pushed the feature/add-tests branch 6 times, most recently from b89d823 to 05c6a5c Compare February 25, 2021 22:06
@Herklos Herklos force-pushed the feature/add-tests branch 8 times, most recently from 217e782 to 4ea7304 Compare March 4, 2021 09:31
finally:
logger.debug("Killing binary process...")
if is_on_windows():
subprocess.call(["taskkill", "/F", "/IM", "OctoBot_windows.exe"])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


BINARY_DISABLE_WEB_OPTION = "-nw"
LOG_CHECKS_MAX_ATTEMPTS = 300
DEFAULT_TIMEOUT_WINDOW = -95
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Herklos Herklos changed the title WIP [CI] Add binary run tests [CI] Add binary run tests Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants