allow run-tests with -f "<test-name>" (#1564)

This commit is contained in:
mmetc 2022-05-28 22:10:27 +02:00 committed by GitHub
parent e88e9946f9
commit 88a4801d6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View file

@ -57,13 +57,13 @@ func (c *Config) LoadCrowdsec() error {
} }
files, err := filepath.Glob(c.Crowdsec.AcquisitionDirPath + "/*.yaml") files, err := filepath.Glob(c.Crowdsec.AcquisitionDirPath + "/*.yaml")
if err != nil { if err != nil {
return errors.Wrap(err, "while globing acquis_dir") return errors.Wrap(err, "while globbing acquis_dir")
} }
c.Crowdsec.AcquisitionFiles = append(c.Crowdsec.AcquisitionFiles, files...) c.Crowdsec.AcquisitionFiles = append(c.Crowdsec.AcquisitionFiles, files...)
files, err = filepath.Glob(c.Crowdsec.AcquisitionDirPath + "/*.yml") files, err = filepath.Glob(c.Crowdsec.AcquisitionDirPath + "/*.yml")
if err != nil { if err != nil {
return errors.Wrap(err, "while globing acquis_dir") return errors.Wrap(err, "while globbing acquis_dir")
} }
c.Crowdsec.AcquisitionFiles = append(c.Crowdsec.AcquisitionFiles, files...) c.Crowdsec.AcquisitionFiles = append(c.Crowdsec.AcquisitionFiles, files...)
} }

View file

@ -69,9 +69,9 @@ To repeat test runs without rebuilding crowdsec, use `make bats-test`.
## Troubleshooting tests ## Troubleshooting tests
See `./tests/run-tests` usage to run/debug single test. See `./tests/run-tests --help` to run/debug specific tests.
Example: `./tests/run-tests tests/bats/02_nolapi.bats -f "cscli config backup"` (the string is a regexp)
# How does it work? # How does it work?

View file

@ -35,7 +35,7 @@ if [ $# -ge 1 ]; then
"${TEST_DIR}/lib/bats-core/bin/bats" \ "${TEST_DIR}/lib/bats-core/bin/bats" \
--jobs 1 \ --jobs 1 \
--print-output-on-failure \ --print-output-on-failure \
-T "$@" "$@"
else else
echo "test files: ${TEST_DIR}/bats ${TEST_DIR}/dyn-bats" echo "test files: ${TEST_DIR}/bats ${TEST_DIR}/dyn-bats"
"${TEST_DIR}/lib/bats-core/bin/bats" \ "${TEST_DIR}/lib/bats-core/bin/bats" \