Skip to content

Modern Docker Management, Designed for Everyone

fix: add missing routes to edge tunnel

Kyle Mendell88514f756319
diff --git a/backend/pkg/libarcane/edge/commands.go b/backend/pkg/libarcane/edge/commands.go
index 7661b7841..d9b17c8ba 100644
--- a/backend/pkg/libarcane/edge/commands.go
+++ b/backend/pkg/libarcane/edge/commands.go
@@ -21,6 +21,8 @@ var commandRoutes = []commandRoute{
{Method: http.MethodGet, PathPattern: "/api/environments/{id}/containers/counts", CommandName: "container.counts"},
{Method: http.MethodPost, PathPattern: "/api/environments/{id}/containers", CommandName: "container.create"},
{Method: http.MethodGet, PathPattern: "/api/environments/{id}/containers/{containerId}", CommandName: "container.inspect"},
+ {Method: http.MethodGet, PathPattern: "/api/environments/{id}/containers/{containerId}/edit-config", CommandName: "container.edit_config"},
+ {Method: http.MethodPost, PathPattern: "/api/environments/{id}/containers/{containerId}/edit", CommandName: "container.edit"},
{Method: http.MethodPost, PathPattern: "/api/environments/{id}/containers/{containerId}/start", CommandName: "container.start"},
{Method: http.MethodPost, PathPattern: "/api/environments/{id}/containers/{containerId}/stop", CommandName: "container.stop"},
{Method: http.MethodPost, PathPattern: "/api/environments/{id}/containers/{containerId}/restart", CommandName: "container.restart"},
diff --git a/backend/pkg/libarcane/edge/commands_test.go b/backend/pkg/libarcane/edge/commands_test.go
index a9cda1c5d..b0ee1aef3 100644
--- a/backend/pkg/libarcane/edge/commands_test.go
+++ b/backend/pkg/libarcane/edge/commands_test.go
@@ -20,6 +20,12 @@ func TestResolveEdgeCommandName(t *testing.T) {
shouldHit bool
}{
{name: "container list", method: "GET", path: "/api/environments/0/containers", command: "container.list", shouldHit: true},
+ {name: "container edit config", method: "GET", path: "/api/environments/0/containers/abc/edit-config", command: "container.edit_config", shouldHit: true},
+ {name: "container edit", method: "POST", path: "/api/environments/0/containers/abc/edit", command: "container.edit", shouldHit: true},
+ {name: "container edit config wrong method", method: "POST", path: "/api/environments/0/containers/abc/edit-config", command: "container.edit_config", shouldHit: false},
+ {name: "container edit wrong method", method: "GET", path: "/api/environments/0/containers/abc/edit", command: "container.edit", shouldHit: false},
+ {name: "container edit config stream rejected", method: "GET", path: "/api/environments/0/containers/abc/edit-config", stream: true, command: "container.edit_config", shouldHit: false},
+ {name: "container edit stream rejected", method: "POST", path: "/api/environments/0/containers/abc/edit", stream: true, command: "container.edit", shouldHit: false},
{name: "container start", method: "POST", path: "/api/environments/0/containers/abc/start", command: "container.start", shouldHit: true},
{name: "volume workspace download", method: "GET", path: "/api/environments/0/volumes/data/workspace/file/download?relativePath=notes/readme.txt", command: "volume.workspace.download", shouldHit: true},
{name: "volume workspace list", method: "GET", path: "/api/environments/0/volumes/data/workspace", command: "volume.workspace.list", shouldHit: true},
@@ -57,9 +63,9 @@ func TestResolveEdgeCommandName(t *testing.T) {
command, ok := ResolveEdgeCommandName(tc.method, tc.path, tc.stream).Get()
require.Equal(t, tc.shouldHit, ok)
+ require.Equal(t, tc.shouldHit, ValidateEdgeCommand(tc.command, tc.method, tc.path, tc.stream))
if tc.shouldHit {
require.Equal(t, tc.command, command)
- require.True(t, ValidateEdgeCommand(tc.command, tc.method, tc.path, tc.stream))
}
})
}