-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Test dockerfile in gateway mode #552
Conversation
ddd98b7
to
f6c8bea
Compare
Pushed a bit more than I intended, now dropped. I guess |
Re time taken, perhaps |
if opt.FrontendAttrs == nil { | ||
opt.FrontendAttrs = make(map[string]string) | ||
} | ||
opt.FrontendAttrs["source"] = "tonistiigi/dockerfile" |
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.
tonistiigi/dockerfile:master
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.
Done, I had misread https://hub.docker.com/r/tonistiigi/dockerfile/tags/. I will also revisit "dockerfile: skip some tests which appear to fail in gateway mode" since this may have changed the results.
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.
BTW, I still have this concern from the intro:
which I suspect (I'm not entirely sure, but I am pretty confident) isn't always going to work e.g. when adding a new dockerfile feature and testing it. Need to find a mechanism to instead inject a locally freshly built image.
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.
will also revisit "dockerfile: skip some tests which appear to fail in gateway mode"
All apart from TestDockerfileInvalidCommand
now pass and I can see the issue with that one so I updated the skip reason and commit message to reflect that.
It does imply that image skew is a real problem though.
I'd assume the performance is from pulling from registry for every test. We could set up a shared local registry and use that in the tests (and later for busybox/alpine as well). For the setup I think it might make sense to have a list/map like |
f6c8bea
to
15186ca
Compare
Ah, yes, that's plausible.
You intend this to be a list/map of that matrix of runtime and frontend mode eg. "oci + gateway"/ "containerd + builtin", as opposed to a list of tests like the one in
Indeed, it's complete overkill right now. |
15186ca
to
93156ac
Compare
|
I'm not 100% sure how to tie it with specific workers but the issue with dispatchAll is that it can only run everything together by only configuring one predefined variable (mode). I think it would be more flexible if the instead of the mode what you would configure would be the list of tests. |
I'd been toying with an idea in my head of something like: type C struct { // a (C)ell in a test Matrix
mode M
worker W // TBD the real type
}
const (
BuiltinOCI = C{Builtin, OCI},
BuiltinContainerd = C{Builtin, Containerd},
GatewayOCI = C{Gateway, OCI},
...etc
}
type T struct { // a (T)est
func(*testing.T, integration.Sandbox, *frontend)
[]C
} Then have a list in cases := []T{
{testNoLeakSnapshot, []C{BuiltinOCI, GatewayOCI, ... },
{testSomethingElse, []C{BuiltinOCI, GatewayContainerd, ...},
...
} With the idea that It's a bit horribly verbose (although shorter aliases would help). Sadly I think cases := []T{
{testNoLeakSnapshot, []C{BuiltinOCI, GatewayOCI, ... },
{testSomethingElse, []C{BuiltinOCI, GatewayContainerd, ...},
{testAnother, []C{BuiltinOCI, BuiltinContainerd,
...
} Which exposes the matrix visually. If cases := []T{ // BuiltinOCI BuildingContainerd GatewayOCI, GatewayContainerd
{testNoLeakSnapshot, []C{true, false, true, false },
{testSomethingElse, []C{true, true, false, false },
...
} It doesn't really scale to any additional dimensions over {test×runtime×mode} though. I'm also a bit wary of slicing the matrix since it's non-obvious which mode/runtime combinations might expose various types of bugs reliably. Another way would be to repeat the test functions, so cases := []T{
{testNoLeakSnapshot, Builtin, OCI },
{testNoLeakSnapshot, Gateway, OCI },
{testSomethingElse, Builtin, OCI },
{testSomethingElse, Gateway, Containerd },
{testAnother, Builtin, OCI },
{testAnother, Builtin, Containerd }, Doesn't give you quite the same overview of the matrix, but does scale more easily to other dimensions (are there other dimensions we might care about here?) |
case ModeBuiltin: | ||
cmd += " --frontend dockerfile.v0" | ||
case ModeMasterGateway: | ||
cmd += " --frontend gateway.v0 --frontend-opt=source=tonistiigi/dockerfile" |
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.
This one should have :master
on it too. This also explained the failure of TestDockerfileInvalidCommand
so that commit can now be dropped too.
e29fb59
to
2972ec8
Compare
@tonistiigi Rereading #552 (comment) perhaps I overthought it and all you meant was that dispatch all should be: dispatchAll(t *testing.T, m Mode, []func(*testing.T, integration.Sandbox, *frontend)) So that each of |
Related to the overall time taken to test 3 modes, what do you think about dropping the builtin mode altogether and just having client side gateway and frontend modes? |
@ijc Builtin is the default on moby so I'm hesitant to drop it atm. |
Ah, I had just assumed it was via the gateway, nm. |
2972ec8
to
f420d15
Compare
Rebased and added the Looks like |
It's a bit of a hack but I added a commit which causes |
(nb: this will still fail until #582 is merged) |
There is no need to repeat this test. Signed-off-by: Ian Campbell <ijc@docker.com>
This adds the `TestDispatch` interface, which gives the caller the opportunity to nominate a function to use to calculate the name. This is useful if the real test function takes arguments other than `*testing.T, Sandbox` since a wrapper (possibly anonymous) can then be used to set things up and produce the extra arguments etc. The existing `Test` type implements the new interface and a simple helper function means existing code continues to work. Signed-off-by: Ian Campbell <ijc@docker.com>
…uiltin` To achive this each test case now takes an additional `frontend` parameter which provides an appropriate `solver` and `dfCmdArgs` which are the only places so far that need to differ based on the way the frontend is run. Uses the new `TestDispatcher` interface to allow this new option to be added. Signed-off-by: Ian Campbell <ijc@docker.com>
…a time Cummulatively running in all modes (or even two of them) hits the 10min default maximum time for a test. Instead only run in builtin mode (the previous sole mode) by default and require an environment variable (`BUILDKIT_DOCKERFILE_INTEGRATION_MODE`) to test the other modes. Update `hack/test` to run the other modes after the main tests iff the envvar was not set. Signed-off-by: Ian Campbell <ijc@docker.com>
69f418f
to
2d5eacc
Compare
I rebased. In theory this should now all pass. The two new tests picked up by the rebase ( I've dropped the WIP since I think that's the last remaining issue. |
I'm going to see if I can convince |
|
Cool thanks, will watch out for it. |
Closing in favour of #622 |
This arose as a possibility in #533 (comment). I have a few concerns though:
tonistiigi/dockerfile:latest
, which I suspect (I'm not entirely sure, but I am pretty confident) isn't always going to work e.g. when adding a new dockerfile feature and testing it. Need to find a mechanism to instead inject a locally freshly built image.builtin
tests take 3m51 (wallclock) and thegateway
ones 5m55 (wallclock).gateway
is a surprising amount slower (nb: this was run on my laptop, so not exactly controlled conditions)client
(i.e. the work in access gateway API from client #533) as a third mode the overall test breaches the 10min limit imposed bygo test
on a single test (even though it is 3 separate top levelTestFoo
functions). I couldn't see a programmatic way to get around that (could usego test -timeout
but that's not ideal).t.Skip
/TBD in gateway mode since they were failing for me, need to investigate why.Also:
testNoSnapshotLeak