From 2f1f8b70136e133b9d1888f7334526d9b080da73 Mon Sep 17 00:00:00 2001 From: Dan Van Atta Date: Tue, 28 Nov 2023 14:15:16 -0800 Subject: [PATCH] Build: Drop custom check for unused DB-unit test files (#12143) The custom check is nice, but.. it is custom. There is a dependency on paths in the script that make it a bit brittle. If we widen up the script to search all paths, for db-test-files as well as the tests that use them, then we run into performance problems. All build checks need to have really, really high value and good performance. Thus, instead of repaing this build check, just dropping it instead. --- .build/find-unused-dbunit-datasets | 50 ------------------------------ verify | 1 - 2 files changed, 51 deletions(-) delete mode 100755 .build/find-unused-dbunit-datasets diff --git a/.build/find-unused-dbunit-datasets b/.build/find-unused-dbunit-datasets deleted file mode 100755 index 0a842b690e..0000000000 --- a/.build/find-unused-dbunit-datasets +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -## This script searches for all dbunit dataset .yml files, then -## it searches all integration tests for a reference to that .yml file. -## If none found, the .yml file is reported and an error status code is returned. - - -set -u - -red="\e[91m" -normal="\e[0m" -bold="\e[1m" - -status=0 - - -for dbunit_project in "spitfire-server/lobby-module" "spitfire-server/maps-module"; do - -## Loop over all .yml dataset files -while read -r dataSetFilePath; do - - ## Determine the .yml file reference we should look for. To do this, remove - ## the dataset path prefix, eg: - ## integration-testing/src/test/resources/datasets/very/test.yml -> very/test.yml - dataSetFile=${dataSetFilePath/${dbunit_project}\/src\/test\/resources\/datasets\//} - - ## Next, loop over all tests and set 'found=1' if we find a reference to the target dataSetFile - found=0 - while read -r testFile; do - if grep -q "$dataSetFile" "$testFile"; then - found=1 - break - fi - done <<< "$(find "${dbunit_project}/src/test/java" -type f -name "*java")" - - ## If 'found==0', we did not find the dataSetFile, report it and flag and error status code - if [ "$found" -eq 0 ]; then - echo -e "${red}$dataSetFilePath${normal}" - status=1 - fi -done <<< "$(find "${dbunit_project}/src/test/resources/datasets" -type f -name "*yml")" - - -if [ "$status" -eq 1 ]; then - echo -e "${bold}Found unused db-unit test data files. Delete these files or use them in a dbunit test.${normal}" -fi -done - -exit "$status" - diff --git a/verify b/verify index cebb3840f5..dc0e547de1 100755 --- a/verify +++ b/verify @@ -50,5 +50,4 @@ set -eu checkDependency "docker" || installDocker "$scriptDir/gradlew" spotlessApply check $@ -"$scriptDir/.build/find-unused-dbunit-datasets" "$scriptDir/.build/code-convention-checks/check-custom-style" spitfire-server