Skip to content

bin/otobo.Console.pl Dev::UnitTest::Run should check if package parameter is valid #4198

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

Open
stefanhaerter opened this issue Feb 27, 2025 · 5 comments
Assignees
Labels
change A change in some part of the functionality of OTOBO, unfitting to other categories. unittests Requests wrt unittests
Milestone

Comments

@stefanhaerter
Copy link
Contributor

stefanhaerter commented Feb 27, 2025

Currently, if e.g. a package name is misspelled, e.g. 'faq' instead of 'FAQ', all unit tests are run. I think this is at least inconvenient. Instead, it would be nice if the console command checks if a package parameter is passed and if so, if the package names are valid and aborts otherwise.

@stefanhaerter stefanhaerter added the change A change in some part of the functionality of OTOBO, unfitting to other categories. label Feb 27, 2025
@stefanhaerter stefanhaerter added this to the OTOBO 10.0.24 milestone Feb 27, 2025
@stefanhaerter stefanhaerter added the unittests Requests wrt unittests label Feb 27, 2025
@bschmalhofer
Copy link
Contributor

Yes, that is a good enhancement.

@stefanhaerter
Copy link
Contributor Author

Perhaps Text::Levenshtein could be used to implement a feature like "You typed x, but x is not a valid package name - did you mean y?", but I assume that would be no justification for taking it in as a dependency.

@stefanhaerter
Copy link
Contributor Author

I just learned that Kernel/System/Package.pm provides a sub which will come in pretty handy here:

otobo/Kernel/System/Package.pm

Lines 2682 to 2691 in 8c70deb

=head2 PackageIsInstalled()
returns true if the package is already installed
$PackageObject->PackageIsInstalled(
String => $PackageString, # Attribute String or Name is required
Name => $NameOfThePackage,
);
=cut

@stefanhaerter
Copy link
Contributor Author

As Kernel::System::UnitTest::Run() receives the package names as parameter, I am yet unsure if validation needs to take place in the console command or in the backend method, or in both places. Starting to implement it in the console command seems like a good start.

@stefanhaerter stefanhaerter self-assigned this Apr 15, 2025
@bschmalhofer
Copy link
Contributor

Regarding fuzzy matching, I think that autocompletion of the parameter would be more useful than "did you mean".

@svenoe svenoe modified the milestones: OTOBO 10.0.24, OTOBO 10.0.25 May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change A change in some part of the functionality of OTOBO, unfitting to other categories. unittests Requests wrt unittests
Projects
None yet
Development

No branches or pull requests

3 participants