Skip to content

Refactor test namespaces and replace redundant exception classes with ones provided by Symfony.#355

Merged
aaronweeden merged 10 commits intoubccr:xdmod11.0from
aaronweeden:refactor-test-namespaces
Dec 14, 2023
Merged

Refactor test namespaces and replace redundant exception classes with ones provided by Symfony.#355
aaronweeden merged 10 commits intoubccr:xdmod11.0from
aaronweeden:refactor-test-namespaces

Conversation

@aaronweeden
Copy link
Copy Markdown
Contributor

@aaronweeden aaronweeden commented Oct 20, 2023

Description

Same as ubccr/xdmod#1789 and ubccr/xdmod#1794 but for the xdmod-supremm module.

This PR also removes the _tests suffix from the test directory names to be consistent with the main xdmod module.

Tests performed

The changes to classes/Rest/Controllers/EfficiencyControllerProvider.php are covered partially by the existing test tests/integration_tests/lib/REST/EfficiencyControllerProviderTest.php::testCPUUsageScatterPlotEndpointMalformedRequest, and additional coverage will be provided in #350.

To make sure the changes in this PR don't affect any other tests that are run, I did the following in a Docker container running tools-ext-01.ccr.xdmod.org/xdmod-job_performance-10.5.0:rockylinux8-0.1:

  1. Run the following commands:
    export COMPOSER_ALLOW_SUPERUSER=1
    export XDMOD_REALMS='jobs,storage,cloud,supremm,jobefficiency'
    export XDMOD_IS_CORE=yes
    export XDMOD_INSTALL_DIR=/xdmod
    export XDMOD_TEST_MODE=upgrade
    export XDMOD_SRC_DIR=./../xdmod
    git clone https://github.com/ubccr/xdmod-supremm /xdmod-supremm
    dnf module -y reset nodejs
    dnf module -y install nodejs:16
    git clone https://github.com/ubccr/xdmod $XDMOD_SRC_DIR
    cd /xdmod
    git checkout 411f7169b4f96a79b0aa237a560564fec2a91d9a
    cd /xdmod-supremm
    ln -s `pwd` $XDMOD_SRC_DIR/open_xdmod/modules/supremm
    ./tests/ci/scripts/install_mongo.sh
    composer install --no-progress
    composer config -g cache-files-ttl 315360000
    composer install -d $XDMOD_SRC_DIR --no-progress
    mkdir -p ~/phpunit
    mkdir -p /tmp/screenshots
    export XDMOD_SOURCE_DIR=/xdmod
    export SHIPPABLE_BUILD_DIR=/xdmod-supremm
    pushd $XDMOD_SRC_DIR
    ~/bin/buildrpm xdmod supremm
    popd
    ./tests/integration_tests/scripts/bootstrap.sh
    ./tests/integration_tests/scripts/validate.sh
    composer install -d $XDMOD_SRC_DIR --no-progress
    composer install --no-progress
    ./tests/ci/scripts/qa-test-setup.sh
    export XDMOD_INSTALL_DIR=/usr/share/xdmod
    ./tests/ci/scripts/post-install-test.sh
    sed -i 's/\$phpunit /$phpunit --debug /' ./tests/component_tests/runtests.sh
    ./tests/component_tests/runtests.sh > /component-before.txt
    composer install -d $XDMOD_SRC_DIR --no-progress
    sed -i 's/\$phpunit /$phpunit --debug /' ./tests/integration_tests/runtests.sh
    sed -i '/printerClass/d' ./tests/integration_tests/phpunit.xml.dist
    ./tests/integration_tests/runtests.sh > /integration-before.txt
    sed -i 's/\$phpunit /$phpunit --debug /' ./tests/regression_tests/runtests.sh
    ./tests/regression_tests/runtests.sh > /regression-before.txt
    ./tests/artifacts/update-artifacts.sh
    cd tests/unit_tests/
    sed -i '/printerClass/d' phpunit.xml.dist
    ../../vendor/bin/phpunit --debug . > /unit-before.txt
    cd /xdmod
    git checkout xdmod11.0
    cd /xdmod-supremm
    git clone https://github.com/aaronweeden/xdmod-supremm -b refactor-test-namespaces /xdmod-supremm-new
    unalias rm
    rm -r /xdmod-supremm/tests
    cp -r /xdmod-supremm{-new,}/tests
    sed -i 's/\$phpunit /$phpunit --debug /' ./tests/component/runtests.sh
    ./tests/component/runtests.sh > /component-after.txt
    composer install -d $XDMOD_SRC_DIR --no-progress
    sed -i 's/\$phpunit /$phpunit --debug /' ./tests/integration/runtests.sh
    ./tests/integration/runtests.sh > /integration-after.txt
    sed -i 's/\$phpunit /$phpunit --debug /' ./tests/regression/runtests.sh
    ./tests/regression/runtests.sh > /regression-after.txt
    ./tests/artifacts/update-artifacts.sh
    cd tests/unit/
    ../../vendor/bin/phpunit --debug . > /unit-after.txt
    cd /xdmod-supremm
    
  2. Compare /unit-{before,after}.txt and make sure the only differences are namespace names and amount of time the tests ran.
  3. Compare /component-{before,after}.txt and make sure the only differences are the test directory name and amount of time the tests ran.
  4. Compare /regression-{before,after}.txt and make sure the only differences are namespace names, randomized parameters, amount of time the tests ran, and possibly transient "other notices" related to small differences in column values.
  5. Compare /integration-{before,after}.txt and make sure the only differences are namespace names and amount of time the tests ran.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project as found in the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@aaronweeden aaronweeden added this to the 11.0.0 milestone Oct 20, 2023
@aaronweeden aaronweeden force-pushed the refactor-test-namespaces branch from 41e8b8d to 60081e8 Compare October 20, 2023 17:42
@aaronweeden aaronweeden force-pushed the refactor-test-namespaces branch 2 times, most recently from 7327cb3 to 715d3f0 Compare December 4, 2023 16:20
@aaronweeden aaronweeden force-pushed the refactor-test-namespaces branch 2 times, most recently from ba8a945 to 87fb105 Compare December 6, 2023 18:24
@aaronweeden aaronweeden marked this pull request as ready for review December 6, 2023 19:03
@aaronweeden aaronweeden force-pushed the refactor-test-namespaces branch from d3904ba to 628b24a Compare December 8, 2023 19:01
@aaronweeden aaronweeden changed the title Refactor test namespaces. Refactor test namespaces and replace redundant exception classes with ones provided by Symfony. Dec 11, 2023
Comment thread .circleci/config.yml Outdated
REG_TEST_BASE: /../../../../../project/tests/artifacts/regression/current
steps:
- checkout
- run:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks like debug code to me - does it need to be run every time?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's intended to be more like linting code, to check that any new test class files that are added have a namespace consistent with the PSR-4-autoloader standard, as in ubccr/xdmod#1789 and ubccr/xdmod#1795. It's probably better moved to xdmod-qa so that it only runs on changed files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This has been removed and moved to xdmod-qa in ubccr/xdmod-qa#29 and ubccr/xdmod#1797.

@aaronweeden aaronweeden force-pushed the refactor-test-namespaces branch from 62f2bb3 to dab2415 Compare December 12, 2023 19:20
@aaronweeden aaronweeden merged commit 108f041 into ubccr:xdmod11.0 Dec 14, 2023
@aaronweeden aaronweeden deleted the refactor-test-namespaces branch December 14, 2023 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants