Repository navigation
Conversation
Signed-off-by: Christian Kruse <christian@c-kruse.com>
Signed-off-by: Christian Kruse <christian@c-kruse.com>
Signed-off-by: Christian Kruse <christian@c-kruse.com>
📝 Walkthrough
Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments: 1
cmd/network-observer/internal/server/listener_test.go: 1
54-89: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAssert
StrategyandStrategyValuein the listener responses.The fixture sets
StrategyNameto"weighted"andStrategyValueto0, but the test checks onlyRoutingKeyCount. A regression inNewListenerProvidercan therefore remove or alter either API field without failing this test. Assert the weighted strategy and the non-nil zero value for the list and detail responses.Suggested fix
import ( "context" "log/slog" "testing" "time" + "github.com/skupperproject/skupper/cmd/network-observer/internal/api" "github.com/skupperproject/skupper/cmd/network-observer/internal/collector" "github.com/skupperproject/skupper/pkg/vanflow" "github.com/skupperproject/skupper/pkg/vanflow/store" @@ counts := map[string]int{} for _, result := range response.JSON200.Results { counts[result.Identity] = result.RoutingKeyCount + if result.Identity == "single" { + assert.Equal(t, result.Strategy, api.NotApplicable) + assert.Assert(t, result.StrategyValue == nil) + } else { + assert.Equal(t, result.Strategy, api.Weighted) + assert.Assert(t, result.StrategyValue != nil) + assert.Equal(t, *result.StrategyValue, uint64(0)) + } } assert.DeepEqual(t, counts, expected) for _, id := range []string{"first", "ended"} { detail, err := client.ListenerByIDWithResponse(context.Background(), id) assert.NilError(t, err) assert.Equal(t, detail.StatusCode(), 200) assert.Assert(t, detail.JSON200 != nil) assert.Equal(t, detail.JSON200.Results.RoutingKeyCount, expected[id]) + assert.Equal(t, detail.JSON200.Results.Strategy, api.Weighted) + assert.Assert(t, detail.JSON200.Results.StrategyValue != nil) + assert.Equal(t, *detail.JSON200.Results.StrategyValue, uint64(0)) }
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
d9960fb5-afb7-460b-a976-5ff0434bdca0
📒 Files selected for processing: 9
cmd/network-observer/internal/api/types_gen.gocmd/network-observer/internal/server/address_test.gocmd/network-observer/internal/server/listener_test.gocmd/network-observer/internal/server/views/views.gocmd/network-observer/spec/openapi.yamlpkg/vanflow/encoding/encoder.gopkg/vanflow/encoding/encoder_test.gopkg/vanflow/records.gopkg/vanflow/store/syncmap_test.go
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
| if listenerRecord, ok := listener.GetRecord(); ok && listenerRecord.StrategyName != nil { | ||
| multiKeyListenerCt++ |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Exclude ended listeners from MultiKeyListenerCount.
When a multi-key listener has ended, this loop still counts its record. RoutingKey.Listeners() returns the graph’s listener children without filtering by end time. A service with one active single-key listener and one ended multi-key listener therefore reports multiKeyListenerCount: 1 instead of 0. Apply the end-time check used by the listener routing-key count before incrementing. (raw.githubusercontent.com)
fgiorgetti
left a comment
There was a problem hiding this comment.
LGTM. API is returning multiAddress and regular listeners properly.
Closes #2609
Summary by CodeRabbit