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

test simple ccsp file #60

Merged
merged 8 commits into from
Feb 5, 2025
Merged

Conversation

ShaiahWren
Copy link
Contributor

@ShaiahWren ShaiahWren commented Feb 4, 2025

[AAP-39222]

Description

Similar to the CCSPv2 test where was checked all columns and values from a built CCSPv2 report, the work at hand builds and tests the more simple CCSP one.

Much of the logic is the same with a few key changes:

  • env vars now exclude 'END_USER' data such as city, state, country, and so forth.
  • report excludes the 'Usage by Organizations' sheet.
  • to more easily test the column in 'Usage Reporting', we will start on line 14 to grab the column header and then traverse from the top. To start at the very top introduces too much confusion because of how many blank lines there are in the top row.
  • added conftest.py file to store fixtures and static methods. Refactored as needed. This change ensures that the check for SonarCloud duplication passes. Without the shared helper functions, codebase dup is > 13%. Yikes!

Prerequisites

Enter the awx virtual env

docker exec -it tools_awx_1 /bin/sh -c " cd awx-dev/metrics-utility && . /var/lib/awx/venv/awx/bin/activate && exec /bin/sh "

Steps to Test

  1. From /metrics-utility run SETUPTOOLS_USE_DISTUTILS=true pytest -s

Expected Results

Both tests should pass

Required Actions

  • Requires follow-on pr once we are running in standalone mode
  • Add a separate fixture dir and load them from conftest.py
  • Manage wb close with context manager

Self-Review Checklist

Code Quality

  • Code is properly linted and formatted.
  • All tests (existing and new) pass successfully.
  • Tests are added or updated as needed.
  • Code includes relevant comments for complex sections.
  • Changes are reviewed and approved by at least two team members.
  • Documentation is updated where applicable.
    - If updates are required in the handbook, create a separate PR for the handbook repo.

Notes for Reviewers

Add any additional context or instructions for reviewers here - for example screenshots if needed.

@ShaiahWren ShaiahWren force-pushed the ccsp-simple-test branch 3 times, most recently from 48df0af to e1c8084 Compare February 5, 2025 00:06
Copy link

@dhaustein dhaustein left a comment

Choose a reason for hiding this comment

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

Left a few nitpicks otherwise LGTM.

I have one suggestion for the future however. While having the fixtures in conftest.py is absolutely fine, it does not scale well when the number of fixtures increases.

A trick I picked up in EDA was to create a number of semantically distinct "plugin" files for fixtures and load them in conftest at runtime. https://github.com/ansible/eda-qa/blob/main/conftest.py#L13-L39

But this is not a blocker or even a big deal right now, but might be something to think about for the future. 🙂

metrics_utility/test/ccspv_reports/conftest.py Outdated Show resolved Hide resolved
metrics_utility/test/ccspv_reports/conftest.py Outdated Show resolved Hide resolved
metrics_utility/test/ccspv_reports/conftest.py Outdated Show resolved Hide resolved
Copy link
Contributor

@MilanPospisil MilanPospisil left a comment

Choose a reason for hiding this comment

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

Tested and works :-)
LGTM 👍

Copy link

sonarqubecloud bot commented Feb 5, 2025

@ShaiahWren ShaiahWren merged commit 9685afa into ansible:devel Feb 5, 2025
5 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