Testing: WebLogic Scenarios
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The WebLogic testing infrastructure in the SPM Middleware project utilizes Molecule to validate the installation, configuration, and patching of Oracle WebLogic Server across various versions and operating systems. These tests ensure that the Ansible roles are idempotent and meet the technical requirements for supporting Cúram Social Program Management environments.
The testing scope encompasses multiple WebLogic versions, including 12.1.x, 12.2.x, and 14.1.x, primarily targeting Red Hat Enterprise Linux (RHEL) and Rocky Linux distributions. Each scenario follows a standard lifecycle: dependency resolution, instance creation, convergence (applying the role), and verification.
Sources: roles/weblogic/README.md:1-25, CONTRIBUTING.md:104-125
Test Architecture and Lifecycle
Testing is driven by Molecule, which manages the lifecycle of ephemeral containers or virtual machines used for validation. The process involves executing specific playbooks to set up the environment and verify the resulting state.
Testing Workflow
The following diagram illustrates the standard Molecule testing lifecycle applied to WebLogic scenarios:
The "Converge" stage applies the WebLogic role which includes prerequisites, installation, and patching. The "Verify" stage runs assertions against the system state.
Sources: CONTRIBUTING.md:21-30, roles/weblogic/tasks/main.yml:18-35
Verification Logic
Verification playbooks (verify.yml) are responsible for ensuring the system has reached the desired state. They perform checks on file existence, environment variables, and software versions.
Key Verification Tasks
| Task | Description | Source File Reference |
|---|---|---|
| Check WebLogic Installed | Validates the presence of "WebLogic Server" with an "installed" status in the Oracle registry.xml. | molecule/__weblogic-v14.1/verify.yml:38-40 |
| Environment Check | Ensures MW_HOME is correctly exported in /opt/profile.d/weblogic.sh. | molecule/__weblogic-v12.2/verify.yml:35-37 |
| OPatch Version | Greps for a specific OPatch version string in the OPatch directory. | molecule/__weblogic-v12.1/verify.yml:23-27 |
| Patch Application | Executes opatch lspatches to confirm specific patch numbers are active. | molecule/__weblogic-v14.1/verify.yml:28-33 |
| Properties File | Confirms AppServer.properties exists in /opt/Props/. | molecule/__weblogic-v12.2/verify.yml:32-34 |
Version Coverage
The project maintains specific verification logic for different versions of WebLogic to account for path or configuration differences:
- v12.1.3.0.x: Uses
v12.1.3.0.210720.ymlvariables for verification. - v12.2.1.4.x: Uses
v12.2.1.4.250107.ymlvariables. - v14.1.1.0.x: Uses
v14.1.1.0.250108.ymlvariables.
Sources: molecule/__weblogic-v12.1/verify.yml:8, molecule/__weblogic-v12.2/verify.yml:8, molecule/__weblogic-v14.1/verify.yml:8
Role Execution Logic
The testing of WebLogic scenarios relies on the weblogic role's internal task sequencing. The role conditionally executes tasks based on the current state of the system to maintain idempotency.
Installation Components
The role, as tested, handles the following components:
- Prerequisites: Installation of OS packages and configuration of kernel parameters.
- Installation: Silent execution of the WebLogic JAR installer using a response file.
- Patching: Upgrading the OPatch tool and applying specific binary patches via
opatch applyoropatch napply.
Sources: roles/weblogic/tasks/main.yml:18-35, roles/weblogic/tasks/install.yml:42-47
Development Environment for Testing
Developers can run these scenarios locally using either a Python virtual environment or a Docker-in-Docker (DinD) container.
Local Execution Command
# Execute a specific WebLogic scenario
molecule test -s weblogic-v14.1-rockylinux9
Configuration Parameters
Tests often require connection to an Artifactory instance for software installers, controlled by the following environment variables:
ARTIFACTORY_URL: Base URL for the installer repository.ARTIFACTORY_REPO: The repository name containing software zips.ARTIFACTORY_TOKEN: Authentication token.
Sources: CONTRIBUTING.md:12-16, README.md:95-103
Summary
Testing for WebLogic scenarios provides a robust validation framework for the spm-middleware collection. By integrating Molecule with detailed verification playbooks, the project ensures that WebLogic installations are consistent, correctly patched, and properly configured for SPM middleware requirements across multiple Oracle WebLogic versions.
Sources: roles/weblogic/README.md:1-15, CONTRIBUTING.md:79-85