mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
fix: fixes output of argocd proj windows list PROJ - USEANDOPERATOR was missing (#26273)
Signed-off-by: Patroklos Papapetrou <ppapapetrou76@gmail.com>
This commit is contained in:
parent
88223b09e4
commit
2b3eae62c4
2 changed files with 41 additions and 1 deletions
|
|
@ -362,7 +362,7 @@ argocd proj windows list test-project`,
|
|||
func printSyncWindows(proj *v1alpha1.AppProject) {
|
||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||
var fmtStr string
|
||||
headers := []any{"ID", "STATUS", "KIND", "SCHEDULE", "DURATION", "APPLICATIONS", "NAMESPACES", "CLUSTERS", "MANUALSYNC", "TIMEZONE"}
|
||||
headers := []any{"ID", "STATUS", "KIND", "SCHEDULE", "DURATION", "APPLICATIONS", "NAMESPACES", "CLUSTERS", "MANUALSYNC", "TIMEZONE", "USEANDOPERATOR"}
|
||||
fmtStr = strings.Repeat("%s\t", len(headers)) + "\n"
|
||||
fmt.Fprintf(w, fmtStr, headers...)
|
||||
if proj.Spec.SyncWindows.HasWindows() {
|
||||
|
|
|
|||
40
cmd/argocd/commands/projectwindows_test.go
Normal file
40
cmd/argocd/commands/projectwindows_test.go
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
|
||||
)
|
||||
|
||||
func TestPrintSyncWindows(t *testing.T) {
|
||||
proj := &v1alpha1.AppProject{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "test-project"},
|
||||
Spec: v1alpha1.AppProjectSpec{
|
||||
SyncWindows: v1alpha1.SyncWindows{
|
||||
{
|
||||
Kind: "allow",
|
||||
Schedule: "* * * * *",
|
||||
Duration: "1h",
|
||||
Applications: []string{"app1"},
|
||||
Namespaces: []string{"ns1"},
|
||||
Clusters: []string{"cluster1"},
|
||||
ManualSync: true,
|
||||
UseAndOperator: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
output, err := captureOutput(func() error {
|
||||
printSyncWindows(proj)
|
||||
return nil
|
||||
})
|
||||
require.NoError(t, err)
|
||||
t.Log(output)
|
||||
assert.Contains(t, output, "ID STATUS KIND SCHEDULE DURATION APPLICATIONS NAMESPACES CLUSTERS MANUALSYNC TIMEZONE USEANDOPERATOR")
|
||||
assert.Contains(t, output, "0 Active allow * * * * * 1h app1 ns1 cluster1 Enabled Enabled")
|
||||
}
|
||||
Loading…
Reference in a new issue