Add inline edit functionality for environment variables, labels, and
volume mounts on the app detail page. Each entity row now has an Edit
button that reveals an inline form using Alpine.js.
- POST /apps/{id}/env-vars/{varID}/edit
- POST /apps/{id}/labels/{labelID}/edit
- POST /apps/{id}/volumes/{volumeID}/edit
- Path validation for volume host and container paths
- Warning banner about container restart after env var changes
- Tests for ValidateVolumePath
fixes #67
35 lines
831 B
Go
35 lines
831 B
Go
package handlers //nolint:testpackage // tests exported ValidateVolumePath function
|
|
|
|
import "testing"
|
|
|
|
func TestValidateVolumePath(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
tests := []struct {
|
|
name string
|
|
path string
|
|
wantErr bool
|
|
}{
|
|
{"valid absolute path", "/data/myapp", false},
|
|
{"root path", "/", false},
|
|
{"empty path", "", true},
|
|
{"relative path", "data/myapp", true},
|
|
{"path with dotdot", "/data/../etc", true},
|
|
{"path with trailing slash", "/data/", true},
|
|
{"path with double slash", "/data//myapp", true},
|
|
{"single dot path", ".", true},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
err := ValidateVolumePath(tt.path)
|
|
if (err != nil) != tt.wantErr {
|
|
t.Errorf("ValidateVolumePath(%q) error = %v, wantErr %v",
|
|
tt.path, err, tt.wantErr)
|
|
}
|
|
})
|
|
}
|
|
}
|