Skip to content

Expose testutil integration workers as public#3866

Merged
jedevc merged 2 commits into
moby:masterfrom
jedevc:public-integration-workers
May 15, 2023
Merged

Expose testutil integration workers as public#3866
jedevc merged 2 commits into
moby:masterfrom
jedevc:public-integration-workers

Conversation

@jedevc
Copy link
Copy Markdown
Member

@jedevc jedevc commented May 12, 2023

This PR exposes the integration test workers as public, performing a few small refactors to make them more flexible (so that the caller can always enforce a custom name).

This is designed to be used in the context of docker/buildx#1770, where we wrap the moby worker to create the docker driver worker, and wrap the oci worker to create the remote driver worker.

This allows us to avoid copying all the logic to spin up buildkit sandboxes inside of buildx, and to share that logic, so that we can automatically consume changes from the upstream test framework.

Additionally, we also add a new DockerAddress method to the Backend interface which returns the address of the UNIX socket for worker backends that support it (currently only moby).

type Backend interface {
	Address() string
+	DockerAddress() string
	ContainerdAddress() string
   ...

This is designed to be consumed by the buildx docker driver worker wrapper, so that we can connect directly to the docker instance using the docker driver.

jedevc added 2 commits May 12, 2023 12:02
Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
@jedevc jedevc force-pushed the public-integration-workers branch from 6b7f5d7 to 0cc3c30 Compare May 12, 2023 11:03
@@ -35,6 +35,7 @@ func init() {
// Backend is the minimal interface that describes a testing backend.
type Backend interface {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could maybe use some future refactoring if we want to make integration pkg more reusable. Currently, some of these methods are very specific for a single worker implementation (or "buildkit worker" implementation). Ideally this could be used for any backend. Now that worker implementations are public they don't need to be always defined and imported with this pkg either.

Otoh, we need to be careful that the test sides do not need a lot of boilerplate for type checking.

@jedevc jedevc merged commit fec5a04 into moby:master May 15, 2023
@jedevc jedevc deleted the public-integration-workers branch May 15, 2023 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants