Skip to content

Commit

Permalink
LOG-4822: Loki output without URL should fail validation
Browse files Browse the repository at this point in the history
Signed-off-by: Vitalii Parfonov <vparfono@redhat.com>
  • Loading branch information
vparfonov authored and openshift-merge-bot[bot] committed Jan 17, 2024
1 parent 3471229 commit 377e546
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Expand Up @@ -330,8 +330,7 @@ func verifyOutputURL(output *loggingv1.OutputSpec, conds loggingv1.NamedConditio
if output.URL == "" {
// Some output types allow a missing URL
// TODO (alanconway) move output-specific valiation to the output implementation.
if output.Type == loggingv1.OutputTypeCloudwatch ||
output.Type == loggingv1.OutputTypeGoogleCloudLogging || output.Type == loggingv1.OutputTypeLoki {
if output.Type == loggingv1.OutputTypeCloudwatch || output.Type == loggingv1.OutputTypeGoogleCloudLogging {
return true
} else {
return fail(CondInvalid("URL is required for output type %v", output.Type))
Expand Down
Expand Up @@ -1402,6 +1402,17 @@ func Test_verifyOutputURL(t *testing.T) {
},
want: false,
},
{
name: "With Loki output without URL should fail",
args: args{
output: &loggingv1.OutputSpec{
Name: "test-output",
Type: loggingv1.OutputTypeLoki,
},
conds: loggingv1.NamedConditions{},
},
want: false,
},
}
for _, tt := range tests {
tt := tt // Don't bind range variable.
Expand Down

0 comments on commit 377e546

Please sign in to comment.