Skip to content

Commit

Permalink
explicitly test TCPConnectAnalyze unconditional fallthrough behavior (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya committed Jun 16, 2023
1 parent fefe118 commit 557a138
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions pkg/analyze/host_tcp_connect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,40 @@ func TestAnalyzeTCPConnect(t *testing.T) {
},
},
},
{
name: "unknown status",
info: &collect.NetworkStatusResult{
Status: "test value",
},
hostAnalyzer: &troubleshootv1beta2.TCPConnectAnalyze{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Fail: &troubleshootv1beta2.SingleOutcome{
When: "connection-refused",
Message: "Connection was refused",
},
},
{
Pass: &troubleshootv1beta2.SingleOutcome{
When: "connected",
Message: "Connection was successful",
},
},
{
Warn: &troubleshootv1beta2.SingleOutcome{
Message: "Unexpected TCP connection status",
},
},
},
},
result: []*AnalyzeResult{
{
Title: "TCP Connection Attempt",
IsWarn: true,
Message: "Unexpected TCP connection status",
},
},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
Expand Down

0 comments on commit 557a138

Please sign in to comment.