submariner-io / shipyard

Framework and scripts to create multiple Kubernetes clusters with kind (K8s in Docker) for local E2E testing and development.
https://submariner.io/for_developers/shipyard/
Apache License 2.0
39 stars 26 forks source link

Trim last slash when pruning paths #1588

Closed skitt closed 4 months ago

skitt commented 4 months ago

The check for unit tests looks for directories to exclude, and removes the first slash. The purpose of this removal is to trim the slash at the end of a path, as output by git ls-files, because paths with a trailing slash don't match when used in find's -path check. The current code works as long as the directories being removed are at the top level; if not, a slash in the middle is trimmed, and the path would fail anyway (and find warns about this).

Trimming the last slash in all cases avoids the various issues here.