mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
* feat(git): save git config when creating stack (#5048) * feat(git): save git config when creating stack * chore(fs): test fileExists * fix(git): fix tests to use CloneRepository * refactor(git): move options to new object * feat(stacks): redeploy git stack api (#5112) * feat(stacks): redeploy git stacks form [EE-666] * feat(stack): show loading after confirmation * fix(stacks): show same size description * fix(stacks): reload state when deployed * feat(stacks): set stopped stacks status to activate when updating * feat(stacks): backup stack folder before cloning * feat(stacks): don't accept prune and env on update git Co-authored-by: Chaim Lev-Ari <chiptus@users.noreply.github.com> Co-authored-by: Chaim Lev-Ari <chiptus@gmail.com>
29 lines
864 B
Go
29 lines
864 B
Go
package stacks
|
|
|
|
import (
|
|
"testing"
|
|
|
|
portainer "github.com/portainer/portainer/api"
|
|
gittypes "github.com/portainer/portainer/api/git/types"
|
|
"github.com/portainer/portainer/api/http/security"
|
|
"github.com/portainer/portainer/api/internal/testhelpers"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func Test_stackHandler_cloneAndSaveConfig_shouldCallGitCloneAndSaveConfigOnStack(t *testing.T) {
|
|
handler := NewHandler(&security.RequestBouncer{})
|
|
handler.GitService = testhelpers.NewGitService()
|
|
|
|
url := "url"
|
|
refName := "ref"
|
|
configPath := "path"
|
|
stack := &portainer.Stack{}
|
|
err := handler.cloneAndSaveConfig(stack, "", url, refName, configPath, false, "", "")
|
|
assert.NoError(t, err, "clone and save should not fail")
|
|
|
|
assert.Equal(t, gittypes.RepoConfig{
|
|
URL: url,
|
|
ReferenceName: refName,
|
|
ConfigFilePath: configPath,
|
|
}, *stack.GitConfig)
|
|
}
|