Skip to content

config: test binary to load configuration files against#969

Merged
junr03 merged 12 commits intomasterfrom
config-load-test-tool
May 24, 2017
Merged

config: test binary to load configuration files against#969
junr03 merged 12 commits intomasterfrom
config-load-test-tool

Conversation

@junr03
Copy link
Copy Markdown
Member

@junr03 junr03 commented May 15, 2017

This PR adds a small binary that wraps around existing config_tests. The binary enables developers to validate their configuration files for well formed JSON and JSON that conforms to Envoy's JSON schema.

This tool is different from #863. #863, runs a deeper configuration validation as it goes through the motion of setting up Envoy's event loop up to the point where Envoy would be ready to listen for traffic. This tool only validates configuration files as far as their JSON structure and conformation to Envoy's JSON schema.

Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems useful, can you comment on the relationship with #863?


int main(int argc, char* argv[]) {
if (argc != 2) {
return EXIT_FAILURE;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a usage string on std:cerr?

return EXIT_FAILURE;
}
try {
uint32_t num_tested = ConfigTest::run(std::string(argv[1]));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: const


#include "test/config_test/config_test.h"

#include "spdlog/spdlog.h"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated to this review, but I've noticed this anti-pattern across the Envoy code base, where we're forcing a dependency on spdlog just to get at fmt::format. It would be nice if we could clean this up one day by wrapping this in a shim and not require spdlog dependency just for basic string formatting. I think spdlog is just using https://github.com/fmtlib/fmt in any case, which it bundles. I've created #975 to track, feel free to keep using spdlog in this review as it's a wider issue.

uint32_t num_tested = ConfigTest::run(std::string(argv[1]));
std::cout << fmt::format("Successfully tested: {}", num_tested) << std::endl;
return EXIT_SUCCESS;
} catch (const std::runtime_error& e) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you comment on which exception you plan on catching here?

@htuch
Copy link
Copy Markdown
Member

htuch commented May 22, 2017

@junr03 CI indicates this fails to build, can you take a look? Thanks.

@RomanDzhabarov RomanDzhabarov self-assigned this May 22, 2017

Input
The tool expects a PATH to the root of a directory that holds json envoy configuration files. The tool
will recursively go through the filesystem tree and run a configuration test for each configuration file found.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you expand on how it identifies a configuration file?

}
try {
const uint32_t num_tested = Envoy::ConfigTest::run(std::string(argv[1]));
std::cout << fmt::format("Successfully tested: {}", num_tested) << std::endl;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can get rid of that "spdlog/spdlog.h"
this can be changed to
std::cout << "Successfully tested: " << num_tested << " configs" << std::endl;


int main(int argc, char* argv[]) {
if (argc != 2) {
std::cerr << "Usage: config_load_check PATH" << std::endl;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

up to you to remove bunch of std::cerr and replace by single std::cerr

@RomanDzhabarov
Copy link
Copy Markdown
Member

LGTM with small nits.

Jose Nino added 2 commits May 24, 2017 11:16
the tool will try to load all files found in the path.

Output
The tool will output envoy logs as it initializes the server configuration with the config it is currently testing.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: s/envoy/Envoy/, s/json/JSON/ in this file.

@junr03 junr03 merged commit d568919 into master May 24, 2017
@junr03 junr03 deleted the config-load-test-tool branch May 24, 2017 22:29
rshriram pushed a commit to rshriram/envoy that referenced this pull request Oct 30, 2018
Automatic merge from submit-queue.

[DO NOT MERGE] Auto PR to update dependencies of proxy

This PR will be merged automatically once checks are successful.
```release-note
none
```
jpsim pushed a commit that referenced this pull request Nov 28, 2022
Cleaning up the sonatype upload script to enable easier local deployment. The change here is just to remove some required fields in the local publish case.

Signed-off-by: Alan Chiu <achiu@lyft.com>

For an explanation of how to fill out the fields, please see the relevant section
in [PULL_REQUESTS.md](https://github.com/envoyproxy/envoy/blob/master/PULL_REQUESTS.md)

Description: android: clean up sonatype upload to support local deploy
Risk Level: low
Testing: local
Docs Changes: n/a
Release Notes: n/a
[Optional Fixes #Issue]
[Optional Deprecated:]

Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit that referenced this pull request Nov 29, 2022
Cleaning up the sonatype upload script to enable easier local deployment. The change here is just to remove some required fields in the local publish case.

Signed-off-by: Alan Chiu <achiu@lyft.com>

For an explanation of how to fill out the fields, please see the relevant section
in [PULL_REQUESTS.md](https://github.com/envoyproxy/envoy/blob/master/PULL_REQUESTS.md)

Description: android: clean up sonatype upload to support local deploy
Risk Level: low
Testing: local
Docs Changes: n/a
Release Notes: n/a
[Optional Fixes #Issue]
[Optional Deprecated:]

Signed-off-by: JP Simard <jp@jpsim.com>
nezdolik pushed a commit to nezdolik/envoy that referenced this pull request May 4, 2024
This may fix issue envoyproxy#969.

When testing OOM handling we set up sys allocator that fails memory
allocation. But debugallocator itself allocates some internal metadata
memory via malloc and crashes if those allocations fail. So
occasionally this test failed when debugallocator's internal malloc
ended up causing sys allocator.

So instead of failing tests from time to time, we drop it for debug
allocator. It's OOM handling is already crashy anyways.
mathetake pushed a commit that referenced this pull request Mar 3, 2026
**Description**

- Added fake response for embedding requests.
- Kept the response in line with documentation
https://aigateway.envoyproxy.io/docs/getting-started/basic-usage#embeddings-response

**Related Issues/PRs (if applicable)**

Fixes envoyproxy/ai-gateway#967

Signed-off-by: nagar-ajay <ajay.nagar@nutanix.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants