From c7fbf1089cd7a88b8fc0ac3f5b725e5ad9c64ff4 Mon Sep 17 00:00:00 2001 From: Thomas Lefebvre Date: Fri, 11 Mar 2022 15:33:08 -0800 Subject: [PATCH] fix: update incorrect DriverNetworkManager interface implementation in plugins/drivers/client.go and drivers/mock/driver.go And add assertions to catch drifts at compilation time. --- drivers/mock/driver.go | 6 ++++-- plugins/drivers/client.go | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/mock/driver.go b/drivers/mock/driver.go index 604ac51ec..c315c5b79 100644 --- a/drivers/mock/driver.go +++ b/drivers/mock/driver.go @@ -670,8 +670,10 @@ func (d *Driver) GetHandle(taskID string) *taskHandle { return h } -func (d *Driver) CreateNetwork(allocID string) (*drivers.NetworkIsolationSpec, error) { - return nil, nil +var _ drivers.DriverNetworkManager = (*Driver)(nil) + +func (d *Driver) CreateNetwork(allocID string, request *drivers.NetworkCreateRequest) (*drivers.NetworkIsolationSpec, bool, error) { + return nil, true, nil } func (d *Driver) DestroyNetwork(allocID string, spec *drivers.NetworkIsolationSpec) error { diff --git a/plugins/drivers/client.go b/plugins/drivers/client.go index e84c90dee..fd835ee53 100644 --- a/plugins/drivers/client.go +++ b/plugins/drivers/client.go @@ -468,7 +468,9 @@ func (d *driverPluginClient) ExecTaskStreamingRaw(ctx context.Context, } } -func (d *driverPluginClient) CreateNetwork(allocID string) (*NetworkIsolationSpec, bool, error) { +var _ DriverNetworkManager = (*driverPluginClient)(nil) + +func (d *driverPluginClient) CreateNetwork(allocID string, _ *NetworkCreateRequest) (*NetworkIsolationSpec, bool, error) { req := &proto.CreateNetworkRequest{ AllocId: allocID, }