Move test-unit out of hack/make#33987
Conversation
hack/make.sh
Outdated
There was a problem hiding this comment.
Looks like this is using spaces; can you use tabs for indenting?
There was a problem hiding this comment.
Oops, it was using spaces before, I think I tried to convert it to a tab, but I ended will with just 4 spaces. Will fix
ccaf862 to
e4acf9a
Compare
hack/make/test-unit
Outdated
There was a problem hiding this comment.
I think it's confusing to have the redirection in front of the command. In fact I did not even know that this is possible. I'd prefer to have it at the end of the command.
There was a problem hiding this comment.
Sounds good, moved to the end
|
I'm not familiar with the build and test options, so almost every invocation variant I tried ended up in error messages. That's probably because I'm not familiar with go yet. The script changes all look reasonable to me, Most of it was shifted unchanged, so there is no point in commenting these parts. Only found a small nit, but this is not important. So LGTM. |
e4acf9a to
6bfd986
Compare
|
Re docs, The relationship is something like this:
|
|
While being at it, could you please remove from the |
|
@dnephin thanks a lot for your hints. Now I could successfully execute the changed/new scripts. |
|
Yes, I think a lot of the hidden files are meant to be like libraries that can be sourced, but do run directly. |
|
Removed the |
6bfd986 to
c356e6c
Compare
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Also remove the test flag from pkg/term and jsut checkuid directly. Fixed a problem with a pkg/term test that was leaving the terminal in a bad state. Signed-off-by: Daniel Nephin <dnephin@docker.com>
c356e6c to
1fb6155
Compare
|
ping for another LGTM |
| var rootEnabled bool | ||
|
|
||
| func init() { | ||
| flag.BoolVar(&rootEnabled, "test.root", false, "enable tests that require root") |
There was a problem hiding this comment.
do we know why this was here?
There was a problem hiding this comment.
The intent was to only run some tests if the flag was set. I think the correct behaviour is to optimistically run the tests that can be run when the user is correct.
There was a problem hiding this comment.
Could it be related to running the tests bare-metal? I seem to recall there were some tests in the past that could screw up the host (we had a fun one changing system time to verify certificate expiry)
ping @tiborvass @andrewhsu could you have a quick look to verify we can remove this?
There was a problem hiding this comment.
These tests work with the terminal, so any failure to cleanup should be isolated to the terminal. This patch also includes a fix for a test that did not cleanup properly (defer RestoreTerminal()).
There was a problem hiding this comment.
@thaJeztah @dnephin I think it's fine like this. We could do what dnephin said in https://github.com/moby/moby/pull/33520/files#r125954995 but honestly if you don't run it as root, you'll see the tests as skipped with a reason. The person reading the test logs should pay attention to skipped tests and take the decision of whether that is acceptable or not. That's how they would discover this behavior.
There was a problem hiding this comment.
Thanks for looking; wanted to be sure I didn't miss anything 👍
|
LGTM |
| set -eu -o pipefail | ||
|
|
||
| TESTFLAGS+=" -test.timeout=${TIMEOUT:-5m}" | ||
| BUILDFLAGS=( -tags "netgo seccomp libdm_no_deferred_remove" ) |
There was a problem hiding this comment.
Looks like I missed this; this changes the unit-tests to no longer use the BUILDFLAGS that were passed as env-var (and also changes them to be dynamically linked (previously statically))
There was a problem hiding this comment.
Not using BUILDFLAGS was the intent. Those are the flags for building a binary, not necessarily running tests.
Does that cause a problem?
There was a problem hiding this comment.
Caused me some digging why a backport didn't work, but worked on master 😂
Perhaps we should rename the variable here, to prevent it from being confused with the BUILDFLAGS in the Makefile and so on 🤔
This is similar to the changes we made to
hack/validate. Running tests shouldn't requirehack/make.sh. Moving them tohack/test/will allow us to run them directly with less overhead. It also makes the scripts much easier to read because there's no hidden state provided by a "runner" (hack/make.sh).Also:
hack/make.shto where they are used. The less global state provided byhack/make.shthe easier these scripts are to read.HAVE_GO_TEST_COVERwhich was dead code.I'll address test-integration and test-docker-py as part of carrying #33344