1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

feat(support): collect system info bundle to assist support troubleshooting [r8s-157] (#154)

This commit is contained in:
Malcolm Lockyer 2024-12-06 15:38:10 +13:00 committed by GitHub
parent 17648d12fe
commit 783ab253af
17 changed files with 1367 additions and 440 deletions

View file

@ -1,6 +1,14 @@
package endpoints
import portainer "github.com/portainer/portainer/api"
import (
portainer "github.com/portainer/portainer/api"
)
// IsRegularAgentEndpoint returns true if this is a regular agent endpoint
func IsRegularAgentEndpoint(endpoint *portainer.Endpoint) bool {
return endpoint.Type == portainer.AgentOnDockerEnvironment ||
endpoint.Type == portainer.AgentOnKubernetesEnvironment
}
// IsEdgeEndpoint returns true if this is an Edge endpoint
func IsEdgeEndpoint(endpoint *portainer.Endpoint) bool {

View file

@ -7,6 +7,50 @@ import (
"github.com/stretchr/testify/assert"
)
func TestIsRegularAgentEndpoint(t *testing.T) {
tests := []struct {
name string
endpoint *portainer.Endpoint
expected bool
}{
{
name: "AgentOnDockerEnvironment",
endpoint: &portainer.Endpoint{
Type: portainer.AgentOnDockerEnvironment,
},
expected: true,
},
{
name: "AgentOnKubernetesEnvironment",
endpoint: &portainer.Endpoint{
Type: portainer.AgentOnKubernetesEnvironment,
},
expected: true,
},
{
name: "EdgeAgentOnDockerEnvironment",
endpoint: &portainer.Endpoint{
Type: portainer.EdgeAgentOnDockerEnvironment,
},
expected: false,
},
{
name: "EdgeAgentOnKubernetesEnvironment",
endpoint: &portainer.Endpoint{
Type: portainer.EdgeAgentOnKubernetesEnvironment,
},
expected: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := IsRegularAgentEndpoint(tt.endpoint)
assert.Equal(t, tt.expected, result)
})
}
}
func TestIsEdgeEndpoint(t *testing.T) {
tests := []struct {
name string