Skip to content

Commit

Permalink
RC v4.54 Script Timeout Test Fixes (#20438)
Browse files Browse the repository at this point in the history
Pulling in fixes from main
78ec0b5
  • Loading branch information
mostlikelee authored Jul 15, 2024
1 parent 5316327 commit 289f1f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/service/integration_enterprise_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion server/service/scripts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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."},
Expand Down

0 comments on commit 289f1f4

Please sign in to comment.