-
Notifications
You must be signed in to change notification settings - Fork 764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix TCF1 Fetcher Fallback #1438
Conversation
@@ -158,7 +158,7 @@ func newVendorListCache(fallbackVL api.VendorList) (save func(id uint16, list ap | |||
if ok { | |||
return list.(vendorlist.VendorList) | |||
} | |||
return fallbackVL | |||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method needs to return nil
in order to attempt a url lazy loading fetch. If we return fallbackVL
here, it effectively disables lazy loading.
gdpr/vendorlist-fetching_test.go
Outdated
@@ -196,15 +196,15 @@ func TestDefaultVendorListPassthrough(t *testing.T) { | |||
fetcher := newVendorListFetcher(context.Background(), testcfg, server.Client(), testURLMaker(server), 1) | |||
list, err := fetcher(context.Background(), 2) | |||
assert.NoError(t, err, "Error with fetching existing vendorlist: %v", err) | |||
assert.Equal(t, uint16(2), list.Version(), "Expected to fetch mock list version 2, got version %d", list.Version()) | |||
assert.Equal(t, uint16(2), list.Version(), "Expected to fetch mock list version 1, got version %d", list.Version()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the expected value be uint16(1)
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No,. It should be version 2. I forgot to revert my change to the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@@ -184,7 +184,7 @@ func TestDefaultVendorListPassthrough(t *testing.T) { | |||
purposes: []int{2}, | |||
}, | |||
}) | |||
server := httptest.NewServer(http.HandlerFunc(mockServer(2, map[int]string{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both lists were originally preloaded and always pulled from cache. If we change the latest version from 2 to 1, it no longer preloads version 2 and attempts a lazy load. This exposed the bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes a bug in 0.124.0 where the TCF1 vendor list fetcher will never attempt lazy loading.