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

Use local project functional test template #263

Conversation

dosaboy
Copy link
Member

@dosaboy dosaboy commented Oct 3, 2024

Need to make sure we use the local functional test template when looking up voting info in zosci-config. Falls back to default charm-functional-jobs if no local one found.

@dosaboy dosaboy force-pushed the func-tests-voting-check-use-local-project-func-template branch from 87be919 to a17da69 Compare October 3, 2024 09:50
@dosaboy dosaboy changed the title Use local project functioan test template Use local project functional test template Oct 3, 2024
dnegreira
dnegreira previously approved these changes Oct 3, 2024
Need to make sure we use the local functional test template
when looking up voting info in zosci-config. Falls back to
default charm-functional-jobs if no local one found.
@dosaboy dosaboy force-pushed the func-tests-voting-check-use-local-project-func-template branch from a17da69 to 72063d0 Compare October 3, 2024 11:30
with open('osci.yaml', encoding='utf-8') as fd:
self._osci_config = yaml.safe_load(fd)
path = os.path.join(os.environ.get('CHARM_ROOT_PATH', ''), 'osci.yaml')
with open(path, encoding='utf-8') as fd:
Copy link
Collaborator

@dnegreira dnegreira Oct 3, 2024

Choose a reason for hiding this comment

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

When opening a file we should have in an exception catcher so that we can handle it properly

Something like:

try:
    with open(path, encoding='utf-8') as fd:
        self._osci_config = yaml.safe_load(fd)
except Exception as e:
    print(f"Error opening {path}: {e}")


Copy link
Member Author

Choose a reason for hiding this comment

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

no i actually want it to fail hard since if it cant find this information it cant do its job properly (which is what happened before)

@dnegreira dnegreira merged commit d83ec3e into canonical:main Oct 3, 2024
3 checks passed
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