Skip to content

refactor(test): fix functional group naming, sanitize IPs, add build tooling - #4928

Open
balajikumaran-c-s wants to merge 9 commits into
dell:issue-4849-omnia-modernizationfrom
balajikumaran-c-s:issue-4849-omnia-modernization
Open

refactor(test): fix functional group naming, sanitize IPs, add build tooling#4928
balajikumaran-c-s wants to merge 9 commits into
dell:issue-4849-omnia-modernizationfrom
balajikumaran-c-s:issue-4849-omnia-modernization

Conversation

@balajikumaran-c-s

@balajikumaran-c-s balajikumaran-c-s commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Issues Resolved

Fixes #4849 — Omnia Modernization (Test Automation)

PR Description

Summary

Enhances the image_build_manager FVT suite with:

  • Centralized TEST_CASES dictionary for all TC IDs and titles
  • Optional venv_path config for target server venv activation
  • Fixed playbook path resolution (local mode uses source tree, remote uses clone_path)
  • Updated coding rules documentation
  • Rebuilt omnia-auto wheel with all fixes

Changes

1. Test Case Centralization (TEST_CASES Dictionary)

  • Introduced TEST_CASES dict in library/vars/test_case_vars.py with 38 entries
  • Each entry has id and title only — no hardcoded TC IDs in test files
  • All 11 test files updated to use tc = TEST_CASES["key"] pattern
  • Removed TC ID prefixes from docstrings and module-level comments

Before:

tl = TestLogger(TEST_NAMES["verify_resource"], "TC_PR_002")

After:

tc = TEST_CASES["verify_resource"]
tl = TestLogger(tc["title"], tc["id"])

2. Playbook Execution Improvements

  • Local mode: Playbook path resolved from source tree (<repo_root>/<playbook_workdir>)
  • Remote mode: Uses clone_path from test_config.yml
  • All deploy tests now pass playbook=PLAYBOOK_ENTRY_POINT explicitly
  • Removed hardcoded /root/omnia fallback — config is required

3. Configuration Enhancements (test_config.yml)

Setting Required Default Description
oim_server_ip No "" (local) Target server IP. Leave empty for local mode.
clone_path Remote only /omnia Path on target where code is synced.
venv_path No "" Python venv on target. If set, activated before ansible-playbook.

4. Security Fixes

  • Added # nosec B108 annotations for intentional temp paths on remote target
  • Sanitized all real IPs in test_config.yml (default to empty)
  • No hardcoded credentials or secrets

5. Documentation Updates

  • README.md: Added key settings table, execution modes, sync behavior
  • docs/code-style/test_automation.md: Added rules for:
    • TEST_CASES dictionary usage
    • run_playbook patterns with explicit playbook name
    • Configuration settings (clone_path, venv_path)
    • Updated import structure

6. Plugin Rebuild

  • Rebuilt omnia_auto-1.0.0-py3-none-any.whl with:
    • venv_path support in runner_func.py
    • Local/remote playbook path resolution fix
    • Import of get_module_root for source tree resolution

Files Changed

Test Module

  • test/image_build_manager/README.md — Key settings table, execution modes
  • test/image_build_manager/test_config.ymlclone_path, venv_path config
  • test/image_build_manager/library/vars/common_vars.pynosec B108 annotations
  • test/image_build_manager/library/vars/test_case_vars.pyTEST_CASES dict
  • test/image_build_manager/fvt/**/*.py — All test files use TEST_CASES

Plugin

  • test/plugins/omnia_auto/functions/runner_func.py — venv_path, local/remote path fix
  • test/plugins/dist/omnia_auto-1.0.0-py3-none-any.whl — Rebuilt wheel

Documentation

  • docs/code-style/test_automation.md — TEST_CASES rules, config settings, run_playbook patterns

Testing

Verification Results (against target server)

Scenario Result
validate verify 2 passed
prepare verify 7 passed
build verify 4 passed, 1 skipped (aarch64)
image_build_manager verify 8 passed, 4 skipped (aarch64)

Code Quality

Check Result
Compile All .py files pass
Pylint 9.81/10
Bandit 0 medium/high issues
Hardcoded TC IDs 0 (verified via grep)
Hardcoded IPs 0 (sanitized)

Backward Compatibility

  • No breaking changes — existing test_config.yml values work unchanged
  • Test output unchanged — TC IDs display identically, now from TEST_CASES
  • Markers and ordering preserved — all pytest collection behavior unchanged
  • venv_path is optional — if empty, uses system-wide ansible

@abhishek-sa1 Please Review

@balajikumaran-c-s
balajikumaran-c-s marked this pull request as ready for review August 4, 2026 17:48
…tooling

- Fix functional group naming mismatch: get_configured_functional_groups()
  now reads actual built names from build_status.yml when available, so
  S3/registry/package checks match catalog-mode expanded names
  (e.g. slurm_node_rhel_10_0_x86_64 vs slurm_node_x86_64)
- Remove shared_path from required config validation (derived from env vars)
- Sanitize all hardcoded IPs in dataset files with {{admin_nic_ip}} placeholders
- Replace real server IPs in plugin docs with generic example IPs
- Add setup.py and build_wheel.sh to plugins for simplified wheel building
- Simplify plugin README: remove PyPI/publishing references, keep build only
- Fix MANIFEST.in and pyproject.toml to remove references to deleted files
- Add data_set_02 (internet-connected repos) and package_groups.yml
- Add command field to test_run_config.yml for deploy/verify/test modes
- Update run_validation.sh to read command field from config
- Fix import order in build_image_func.py (pylint)
- Update dataset READMEs to reflect current structure

