Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dantecatalfamo committed Jan 7, 2025
1 parent 52b66ab commit fe5c9ee
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions server/service/integration_enterprise_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,26 @@ func (s *integrationEnterpriseTestSuite) TestTeamEndpoints() {
"x": "y"
}`), http.StatusBadRequest, &tmResp)

// modify team agent options with invalid key
badRes := s.Do("POST", fmt.Sprintf("/api/latest/fleet/teams/%d/agent_options", tm1ID), json.RawMessage(`{
"bad_key": 1
}`), http.StatusBadRequest)
errText := extractServerErrorText(badRes.Body)
require.Contains(t, errText, "unsupported key provided")

// modify team agent options with correct options under the wrong key
badRes = s.Do("POST", fmt.Sprintf("/api/latest/fleet/teams/%d/agent_options", tm1ID), json.RawMessage(`{
"distributed_tls_max_attempts": 3
}`), http.StatusBadRequest)
errText = extractServerErrorText(badRes.Body)
require.Contains(t, errText, "\"distributed_tls_max_attempts\" should be part of the \"config.options\" object")

badRes = s.Do("POST", fmt.Sprintf("/api/latest/fleet/teams/%d/agent_options", tm1ID), json.RawMessage(`{
"update_channels": { "config": 1 }
}`), http.StatusBadRequest)
errText = extractServerErrorText(badRes.Body)
require.Contains(t, errText, "\"config\" should be part of the top level object")

// modify team agent options with invalid platform options
tmResp.Team = nil
s.DoJSON("POST", fmt.Sprintf("/api/latest/fleet/teams/%d/agent_options", tm1ID), json.RawMessage(
Expand Down

0 comments on commit fe5c9ee

Please sign in to comment.