CircleCI-Public / CircleCI-Public/circleci-cli
Error while piping to circleci tests split --split-by=filesize Error splitting files: stat
- Dominant language
- Go
- Stars
- 459
- Forks
- 255
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 59
Description
## Meta:
**CircleCI CLI Version:**
2.1
**Operating System:**
circleci python
---
## Current behavior:
```
- run:
command: |
. .env/bin/activate
# read from sys.stdin, take last half of len(items)//2
export TESTS_TO_RUN=`circleci tests glob "*/{**,}/test*.py" | python -c "import sys;items=sys.stdin.read().split(' ');sys.stdout.write(' '.join(items[len(items)//2:]))"`
echo RUNNING THE FOLLOWING UNIT TESTS: `echo $TESTS_TO_RUN`
CIRCLE_TEST_REPORTS=~ ES_HOME=~/elasticsearch-6.2.1 python manage.py test --parallel=4 --keepdb `echo $TESTS_TO_RUN | circleci tests split --split-by=filesize`
```
```
#!/bin/bash -eo pipefail
. .env/bin/activate
# read from sys.stdin, take first half of len(items)//2
export TESTS_TO_RUN=`circleci tests glob "*/{**,}/test*.py" | python -c "import sys;items=sys.stdin.read().split(' ');sys.stdout.write(' '.join(items[:len(items)//2]))"`
echo RUNNING THE FOLLOWING UNIT TESTS: `echo $TESTS_TO_RUN`
CIRCLE_TEST_REPORTS=~ ES_HOME=~/elasticsearch-6.2.1 python manage.py test --parallel=4 --keepdb `echo $TESTS_TO_RUN | circleci tests split --split-by=filesize`
RUNNING THE FOLLOWING UNIT TESTS:
Error splitting files: stat : no such file or directory
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/circleci/build-agent/cmd/tests.getBucketForIndex(0x16b8fe0, 0xc00000d060, 0x0, 0x2, 0x7fff38b5821a, 0x8, 0x0, 0x0)
/mnt/ramdisk/circleci/project/cmd/tests/split.go:122 +0x1e6
github.com/circleci/build-agent/cmd/tests.runSplit(0x0, 0x0, 0x0, 0x2, 0x7fff38b5821a, 0x8, 0x0, 0x0, 0xc00003e2a0, 0x5a, ...)
/mnt/ramdisk/circleci/project/cmd/tests/split.go:147 +0xb1
github.com/circleci/build-agent/cmd/tests.newSplitCmd.func1(0xc0003aa840, 0xc00039e690, 0x0, 0x1, 0x0, 0x0)
/mnt/ramdisk/circleci/project/cmd/tests/split.go:38 +0xbe
github.com/spf13/cobra.(*Command).execute(0xc0003aa840, 0xc00039e680, 0x1, 0x1, 0xc0003aa840, 0xc00039e680)
/home/circleci/go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:850 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0xc00046b080, 0xc0006bfe70, 0x7fff38b58203, 0x5)
/home/circleci/go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:958 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
/home/circleci/go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:895
github.com/circleci/build-agent/cmd.Execute()
/mnt/ramdisk/circleci/project/cmd/root.go:64 +0x194
main.main()
/mnt/ramdisk/circleci/project/main.go:14 +0xda
```
## Expected behavior:
```shell
02:23:10 (venv_ok) jmunsch@pop-os propertymeld ±|APP-1575-jm-2 ✗|→ export OK=$(echo activity/tests/tests.py activity/tests/tests_api.py authentication/tests/test_api.py authentication/tests/tests.py authority/tests/tests.py availability/tests/test_api.py availability/tests/test_tenant_api.py availability/tests/test_vendor_api.py availability/tests/tests.py elastic/tests/tests.py events/tests/tests.py graphql_api/tests/tests.py integration/tests/tests.py integration/tests/tests_api.py location/tests/tests_api.py manager/tests/test_api.py manager/tests/test_serializers.py manager/tests/tests.py meld/tests/tests.py meld/tests/tests_api.py meld/tests/tests_graphql.py message/tests/test_notifications.py message/tests/tests.py message/tests/tests_api.py metrics/tests/tests.py multitenant/tests/tests.py owner/tests/test_api.py owner/tests/test_management_commands.py owner/tests/tests.py owner/tests/tests_graphql.py payment/tests/test_services.py payment/tests/tests.py payment/tests/tests_api.py payment/tests/tests_aws.py payment/tests/tests_pdf.py pm/tests/test_logformatter.py project/tests/tests.py project/tests/tests_api.py project/tests/tests_graphql.py property/tests/test_api.py property/tests/tests.py property/tests/tests_search.py propertymeld/tests/tests.py reports/tests/tests.py reports/tests/tests_api.py saved_filters/tests/tests.py saved_filters/tests/tests_api.py static_assets/tests/tests.py static_assets/tests/tests_api.py tenant/tests/test_api.py tenant/tests/tests.py tenant/tests/tests_graphql.py vendor/tests/test_api.py vendor/tests/test_serializers.py vendor/tests/tests.py | python -c "import sys;items=sys.stdin.read().split(' ');sys.stdout.write(' '.join(items[:len(items)//2]))") && echo $OK
activity/tests/tests.py activity/tests/tests_api.py authentication/tests/test_api.py authentication/tests/tests.py authority/tests/tests.py availability/tests/test_api.py availability/tests/test_tenant_api.py availability/tests/test_vendor_api.py availability/tests/tests.py elastic/tests/tests.py events/tests/tests.py graphql_api/tests/tests.py integration/tests/tests.py integration/tests/tests_api.py location/tests/tests_api.py manager/tests/test_api.py manager/tests/test_serializers.py manager/tests/tests.py meld/tests/tests.py meld/tests/tests_api.py meld/tests/tests_graphql.py message/tests/test_notifications.py message/tests/tests.py message/tests/tests_api.py metrics/tests/tests.py multitenant/tests/tests.py owner/tests/test_api.py
```
## When did this begin / Was this previously working?:
just tried it
NA
## Additional Information:
I also tried:
```
print(' '.join(items[:len(items)//2]))
sys.stdout.write('\n'.join(...))
```
How does ` circleci tests split --split-by=filesize` read in from the pipe?
Contributor guide
Assessment
This issue has not been assessed yet.