Verified: 8 passed, 0 failed, 4 skipped (aarch64)
Pylint: 9.79/10 | Bandit: 0 medium/high issues
Signed-off-by: balajikumaran-c-s <balajikumaran.cs@dell.com>
- Move TEST_CASES registry to library/vars/test_case_vars.py (id + title only)
- Replace all hardcoded TC IDs and TEST_NAMES in 11 test files with TC lookups
- Remove TC ID prefixes from all docstrings and __init__.py comments
- Pass playbook name explicitly in all deploy test functions
- Remove hardcoded clone_path fallback in omnia_auto runner_func.py
- Centralize inline commands and constants into CMDS dict and common_vars.py
- Refactor build_image_func.py and validation_func.py to use centralized vars
- Rebuild omnia_auto wheel with runner_func fix

Signed-off-by: balajikumaran-c-s <balajikumaran.cs@dell.com>
- Add optional venv_path in test_config.yml — activates venv on target
  before ansible-playbook when set, skips when empty
- Add nosec B108 annotations for intentional temp paths
- Update README with key settings table (clone_path, venv_path, dataset)
- Sanitize server IP in test_config.yml (default to local mode)
- Rebuild omnia_auto wheel with venv_path support
- Set clone_path to /omnia

Verified: validate 2/2, prepare 7/7, build 4/4+1skip,
         image_build_manager 8/8+4skip
Pylint: 9.81/10 | Bandit: 0 medium/high
Signed-off-by: balajikumaran-c-s <balajikumaran.cs@dell.com>
- Local mode: resolve playbook workdir from repo root (source tree)
- Remote mode: use clone_path on target server
- Update test_config.yml comments to clarify clone_path is remote-only
- Update README with execution mode documentation
- Update docs/code-style/test_automation.md with:
  - TEST_CASES dictionary rules
  - Configuration settings (clone_path, venv_path)
  - run_playbook rules and patterns
  - Updated import structure
- Rebuild omnia_auto wheel with fix

Signed-off-by: balajikumaran-c-s <balajikumaran.cs@dell.com>
@balajikumaran-c-s
balajikumaran-c-s force-pushed the issue-4849-omnia-modernization branch from 787c3ac to 787a6f7 Compare August 4, 2026 17:52
- Replace placeholder message with actual shell snippet output
- eval "$(./run_validation.sh --completion)" now registers:
  - run_validation function (no ./ needed)
  - Tab completion for scenarios, commands, suites, markers
- setup_env.sh already injects completion into .venv/bin/activate

Signed-off-by: balajikumaran-c-s <balajikumaran.cs@dell.com>
…upport

- Add early bail-out in check_s3_bucket_images() and verify_image_packages()
  when S3 bucket doesn't exist (reduces 45s+ timeout to ~1s)
- Add TC ID tracking via get_last_tc_id() for summary table display
- Update HOW TO FIX messages to suggest running playbook or run_validation
- Add per-scenario dataset/sync_input/sync_output overrides in test_run_config.yml
- Add global dataset_override/sync_input_override/sync_output_override options
- Add OMNIA_DATASET_OVERRIDE env var support in conftest.py
- Validate dataset existence with available datasets list on error
- Update datasets/README.md with 4 methods to switch datasets
- Remove --tags references from deploy test titles
- Add proper docstrings following coding rules for all new functions

Signed-off-by: balajikumaran-c-s <balajikumaran.cs@dell.com>
@balajikumaran-c-s
balajikumaran-c-s force-pushed the issue-4849-omnia-modernization branch from 9f61b21 to 059da7e Compare August 5, 2026 05:32
- Add _TC_ID_MAP fallback in conftest.py for TC ID resolution when
  get_last_tc_id() returns empty (e.g. old omnia_auto wheel)
- Move report save + summary table to pytest_terminal_summary (trylast)
  so REPORT SAVED box appears AFTER pytest FAILURES section
- Add BUILD_LOG_PATH and PLAYBOOK_CMD constants in common_vars.py
- Update all deploy test_playbook.py files to use dynamic log path
  from load_test_config() instead of hardcoded string
- Update HOW TO FIX messages to show ansible-playbook command and
  correct log path (/opt/omnia/image_build_manager/log/<project>/)

Signed-off-by: balajikumaran-c-s <balajikumaran.cs@dell.com>
…_001

- Renumber deploy_full from TC_IB_000 to TC_IB_001
- Shift all subsequent TC_IB IDs by +1 (002 through 013)
- Update TEST_CASES.md to match new numbering

Signed-off-by: balajikumaran-c-s <balajikumaran.cs@dell.com>
# Structure:
# base_packages — RPM names installed in ALL images (the base OS layer)
# functional_groups — dict keyed by functional group name
# Each group has:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

file to be updated

# 2. S3 Storage Backend
# ---------------------------------------------------------------------------
# provider: "minio" (deployed locally by image_build_manager) or "powerscale" (external).
# endpoint_url: Required for powerscale; auto-detected for minio — leave empty.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

all input file to updated, can we have templates for input files

@@ -57,7 +56,6 @@ dev = [
Homepage = "https://github.com/balajikumaran-c-s/omnia-auto"
Repository = "https://github.com/balajikumaran-c-s/omnia-auto.git"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

remove all reference for forked repo

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