mirror of
https://github.com/portainer/portainer.git
synced 2026-06-23 07:20:13 +00:00
d9673e33ec
Co-authored-by: Claude <noreply@anthropic.com>
32 lines
696 B
Go
32 lines
696 B
Go
package stacks
|
|
|
|
import (
|
|
"testing"
|
|
|
|
portainer "github.com/portainer/portainer/api"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestComposeGitPayload_ValidateWithSourceID_URLNotRequired(t *testing.T) {
|
|
t.Parallel()
|
|
payload := &composeStackFromGitRepositoryPayload{
|
|
Name: "mystack",
|
|
SourceID: portainer.SourceID(1),
|
|
// RepositoryURL intentionally omitted
|
|
}
|
|
|
|
err := payload.Validate(nil)
|
|
assert.NoError(t, err)
|
|
}
|
|
|
|
func TestComposeGitPayload_ValidateWithoutSourceID_URLRequired(t *testing.T) {
|
|
t.Parallel()
|
|
payload := &composeStackFromGitRepositoryPayload{
|
|
Name: "mystack",
|
|
// SourceID and RepositoryURL both omitted
|
|
}
|
|
|
|
err := payload.Validate(nil)
|
|
assert.Error(t, err)
|
|
}
|