Skip to content

Add more unittests#28

Merged
Jooho merged 10 commits intomainfrom
add_more_unittests
May 15, 2025
Merged

Add more unittests#28
Jooho merged 10 commits intomainfrom
add_more_unittests

Conversation

@Jooho
Copy link
Owner

@Jooho Jooho commented May 15, 2025

ticket: RHOAIENG-14656

Summary by CodeRabbit

  • New Features

    • Added new sample Kubernetes manifest for an echo server application.
    • Introduced new shell script for automating local Kubernetes setup with kind.
    • Expanded configuration options and environment variable handling for roles and playbooks.
    • Added new end-to-end and functional verification test suites for roles, playbooks, and CLI utilities.
    • Enabled debug mode support via environment variable.
  • Improvements

    • Enhanced error handling and reporting for role execution and subprocess errors.
    • Unified and simplified configuration of logging, logo, and report display through config flags.
    • Improved robustness of environment variable and configuration management.
    • Updated documentation formatting and examples for clarity.
  • Bug Fixes

    • Fixed variable reference error in playbook result updating.
    • Corrected logic for skipping OpenShift login when using kind.
    • Improved error detection by treating stderr output as error in subprocess execution.
  • Refactor

    • Reformatted YAML and code for readability and consistency.
    • Streamlined playbook step handling and role instantiation logic.
  • Chores

    • Updated .gitignore and requirements for new dependencies.
    • Removed obsolete or redundant test files and fixtures.
    • Added and reorganized test data and configuration files for improved test coverage.

Jooho added 9 commits April 22, 2025 18:18
Signed-off-by: Jooho Lee <jlee@redhat.com>
Signed-off-by: Jooho Lee <jlee@redhat.com>
Signed-off-by: Jooho Lee <jlee@redhat.com>
Signed-off-by: Jooho Lee <jlee@redhat.com>
… into add_more_unittests

Signed-off-by: Jooho Lee <jlee@redhat.com>
Signed-off-by: Jooho Lee <jlee@redhat.com>
Signed-off-by: Jooho Lee <jlee@redhat.com>
Signed-off-by: Jooho Lee <jlee@redhat.com>
Signed-off-by: Jooho Lee <jlee@redhat.com>
@coderabbitai
Copy link

coderabbitai bot commented May 15, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces extensive changes across the codebase, focusing on enhancing configuration management, debugging, and test coverage. Key changes include new and refactored shell scripts, expanded and reorganized configuration files, improved error handling, and the addition of granular test markers and end-to-end (e2e) and functional verification (fvt) test suites. Several CLI and core modules are updated to unify configuration flag handling and improve robustness. The update also introduces new Kubernetes manifests and test data, while removing redundant or outdated test files.

Changes

File(s) / Group Change Summary
.gitignore Added privkey.pem to ignored files.
.vscode/launch.json Reformatted and added "Attach to Loopy" debug configuration for debugpy.
Dockerfile Switched CMD to exec form (["/bin/bash"]).
Makefile Introduced TEST_ENV, new fvt/e2e targets, updated download-cli, lint, and precommit logic.
commons/scripts/utils.sh Enhanced error/fail functions to output to stderr; added Python function update_loopy_output_paths.
config.yaml Added output_target_dir key (empty by default).
default_provided_services/playbooks/odh/fast/install-kserve-raw-on-existing-cluster/config.yaml Increased indentation for input_env.
default_provided_services/playbooks/vllm-multi-node-odh-poc/config.yaml Normalized YAML indentation and structure.
default_provided_services/roles/kserve/samples/caikit-runtime/main.sh
.../from-notebook/main.sh
.../sklearn/main.sh
.../modelmesh/samples/openvino/main.sh
.../minio/deploy/main.sh
.../nfs-provisioner/main.sh
.../opendatahub/dsc/main.sh
.../opendatahub/dsci/main.sh
.../openshift/psi-install-fips/main.sh
.../operator/delete/main.sh
.../operator/install/main.sh
Modified OpenShift login logic to skip login/status check if USE_KIND is set; adjusted related control flow.
default_provided_services/roles/minio/deploy/README.md Added instructions for testing Minio SSL access via route domain.
default_provided_services/roles/minio/deploy/config.yaml Added minio_route and minio_route_ssl manifest entries.
default_provided_services/roles/minio/deploy/manifests/minio.yaml Removed OpenShift Route resource definition for Minio.
default_provided_services/roles/nfs-provisioner/config.yaml Renamed role, added catalog source env vars, reformatted input_env.
default_provided_services/roles/nfs-provisioner/manifests/nfs-provisioner-operator.yaml Made catalog source and namespace configurable via placeholders.
default_provided_services/roles/operator/delete/config.yaml Renamed role to "operator-uninstall" and flattened input_env list.
default_provided_services/roles/shell/execute/main.py Removed redundant check, now executes all non-empty commands.
default_provided_services/units/install-authorino-stable-operator/config.yaml Changed operator namespace and removed quotes from some values.
docs/func_test.md
docs/quickstart.md
Updated markdown formatting for code blocks and headings; corrected command references.
hacks/setup-kind.sh New script to automate kind cluster setup and OLM installation.
loopy Runs from LOOPY_ROOT_PATH if set, else current directory.
loopy.py Added debugpy support via LOOPY_DEBUG; improved env var handling post-config load.
pytest.ini Expanded and renamed test markers; added new marker groups for fvt/e2e/cluster tests.
requirements.txt Added pytest-order, debugpy, and black packages.
sample_manifests/echo.yaml New manifest for echo server (namespace, service, deployment, ingress).
src/cli/commands/loopy_report.py Fixed variable reference in playbook result update logic.
src/cli/commands/playbooks.py
src/cli/commands/roles.py
src/cli/commands/units.py
Unified handling of no_log, no_logo, no_report flags by updating config dict.
src/cli/commands/utils.py Formatting and whitespace fixes in safe_rmtree.
src/cli/logics/component.py Use config dict for log enablement; improved error handling and default value usage.
src/core/config_loader.py Reformatted multi-line statements for readability.
src/core/env.py Improved env var handling; added update_env_from_system_if_config_key_exists method.
src/core/initializer.py Switched output dir logic to use env_list; improved path construction and error printing.
tests/cli/commands/conftest.py
tests/cli/commands/test_playbooks.py
Removed CLI command test fixtures and playbook tests.
tests/conftest.py Removed several fixtures; added generate_random_name utility.
tests/custom-context.json Reformatted and expanded config with cert/modelmesh, output dirs, lists, and logging config.
tests/e2e/roles/cluster-tests/minio-deploy/conftest.py
.../test_e2e_minio.py
.../nfs-provisioner-deploy/conftest.py
.../test_e2e_nfs_provisioner.py
.../operator_install_delete/conftest.py
.../test_e2e_operator.py
.../conftest.py
Added new e2e test fixtures and test functions for MinIO, NFS provisioner, and operator lifecycle.
tests/e2e/roles/kserve-sklearn-test/raw/config.yaml
.../serverless/config.yaml
Deleted e2e test playbook config files for kserve-sklearn-test.
tests/e2e/roles/non-cluster-tests/cert_generate/conftest.py
.../test_e2e_cert_generate.py
Added e2e test fixture and test for cert-generate role.
tests/fvt/cli/commands/conftest.py Added CLI runner and cleanup fixtures for FVT.
tests/fvt/cli/commands/test_loopy_report.py Added FVT tests for loopy report CLI utilities and summary logic.
tests/fvt/cli/commands/test_playbooks.py Added FVT tests for playbook CLI commands.
tests/fvt/cli/commands/test_roles.py Updated test markers to use @pytest.mark.fvt and @pytest.mark.cli_roles.
tests/fvt/cli/commands/test_units.py Updated test markers to use @pytest.mark.fvt and @pytest.mark.cli_units.
tests/fvt/cli/commands/test_utils.py Added comprehensive FVT tests for CLI utility functions.
tests/fvt/conftest.py Added fixtures for FVT: context setup, config copying, root path, etc.
tests/fvt/core/test_config_loader.py Adjusted fixture path calculation; added FVT marker.
tests/fvt/core/test_context.py Added FVT marker to test function.
tests/fvt/core/test_env.py Adjusted root path logic and test markers; updated env var key assertion.
tests/fvt/core/test_initizlizer.py Added FVT marker to all test functions.
tests/fvt/roles/conftest.py Added fixtures for FVT role tests: output dirs, base env, test env setup.
tests/fvt/roles/non-cluster-tests/cert_generate/conftest.py
.../test_fvt_cert_generate.py
Added fixtures and tests for cert_generate role FVT.
tests/fvt/roles/non-cluster-tests/shell_execute/conftest.py
.../test_fvt_shell_execute.py
Added fixtures and tests for shell_execute role FVT.
tests/test-data/cluster-info/cluster-crc.sh Added script with CRC cluster environment variables.
tests/test-data/playbooks/loopy/unit-tests/non-cluster-role-unit/config.yaml
.../non-cluster-roles/config.yaml
.../non-cluster-unit-role/config.yaml
.../on-cluster/install-kserve-raw-on-existing-cluster/config.yaml
Added new playbook YAML files for unit and on-cluster tests.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant LoopyScript
    participant PythonMain
    participant Debugger
    participant EnvManager
    participant ConfigLoader
    participant Initializer
    participant CLI

    User->>LoopyScript: Run ./loopy
    LoopyScript->>LoopyScript: Set ROOT_PATH (from LOOPY_ROOT_PATH or cwd)
    LoopyScript->>PythonMain: Run python loopy.py (in ROOT_PATH)
    PythonMain->>PythonMain: if LOOPY_DEBUG==1: enable debugpy, wait for attach
    PythonMain->>EnvManager: Initialize environment
    PythonMain->>ConfigLoader: Load config.yaml
    PythonMain->>EnvManager: update_env_from_system_if_config_key_exists(config)
    PythonMain->>EnvManager: Retrieve env_list
    PythonMain->>Initializer: Initialize with env_list, config
    PythonMain->>CLI: Invoke CLI commands
Loading
sequenceDiagram
    participant Makefile
    participant LocalKindSetup
    participant Pytest

    Makefile->>Makefile: If target is e2e and TEST_ENV==local
    Makefile->>LocalKindSetup: Run hacks/setup-kind.sh
    LocalKindSetup->>LocalKindSetup: Setup kind cluster, label node, deploy ingress, install OLM
    LocalKindSetup->>LocalKindSetup: Wait for minio package manifest
    Makefile->>Pytest: Run pytest -m e2e with 5 workers
Loading

Poem

🐇
A hop, a skip, new tests abound,
With clusters spun and configs found.
Debuggers wait, the scripts are neat,
Playbooks, roles, and units meet.
From echo servers to MinIO’s door,
Loopy leaps forward, tested more!
— The CodeRabbit Rabbit

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Signed-off-by: Jooho Lee <jlee@redhat.com>
@Jooho Jooho force-pushed the add_more_unittests branch from 05a5e59 to 9c67c10 Compare May 15, 2025 02:30
@Jooho Jooho merged commit 9aaf6a2 into main May 15, 2025
1 check passed
@Jooho Jooho deleted the add_more_unittests branch May 21, 2025 00:53
@coderabbitai coderabbitai bot mentioned this pull request Jun 3, 2025
@coderabbitai coderabbitai bot mentioned this pull request Aug 14, 2025
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.

1 participant