1
0
mirror of synced 2026-06-26 21:50:48 +00:00

Fix 'flux get all --status-selector' for Alert and Provider

Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
This commit is contained in:
Matheus Pimenta
2026-06-25 12:15:26 +01:00
parent cec25b5d1e
commit 65d4635709
5 changed files with 71 additions and 2 deletions
+33
View File
@@ -103,6 +103,39 @@ func Test_GetCmdStatusSelector(t *testing.T) {
}
}
func Test_GetCmdStatusSelectorSyntheticReady(t *testing.T) {
tmpl := map[string]string{
"fluxns": allocateNamespace("flux-system"),
}
testEnv.CreateObjectFile("./testdata/get/notification_objects.yaml", tmpl, t)
commands := []string{
"get alerts",
"get alert-providers",
"get all",
}
for _, command := range commands {
t.Run(command, func(t *testing.T) {
unfilteredOutput, err := executeCommand(command + " -n " + tmpl["fluxns"])
if err != nil {
t.Fatalf("%s failed: %v", command, err)
}
if unfilteredOutput == "" {
t.Fatalf("expected %s output for namespace with notification objects", command)
}
filteredOutput, err := executeCommand(command + " --status-selector Ready=True -n " + tmpl["fluxns"])
if err != nil {
t.Fatalf("%s with Ready=True status selector failed: %v", command, err)
}
if filteredOutput != unfilteredOutput {
t.Fatalf("expected Ready=True filtered output to match unfiltered output:\nfiltered:\n%s\nunfiltered:\n%s", filteredOutput, unfilteredOutput)
}
})
}
}
func Test_GetAllCmdStatusSelectorNoMatches(t *testing.T) {
tmpl := map[string]string{
"fluxns": allocateNamespace("flux-system"),