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: improve name splitting in support bundle tests #278

Merged
merged 9 commits into from
Jul 25, 2024

Conversation

vilit1
Copy link
Contributor

@vilit1 vilit1 commented Jul 24, 2024

example offender:
pod.aio-dataflow-upgrade-status-job-0.1.0-preview-rc9-4q4pg.aio-dataflow-upgrade-status-job.log

normal split will split by the ".", resulting in
['pod', 'aio-dataflow-upgrade-status-job-0', '1', '0-preview-rc9-4q4pg', 'aio-dataflow-upgrade-status-job', 'log']
which is bad
so we check if it is alpha numeric and try to join the name back together to get
['pod', 'aio-dataflow-upgrade-status-job-0.1.0-preview-rc9-4q4pg', 'aio-dataflow-upgrade-status-job', 'log']

Note this will break if there is a pod with a name with .'s that does not follow these rules. At this point there is no way to know what the expected pod name is without checking for the pod existence (and if it is a temporary/dynamic pod, it could be gone by then!!!).

image

image


This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Thank you for contributing to Azure IoT Operations tooling!

This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

Intent for Production

  • It is expected that pull requests made to default or core branches such as dev or main are of production grade. Corollary to this, any merged contributions to these branches may be deployed in a public release at any given time. By checking this box, you agree and commit to the expected production quality of code.

Basic expectations

  • If introducing new functionality or modified behavior, are they backed by unit and/or integration tests?
  • In the same context as above are command names and their parameter definitions accurate? Do help docs have sufficient content?
  • Have all the relevant unit and integration tests pass? i.e. pytest <project root> -vv. Please provide evidence in the form of a screenshot showing a succesful run of tests locally OR a link to a test pipeline that has been run against the change-set.
  • Have linter checks passed using the .pylintrc and .flake8 rules? Look at the CI scripts for example usage.
  • Have extraneous print or debug statements, commented out code-blocks or code-statements (if any) been removed from the surface area of changes?
  • Have you made an entry in HISTORY.rst which concisely explains your user-facing feature or change?

Azure IoT Operations CLI maintainers reserve the right to enforce any of the outlined expectations.

A PR is considered ready for review when all basic expectations have been met (or do not apply).

@vilit1 vilit1 requested a review from digimaun as a code owner July 24, 2024 20:11
@vilit1 vilit1 changed the title fix[test]: improve name splitting in support bundle tests fix: improve name splitting in support bundle tests Jul 24, 2024
@@ -159,9 +159,9 @@ def check_workload_resource_files(
assert f"{file['descriptor']}.{file.get('sub_descriptor')}" not in converted_file
converted_file[file["descriptor"]] = True
else:
assert file["sub_descriptor"] == "previous"
assert file["sub_descriptor"] == "previous", f"Full file name: {file['full_name']}, file_obj {file}"
Copy link
Contributor Author

@vilit1 vilit1 Jul 25, 2024

Choose a reason for hiding this comment

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

Hopefully this will not be needed with the -vv

v: praise the very verbose :v

@vilit1 vilit1 merged commit b4f0f50 into feature/0.6.0 Jul 25, 2024
31 checks passed
@vilit1 vilit1 deleted the split-name-improvement branch July 30, 2024 17:37
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