Skip to content

Conversation

@vilit1
Copy link
Contributor

@vilit1 vilit1 commented Mar 5, 2025

well... I had to fix checks too...

The goal here is to make the tests more tolerant of state changes. Now there is:

  1. fetch resources before
  2. get the support bundle (or check results)
  3. fetch resources after
    For the comparison, first the before (1) and the support bundle (2) are compared. If there are extra or missing resources, the after (3) is also compared.

NOTE: this is ONLY for workload resources since the custom resources seem to be more "stable".

This will not get rid of the possibility of a resource showing up after 1, being caught in the support bundle, and being deleted before 3 (and the reverse missing resource scenario).

Some other improvements:

  1. use the correct fixture (only need cluster connection)
  2. remove the "." splitting in the name checks
  3. Note some gaps (for future fixes)
  4. For missing resources in support bundle - add in a labels output to help determine cause of error faster
    image
    Extra resources do not have this (as in the kubectl mapping is missing).

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] 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).

ignore_extras=True,
ignore_missing=True,
pre_expected_names=ser_files,
post_expected_names=[]
Copy link
Contributor Author

@vilit1 vilit1 Mar 6, 2025

Choose a reason for hiding this comment

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

note that I removed ignore extras and missing. If the auto test is still flaky (cause 2 bundles) - I can re-add them but I would want to make sure the warnings show up in the pytest results

@vilit1
Copy link
Contributor Author

vilit1 commented Mar 7, 2025

@vilit1 vilit1 marked this pull request as ready for review March 7, 2025 00:41
@vilit1 vilit1 requested a review from digimaun as a code owner March 7, 2025 00:41
expected_names = [name.split(".")[0] for name in expected_names]
result_names = [name.split(".")[0] for name in result_names]
extra_names = [name for name in result_names if name not in expected_names]
# vilit double check if ^ is still needed
Copy link
Contributor Author

Choose a reason for hiding this comment

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

currently with int testing - this is no longer needed, might not be true with containerized tests

assert pod_evals[0]["name"] == f"pod/{pod_name}"

# check phase and conditions
phase_conditions_eval = [pod for pod in pod_evals if "status.phase" in pod["value"]].pop()
Copy link
Member

Choose a reason for hiding this comment

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

nit, more like [eval for eval in pod_evals if "status.phase" in eval["value"]].pop() ?

Also usage of 1 .pop() implies a single eval should be asserted for status.phase, but then why list comprehension?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

have not looked at this code in a while - prob need to use next instead

@vilit1
Copy link
Contributor Author

vilit1 commented Mar 10, 2025

new example of error text:
changed the extra/missing names manually:
image

(note that this is the mq test so extra name aio-broker-backend-1-0 is ok)
image

the rest is not ok:
image

@vilit1 vilit1 merged commit 78b1f3c into dev Mar 10, 2025
42 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.

3 participants