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

OPIK-360 Andrei/projects crud tests #565

Merged
merged 7 commits into from
Nov 6, 2024
Merged

Conversation

AndreiCautisanu
Copy link
Contributor

@AndreiCautisanu AndreiCautisanu commented Nov 5, 2024

Details

  • Created automated suite for testing all projects CRUD operations according to OPIK-360. Tests and their descriptions can be found inside test_projects_crud_operations.py

  • Reorganized file structure in tests_end_to_end for better separation between sanity tests and specific feature test suites. WILL ADD A WORKFLOW FILE TO TEST RUN THIS ON ACTIONS TOMORROW

@AndreiCautisanu AndreiCautisanu requested a review from a team as a code owner November 6, 2024 12:24
Copy link
Collaborator

@ferc ferc left a comment

Choose a reason for hiding this comment

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

Great work! nice to see more coverage :)

def delete_project_by_name_sdk(name: str):
client = OpikApi()
project = find_project_by_name_sdk(name=name)
client.projects.delete_project_by_id(project[0]['id'])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure why project is an array here, maybe find_project_by_name_sdk should just return the first element and that's it?

Comment on lines +27 to +38
def wait_for_project_to_be_visible(project_name, timeout=10, initial_delay=1):
start_time = time.time()
delay = initial_delay

while time.time() - start_time < timeout:
if find_project_by_name_sdk(project_name):
return True

time.sleep(delay)
delay = min(delay*2, timeout-(time.time() - start_time))

raise TimeoutError(f'could not get created project {project_name} via API within {timeout} seconds')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pretty sure at some point we'll need an abstraction of this mechanism sending some function to wait until it's accomplished or throwing timeout as you did here (similar in TypeScript: https://playwright.dev/docs/test-assertions#expectpoll)

Comment on lines +1 to +10
{"input": "Paris", "expected_output": "Hello, Paris!"}
{"input": "London", "expected_output": "Hello, London!"}
{"input": "New York", "expected_output": "Hello, New York!"}
{"input": "Tokyo", "expected_output": "Hello, Tokyo!"}
{"input": "Berlin", "expected_output": "Hello, Berlin!"}
{"input": "Sydney", "expected_output": "Hello, Sydney!"}
{"input": "Cairo", "expected_output": "Hello, Cairo!"}
{"input": "Toronto", "expected_output": "Hello, Toronto!"}
{"input": "Stockholm", "expected_output": "Hello, Stockholm!"}
{"input": "Sao Paulo", "expected_output": "Hello, Sao Paulo!"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's okay for now but maybe worth to make the mock data more diverse to cover more cases in one shot? (different structures, different fields, and so on)

@ferc ferc merged commit 57e0056 into main Nov 6, 2024
5 checks passed
@ferc ferc deleted the andrei/projects-crud-tests branch November 6, 2024 13:43
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