driver: add feature testing

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2019-04-10 18:57:54 -07:00
parent 68cad8e46b
commit 0788035da8
7 changed files with 77 additions and 6 deletions

View File

@ -24,6 +24,7 @@ var buildkitImage = "moby/buildkit:master" // TODO: make this verified and confi
type Driver struct {
driver.InitConfig
factory driver.Factory
version dockertypes.Version
}
@ -190,6 +191,20 @@ func (d *Driver) Client(ctx context.Context) (*client.Client, error) {
}))
}
func (d *Driver) Factory() driver.Factory {
return d.factory
}
func (d *Driver) Features() map[driver.Feature]bool {
return map[driver.Feature]bool{
driver.OCIExporter: true,
driver.DockerExporter: true,
driver.CacheExport: true,
driver.MultiPlatform: true,
}
}
func demuxConn(c net.Conn) net.Conn {
pr, pw := io.Pipe()
// TODO: rewrite parser with Reader() to avoid goroutine switch

View File

@ -42,5 +42,5 @@ func (f *factory) New(ctx context.Context, cfg driver.InitConfig) (driver.Driver
return nil, errors.Wrapf(driver.ErrNotConnecting, err.Error())
}
return &Driver{InitConfig: cfg, version: v}, nil
return &Driver{factory: f, InitConfig: cfg, version: v}, nil
}