Conversation
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
a global request generator. Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Adding comments. Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
…TestForRequestSourceFactory Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
request source. Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
| } | ||
|
|
||
| // Increment the counter and get the request_option from the list for the current iteration. | ||
| auto index = lambda_counter % options_list_->options_size(); |
| // Increment the counter and get the request_option from the list for the current iteration. | ||
| auto index = lambda_counter % options_list_->options_size(); | ||
| nighthawk::client::RequestOptions request_option = options_list_->options().at(index); | ||
| lambda_counter++; |
| if (content_length > 0) { | ||
| header->setContentLength(content_length); | ||
| } | ||
| for (const auto& option_header : request_option.request_headers()) { |
| request_max_(request_max) {} | ||
|
|
||
| RequestGenerator RequestOptionsListRequestSource::get() { | ||
| uint32_t counter = 0; |
There was a problem hiding this comment.
Yes, we can do that.
| util.loadFromFile(config.file_path(), options_list_, | ||
| Envoy::ProtobufMessage::getStrictValidationVisitor(), *api, true); | ||
| } | ||
| temp_list->CopyFrom(options_list_); |
There was a problem hiding this comment.
I had thought it made more sense for the requestSource to have ownership of the list, but I think that the factory does have a longer lifetime than the requestSources it generates, so that probably would work.
| const uint32_t request_max_; | ||
| }; | ||
|
|
||
| // Factory that creates a RequestOptionsListRequestSource from a FileBasedPluginConfig proto. |
There was a problem hiding this comment.
Not a typo. I wanted this to be a more generic version of the RequestOptionsListRequestSource since it seemed the more versatile option.
| // produced by get() will use options from the options_list to overwrite values in the header, and | ||
| // create new requests. if request_max is greater than the length of options_list, it will loop. | ||
| // This is not thread safe. | ||
| class RequestOptionsListRequestSource : public RequestSource { |
There was a problem hiding this comment.
I felt like it made sense for both the RequestSource and the factory that makes the requestSource to live in the same file together, I can move it into its own library if you prefer.
| // load the file from memory and subsequent calls just make a copy of the options_list that was | ||
| // already loaded. The FileBasedRequestSourcePluginConfigFactory will not work with multiple | ||
| // different files for this reason. | ||
| RequestSourcePtr createRequestSourcePlugin(const Envoy::Protobuf::Message& message, |
| #include "api/client/service.pb.h" | ||
| #include "api/client/service_mock.grpc.pb.h" | ||
|
|
||
| #include "gtest/gtest.h" |
There was a problem hiding this comment.
Hopefully I've reverted the change that introduced these.
|
|
||
| // Factory that creates a RequestOptionsListRequestSource from a FileBasedPluginConfig proto. | ||
| // Registered as an Envoy plugin. | ||
| // Implementation of RequestSourceConfigFactory which produces a RequestSource that keeps an |
There was a problem hiding this comment.
I'm not sure I'm doing a very good job at this, but I'll do my best.
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
mum4k
left a comment
There was a problem hiding this comment.
Looks good, thank you for iterating on this. This is now a complete review and we only have few minor comments left to address.
| @@ -0,0 +1,55 @@ | |||
| // Implementations of RequestSourceConfigFactory and the RequestSources that those factories make. | |||
There was a problem hiding this comment.
We probably want to say something else here, i.e. we should talk about the stub plugin which is implemented in this file.
| // mechanism using a minimal version of plugin that does not require a more complicated proto or | ||
| // file reading. | ||
| message StubPluginConfig { | ||
| // test input value. |
There was a problem hiding this comment.
We had a comment thread about improving this comment, but looks like the it wasn't actually done. Repeating the comment:
Can we improve this comment? We could say what the input argument is for / what does the plugin do with it. It raises a question as to why a plugin that does nothing need an input argument.
There was a problem hiding this comment.
Oh I thought I fixed it by making it do something.
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
Signed-off-by: William Juan <66322422+wjuan-AFK@users.noreply.github.com>
|
/retest |
|
🔨 rebuilding |
Adding config factories for RequestSourcePlugins. Specifically starting with FileBasedRequestSourcePlugin. These will be provided as options to be used inside RequestSourceFactory. This is part of a series of PRs for providing the ability to use statically linked requestSources.