mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Hotfix - Correct Async Run Script Validation Test (#20405)
This commit is contained in:
parent
df78d83e2b
commit
78ec0b5254
2 changed files with 2 additions and 2 deletions
|
|
@ -5279,7 +5279,7 @@ func (s *integrationEnterpriseTestSuite) TestRunHostScript() {
|
|||
// attempt to run an empty script
|
||||
res := s.Do("POST", "/api/latest/fleet/scripts/run", fleet.HostScriptRequestPayload{HostID: host.ID, ScriptContents: ""}, http.StatusUnprocessableEntity)
|
||||
errMsg := extractServerErrorText(res.Body)
|
||||
require.Contains(t, errMsg, "Script contents must not be empty.")
|
||||
require.Contains(t, errMsg, "Validation Failed: One of 'script_id', 'script_contents', or 'script_name' is required.")
|
||||
|
||||
// attempt to run an overly long script
|
||||
res = s.Do("POST", "/api/latest/fleet/scripts/run", fleet.HostScriptRequestPayload{HostID: host.ID, ScriptContents: strings.Repeat("a", fleet.UnsavedScriptMaxRuneLen+1)}, http.StatusUnprocessableEntity)
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ func TestHostRunScript(t *testing.T) {
|
|||
script string
|
||||
wantErr string
|
||||
}{
|
||||
{"empty script", "", "Script contents must not be empty."},
|
||||
{"empty script", "", "One of 'script_id', 'script_contents', or 'script_name' is required."},
|
||||
{"overly long script", strings.Repeat("a", fleet.UnsavedScriptMaxRuneLen+1), "Script is too large."},
|
||||
{"large script", strings.Repeat("a", fleet.UnsavedScriptMaxRuneLen), ""},
|
||||
{"invalid utf8", "\xff\xfa", "Wrong data format."},
|
||||
|
|
|
|||
Loading…
Reference in a new issue