mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 05:19:39 +02:00
feat(edgestacks): support kubernetes edge stacks (#5276) [EE-393]
This commit is contained in:
parent
79ca51c92e
commit
5c8450c4c0
56 changed files with 1466 additions and 521 deletions
47
api/internal/endpointutils/endpoint_test.go
Normal file
47
api/internal/endpointutils/endpoint_test.go
Normal file
|
@ -0,0 +1,47 @@
|
|||
package endpointutils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
portainer "github.com/portainer/portainer/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type isEndpointTypeTest struct {
|
||||
endpointType portainer.EndpointType
|
||||
expected bool
|
||||
}
|
||||
|
||||
func Test_IsDockerEndpoint(t *testing.T) {
|
||||
tests := []isEndpointTypeTest{
|
||||
{endpointType: portainer.DockerEnvironment, expected: true},
|
||||
{endpointType: portainer.AgentOnDockerEnvironment, expected: true},
|
||||
{endpointType: portainer.AzureEnvironment, expected: false},
|
||||
{endpointType: portainer.EdgeAgentOnDockerEnvironment, expected: true},
|
||||
{endpointType: portainer.KubernetesLocalEnvironment, expected: false},
|
||||
{endpointType: portainer.AgentOnKubernetesEnvironment, expected: false},
|
||||
{endpointType: portainer.EdgeAgentOnKubernetesEnvironment, expected: false},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
ans := IsDockerEndpoint(&portainer.Endpoint{Type: test.endpointType})
|
||||
assert.Equal(t, test.expected, ans)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_IsKubernetesEndpoint(t *testing.T) {
|
||||
tests := []isEndpointTypeTest{
|
||||
{endpointType: portainer.DockerEnvironment, expected: false},
|
||||
{endpointType: portainer.AgentOnDockerEnvironment, expected: false},
|
||||
{endpointType: portainer.AzureEnvironment, expected: false},
|
||||
{endpointType: portainer.EdgeAgentOnDockerEnvironment, expected: false},
|
||||
{endpointType: portainer.KubernetesLocalEnvironment, expected: true},
|
||||
{endpointType: portainer.AgentOnKubernetesEnvironment, expected: true},
|
||||
{endpointType: portainer.EdgeAgentOnKubernetesEnvironment, expected: true},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
ans := IsKubernetesEndpoint(&portainer.Endpoint{Type: test.endpointType})
|
||||
assert.Equal(t, test.expected, ans)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue