Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fx related issues for agenttelemetry improvements #29789

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions cmd/agent/subcommands/diagnose/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,19 +267,8 @@ This command print the security-agent metadata payload. This payload is used by
},
}

showPayloadCommand.AddCommand(payloadV5Cmd)
showPayloadCommand.AddCommand(payloadGohaiCmd)
showPayloadCommand.AddCommand(payloadInventoriesAgentCmd)
showPayloadCommand.AddCommand(payloadInventoriesHostCmd)
showPayloadCommand.AddCommand(payloadInventoriesOtelCmd)
showPayloadCommand.AddCommand(payloadInventoriesChecksCmd)
showPayloadCommand.AddCommand(payloadInventoriesPkgSigningCmd)
showPayloadCommand.AddCommand(payloadSystemProbeCmd)
showPayloadCommand.AddCommand(payloadSecurityAgentCmd)
diagnoseCommand.AddCommand(showPayloadCommand)

showAgentTelemetryCommand := &cobra.Command{
Use: "show-telemetry",
Use: "agent-telemetry",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This is a breaking change. I guess this should be OK as the command is very new.

Copy link
Member Author

@GustavoCaso GustavoCaso Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not a breaking change as the command is not release yet. This PR uses this PR as the starting point #29770

The starting point PR hasn't being merge yet

Short: "Print agent telemetry payloads sent by the agent.",
Long: `.`,
RunE: func(_ *cobra.Command, _ []string) error {
Expand All @@ -290,7 +279,18 @@ This command print the security-agent metadata payload. This payload is used by
)
},
}
diagnoseCommand.AddCommand(showAgentTelemetryCommand)

showPayloadCommand.AddCommand(payloadV5Cmd)
showPayloadCommand.AddCommand(payloadGohaiCmd)
showPayloadCommand.AddCommand(payloadInventoriesAgentCmd)
showPayloadCommand.AddCommand(payloadInventoriesHostCmd)
showPayloadCommand.AddCommand(payloadInventoriesOtelCmd)
showPayloadCommand.AddCommand(payloadInventoriesChecksCmd)
showPayloadCommand.AddCommand(payloadInventoriesPkgSigningCmd)
showPayloadCommand.AddCommand(payloadSystemProbeCmd)
showPayloadCommand.AddCommand(payloadSecurityAgentCmd)
showPayloadCommand.AddCommand(showAgentTelemetryCommand)
diagnoseCommand.AddCommand(showPayloadCommand)

return []*cobra.Command{diagnoseCommand}
}
Expand Down
10 changes: 10 additions & 0 deletions cmd/agent/subcommands/diagnose/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,13 @@ func TestShowMetadataSecurityAgentCommand(t *testing.T) {
require.Equal(t, false, secretParams.Enabled)
})
}

func TestShowAgentTelemetryCommand(t *testing.T) {
fxutil.TestOneShotSubcommand(t,
Commands(&command.GlobalParams{}),
[]string{"diagnose", "show-metadata", "agent-telemetry"},
printPayload,
func(_ core.BundleParams, secretParams secrets.Params) {
require.Equal(t, false, secretParams.Enabled)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ question: ‏What is the goal of this test ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect this test to check "agent-telemetry"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ogaca-dd @misteriaud fixed 😄

})
}