From cc38e3a35c73f3ea099ecf2d7d21372ab5f1f1dd Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 10 Apr 2019 15:27:17 +0200 Subject: [PATCH 1/2] Fix TestValidRemoteDriver GetCapabilities errors This test was producing error messages due to missing endpoints in the plugin API; ``` === RUN TestValidRemoteDriver ERRO[0039] error getting capability for valid-network-driver due to NetworkDriver.GetCapabilities: 404 page not found ``` Signed-off-by: Sebastiaan van Stijn --- libnetwork/libnetwork_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libnetwork/libnetwork_test.go b/libnetwork/libnetwork_test.go index 818be75f73..119a3d24d0 100644 --- a/libnetwork/libnetwork_test.go +++ b/libnetwork/libnetwork_test.go @@ -1375,6 +1375,10 @@ func TestValidRemoteDriver(t *testing.T) { w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") fmt.Fprintf(w, `{"Implements": ["%s"]}`, driverapi.NetworkPluginEndpointType) }) + mux.HandleFunc(fmt.Sprintf("/%s.GetCapabilities", driverapi.NetworkPluginEndpointType), func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") + fmt.Fprintf(w, `{"Scope":"local"}`) + }) mux.HandleFunc(fmt.Sprintf("/%s.CreateNetwork", driverapi.NetworkPluginEndpointType), func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") fmt.Fprintf(w, "null") From e9bd147bb772b471ee4cd0290e9e29deec645837 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 10 Apr 2019 18:23:51 +0200 Subject: [PATCH 2/2] Add Delete endpoint for plugin in test Signed-off-by: Sebastiaan van Stijn --- libnetwork/libnetwork_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libnetwork/libnetwork_test.go b/libnetwork/libnetwork_test.go index 119a3d24d0..ace38e89a2 100644 --- a/libnetwork/libnetwork_test.go +++ b/libnetwork/libnetwork_test.go @@ -1383,6 +1383,10 @@ func TestValidRemoteDriver(t *testing.T) { w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") fmt.Fprintf(w, "null") }) + mux.HandleFunc(fmt.Sprintf("/%s.DeleteNetwork", driverapi.NetworkPluginEndpointType), func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") + fmt.Fprintf(w, "null") + }) if err := os.MkdirAll("/etc/docker/plugins", 0755); err != nil { t.Fatal(err)