Allow configuration of how a model is stopped before swapping. Setting `cmdStop` in the configuration will override the default behaviour and enables better integration with other process/container managers like docker or podman.
42 lines
802 B
Go
42 lines
802 B
Go
//go:build windows
|
|
|
|
package proxy
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestConfig_SanitizeCommand(t *testing.T) {
|
|
// does not support single quoted strings like in config_posix_test.go
|
|
args, err := SanitizeCommand(`python model1.py \
|
|
|
|
-a "double quotes" \
|
|
-s
|
|
--arg3 123 \
|
|
|
|
# comment 2
|
|
--arg4 '"string in string"'
|
|
|
|
|
|
|
|
# this will get stripped out as well as the white space above
|
|
-c "'single quoted'"
|
|
`)
|
|
assert.NoError(t, err)
|
|
assert.Equal(t, []string{
|
|
"python", "model1.py",
|
|
"-a", "double quotes",
|
|
"-s",
|
|
"--arg3", "123",
|
|
"--arg4", "'string in string'", // this is a little weird but the lexer says so...?
|
|
"-c", `'single quoted'`,
|
|
}, args)
|
|
|
|
// Test an empty command
|
|
args, err = SanitizeCommand("")
|
|
assert.Error(t, err)
|
|
assert.Nil(t, args)
|
|
}
|