-
Notifications
You must be signed in to change notification settings - Fork 738
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
Local stored response fetching #3600
Conversation
cc @bretg for visibility |
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.
Looks good to me, it works locally, I can execute requests with stored responses successfully. Test looks good too.
func (fetcher *eagerFetcher) FetchResponses(ctx context.Context, ids []string) (data map[string]json.RawMessage, errs []error) { | ||
return nil, nil | ||
storedResponses := fetcher.FileSystem.Directories["stored_responses"].Files |
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.
Per Gus suggestion, please use "data", not "storedResponses" #3326 (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.
@VeronikaSolovei9 @guscarreon
have updated the code implementation
cc @SyntaxNode for visibility & code review ( sorry i forgot to mention you) |
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.
Minor comments left
@@ -35,8 +36,15 @@ func (fetcher *eagerFetcher) FetchRequests(ctx context.Context, requestIDs []str | |||
return storedRequests, storedImpressions, errs | |||
} | |||
|
|||
// Fetch Responses - Implements the interface to read the stored response information from the fetcher's FileSystem, the directory name is "stored_responses" | |||
func (fetcher *eagerFetcher) FetchResponses(ctx context.Context, ids []string) (data map[string]json.RawMessage, errs []error) { |
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.
Nitpick: what do you think about renaming fetcher
here to just be f
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.
@AlexBVolcy i think that would be a different discussion, all the other fetchers, e.g http_fetcher
, empty_fetcher and
db_fetcherare all using the same
fetcher` as the receiver name
@@ -25,6 +27,55 @@ func TestFileFetcher(t *testing.T) { | |||
validateImp(t, storedImps) | |||
} | |||
|
|||
func TestStoredResponseFileFetcher(t *testing.T) { | |||
|
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.
Nitpick: Can you delete this space
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.
deleted
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.
Should FetchResponses
throw an error when the parameter ids
is empty? If so, can we add the check and its corresponding test case in TestStoredResponseFileFetcher
?
@guscarreon
|
thanks @VeronikaSolovei9 for approval |
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
Problem
this PR is to unblock the hello world example framework i try to build