mirror of
https://github.com/fluxcd/flux2.git
synced 2025-10-28 23:14:48 +08:00
feat: add --ignore-paths flag to flux create source (git|bucket)
A new --ignore-paths flag is added to following commands: flux create source git --ignore-paths ... flux create source bucket --ignore-paths ... A StringSliceVar is used which supports specifying the flag multiple times to populate a list or either a comma seperated string value A unit test with a golden file is added to validate the flag Signed-off-by: Tarun Gupta Akirala <takirala@users.noreply.github.com>
This commit is contained in:
@ -85,6 +85,31 @@ func (r *reconciler) conditionFunc() (bool, error) {
|
||||
return true, err
|
||||
}
|
||||
|
||||
func TestCreateSourceGitExport(t *testing.T) {
|
||||
var command = "create source git podinfo --url=https://github.com/stefanprodan/podinfo --branch=master --ignore-paths .cosign,non-existent-dir/ -n default --interval 1m --export --timeout=" + testTimeout.String()
|
||||
|
||||
cases := []struct {
|
||||
name string
|
||||
args string
|
||||
assert assertFunc
|
||||
}{
|
||||
{
|
||||
"ExportSucceeded",
|
||||
command,
|
||||
assertGoldenFile("testdata/create_source_git/export.golden"),
|
||||
},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
cmd := cmdTestCase{
|
||||
args: tc.args,
|
||||
assert: tc.assert,
|
||||
}
|
||||
cmd.runTestCmd(t)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreateSourceGit(t *testing.T) {
|
||||
// Default command used for multiple tests
|
||||
var command = "create source git podinfo --url=https://github.com/stefanprodan/podinfo --branch=master --timeout=" + testTimeout.String()
|
||||
|
||||
Reference in New Issue
Block a user