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

Migrate silex to flex #1748

Draft
wants to merge 97 commits into
base: xdmod11.0
Choose a base branch
from
Draft

Conversation

ryanrath
Copy link
Contributor

@ryanrath ryanrath commented Aug 3, 2023

Description

Migrating our two current rest stacks into one Symfony rest stack.

Motivation and Context

Tests performed

Checklist:

  • The pull request description is suitable for a Changelog entry
  • The milestone is set correctly on the pull request
  • The appropriate labels have been added to the pull request

@ryanrath ryanrath force-pushed the migrate-silex-to-flex branch 2 times, most recently from 19e793b to 60cc6f5 Compare August 8, 2023 13:53
@ryanrath ryanrath changed the base branch from xdmod10.5 to xdmod11.0 October 16, 2023 17:09
@ryanrath ryanrath force-pushed the migrate-silex-to-flex branch 2 times, most recently from 87670f2 to 0804ff8 Compare October 23, 2023 15:26
Ryan Rathsam and others added 25 commits February 9, 2024 10:30
Included in this commit is:
  - Added the symfony directories / files this includees:
    - config/
    - src/
    - templates/
  - In an effort to keep the Symfony infrastructure seperate from the
    Silex / historical system I've set the "Symfony App" to be served
    from the public directory. This is why public is essentially the
    same as html just without the `controllers/` and
    `internal_dashboard` directories.
  - Rest Endpoints migrated so far ( OpenXDMoD ):
    - Summary Tab
    - Usage Tab
    - Metric Explorer Tab
    - Data Export Tab
    - Job Viewer Tab
Included in this commit is:
  - Added the symfony directories / files this includees:
    - config/
    - src/
    - templates/
  - In an effort to keep the Symfony infrastructure seperate from the
    Silex / historical system I've set the "Symfony App" to be served
    from the public directory. This is why public is essentially the
    same as html just without the `controllers/` and
    `internal_dashboard` directories.
  - Rest Endpoints migrated so far ( OpenXDMoD ):
    - Summary Tab
    - Usage Tab
    - Metric Explorer Tab
    - Data Export Tab
    - Job Viewer Tab
I just want to checkpoint the changes I've made so far so as not to lose
anything in the case of a problem w/ my development block.
- Migrated internal_dashboard/controllers/mailer.php to a Symfony
  Controller
  - for enum_target_addresses and send_plain_mail operations
- Updated the expected output for the enum_target_addresses tests so
  that they're in line with the new controller.
Since this is going in to xdmod11.0 we will only be supporting  el8 builds and
as such only need one composer.json file again ( and there was much rejoicing! )
These changes add the ability to use API tokens to the new REST stack.
  - BaseController.php: Added a new `$tokenHelper` member variable so that child classes can support
    token authentication
  - WarehouseExportController.php:
    - Utilized the new `$tokenHelper` instance to implement token authentication
      for the `getRealms` function.
    - Updated the way that authentication was handled so that tests passed for:
      - `getRequests`
      - `createRequests`
    - Updated `deleteRequests` so that the request ids are provided as a
      parameter vs in the body of the requests due to DELETE requests not having
      a body.
This function needs to be called to ensure that user login counts are properly
recorded ( via the SessionManager ).
Somewhat Automated error handling that helps keep the same behavior from the old
rest stack.
empty will allow us to also capture when the userid value is an empty string as
opposed to just null.
These changes allow us to mimic the same responses as were received from the old
rest framework.
The previous function `CCR.invokePost` would do a pre-flight check to ensure
that a user was authenticated / authorized to make the call before actually
making it. That file is no longer needed / exists so this function call was
changed to be the same as what occurs when a user was determined to be
authorized. The authentication / authorization is now handled on the backend for
each rest call.
These changes were just needed beacuse of the new version of PHPUnit.
Due to the way that the new rest stack interprets urls the leading `/` needed to
be removed from these tests.
Since we can now return status codes other than 200, this let's us have an
expected http_code.
This form of `assertEquals` has been deprecated in the newer versions of
PHPUnit, this commit just updates them to the currently supported version called
`assertEqualsWithDelta`.
The error messages for missing or malformed parameter values has been updated
slightly in the new REST stack, the message still indicate the same occurence,
but the wording is different.
These changes should have been in the previous commit.
This reflects the new REST url. A quick note, this change is accounted for on
the front end by setting the two REST properties in portal_settings.ini to an
empty string. Which is then js variable `XDMoD.rest.url`.
The current rest stack defaults to setting the content-type to application/json
when it returns json so where before we would be getting back "json" but
expected the content-type to be `text/html` we can now update it to reflect the
new content-type.

Included in this commit are also some massaging of the expected http code, most
often it's expecting a 4** error code where before we had a 200.

There were also some places where we expected the returned value to be
stringified json that needed to be `json_decode`d, but now that it's actually
returning json it's decoded for us and we're presented with an array as opposed
to a string.

Some additional debugging was also added.
ryanrath and others added 29 commits February 16, 2024 14:41
These changes were necessary to get the various test suites running
i.e. unit, component, integration, regression and SSO integration.
UI tests will be worked on after we merge in the Playwright tests.
- acl-config
  - `join` function signature has changed in PHP8
- RealmManager.php
  - The order in which these values were being returned differed between PHP7.2
    and PHP8.0. I've just added code to force the ordering to be as we expect.
- ExportBuilder.php
  - PHP8 is more strict in what it allows in function signatures and optional
    arguments (arguments with default values) cannot come before required
    arguments (arguments without default values).
- Visualization.php
  - HSVtoRGB: PHP7.2 did more coercing of types than PHP8 does so we needed an
    explicit cast to int here.
- pdoAggregator.php
  - The previous code here expected that `current` would always return an
    `array` when it can also return a `bool`. I've just updated the code to take
    this into account.
- HpcdbHostsIngestor.php
  - updated the function signature of `transform` so that it matches it's parent
    `pdoIngestor`
- aRdbmsDestinationAction.php
  - This code previously assumed that `$item['alias']` was going to be an array
    and that it would contain a key 'as'. I just made it explicit.
- composer.json
  - Added PHP8.0 to the list of supported PHP's.
  - Updated phpoffice/phpword's version to * because the previous version
    doesn't support PHP8
  - Updated PHPUnit to 9+ as it was the most recent version that supported
    PHP8.0
The "types" of changes in this commit are all related to PHPUnit9+ and PHP8:
- PHP8 reports a larger mantissa than in PHP7.2 so a few values have been
updated to reflect that.
- PHPUnit9+ uses actual namespacing so anywhere there was
  `PHPUnit_Framework_TestCase` has been changed to
  `\PHPUnit\Framework\TestCase`. The same basic idea was applied to Errors and
  Exceptions as well.
- PHPUnit9+ has added some new functions, deprecated others, and removed yet
  others. There are numerous locations where substitutions for curently
  recommended functions were made.
- phpunit.xml.dist files have been updated
PHPUnit prompted that our phpunit.xml.dist files be updated by running `phpunit
--migrate-configuration`.
We'll expect PHP Deprecated errors until we have everything fully upgraded.
Some entries for 'PHP Notice' are added to the php_errors.log file for
attempting to fread a directory. These should be ignored.
@ryanrath ryanrath added this to the 11.5.0 milestone Apr 30, 2024
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