-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Run tests on Travis CI #224
Conversation
Because `docker-compose` is not capable of checking open ports docker/compose#374
@chubin now I am not sure what's going on. More output wouldn't hurt. Like the number of test and the command what is being executed. https://travis-ci.com/github/abitrolly/cheat.sh/builds/177681447#L425 |
It will take a lot of time for me to understand the shell runner. For example, what does this line do? Line 36 in c17183c
|
@abitrolly I believe you are doing it almost right, but it tries to use the standalone mode instead of the curl mode. Let us take a look at the first test output:
Ok, it uses the standalone mode here, and we should curl instead.
What does this mean:
? Regarding this:
The line looks so scary but it is pretty trivial:
what yields:
which then is used as a short script for the outer So, to summarize, |
@chubin what is the standalone mode? Does it mean ignoring the server? |
Yes, in the standalone mode you can use it without the server (say during a flight or in a submarine); |
I've discovered the Travis has numerous issues with ANSI escaping. Basically it is doing the same transformation of ANSI sequences as |
@@ -7,3 +7,9 @@ before_install: | |||
- docker-compose up -d | |||
- docker ps | |||
- docker images | |||
|
|||
script: | |||
- sleep 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sleep is probably not a good way to know when the server is up. If you run it locally on a slower machine this can easily fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, cap. So any ideas how to fix that - https://travis-ci.com/github/abitrolly/cheat.sh/builds/177678164#L390? I checked - it is non-trivial
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retry after one second up to X if the exit code is 52 maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How exit code 52 is related?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command "curl http://localhost:8002" exited with 52.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then maybe better check until a port is accepting connections?
@SuperSandro2000 thanks for the comments on things not catched by |
And remove temporary `curl cht.sh` call
This would allow later inspection of stdout. Assigned names to image and container to avoid confusion. Build is done separately to clean up the output.
Run Python 3 in unbuffered mode to see lines in `docker logs` as soon as they appear. When Python 3 is not attached to a terminal, it turns on the buffering, like when `docker` runs in a background.
Default `localhost:6379` doesn't work there. Trying to set REDIS_HOST advertised in `run-tests.sh`
At last! Some progress. |
|
The proper config name for Redis host is CHEATSH_CACHE_REDIS_HOST and for disabling cache the var is CHEATSH_CACHE_TYPE.
@chubin thsi is it. Travis runs test properly. The rest - updating and fixing the tests - could be done in subsequent PRs. |
@@ -59,19 +71,24 @@ while read -r number test_line; do | |||
|
|||
if [ "$test_standalone" = YES ]; then | |||
test_line="${test_line//cht.sh /}" | |||
"${PYTHON}" ../lib/standalone.py "$test_line" > "$TMP" 2> /dev/null | |||
[[ $show_details == YES ]] && echo "${PYTHON} ../lib/standalone.py $test_line" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could convert this to a function which takes the string as an argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I am that bash proficient. Show an example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log() {
[[ $show_details == YES ]] && echo "$1"
}
log("${PYTHON} ../lib/standalone.py $test_line")
The PR is merged, thank you for the great work! I've fixed the tests, they are almost all green now, except two tests, and they have, probably, the same problem. That is how the correct expected behavior looks like:
Could you please take a look at it? Last build output: https://travis-ci.org/github/chubin/cheat.sh/builds/715398758 |
@chubin I will try to quote them. Maybe there are some problems with shell expansion. |
@abitrolly I don't think that this helps; try more debug output better instead |
@chubin on my local instance accessing http://localhost:8002/python/copy+file complains that I am offline. Strange that it shows 200 status code. I haven't found a way to debug Flask yet.
|
@abitrolly I am back online; sorry for the disappearance. |
@chubin no pressure. I will be offline for at least two weeks too. ) |
Travis status from my fork https://travis-ci.com/github/abitrolly/cheat.sh/builds
They don't really work well.