Skip to content
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

docs: Update examples developer documentation #13200

Merged
merged 8 commits into from
Oct 6, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions examples/DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,59 @@ export UPARGS="--scale http_service=2"
If your example asks the user to run commands inside containers, you can
mimick this using `docker-compose exec -T`. The `-T` flag is necessary as the
tests do not have access to a `tty` in the CI pipeline.

## Add sandbox configs to configuration tests

Example configuration files are tested to ensure they are valid and well-formed, and do
not contain deprecated features.

### Exclude configs from example configuration tests

The CI script to find the configuration files will search for all files with a `yaml` or `lua`
dio marked this conversation as resolved.
Show resolved Hide resolved
extension. If your sandbox example contains non-envoy configuration files that should not be
checked you can exclude them by setting the `EXCLUDED_BUILD_CONFIGS` in `ci/verify_examples.sh`.

Given a sandbox with the name `example-sandbox`, and a configuration file that should be excluded
named `my-config.yaml`, add `^./example-sandbox/my-config.yaml` to `EXCLUDED_BUILD_CONFIGS`

For example, change:
```
EXCLUDED_BUILD_CONFIGS=${EXCLUDED_BUILD_CONFIGS:-"^./cache/responses.yaml|^./jaeger-native-tracing|docker-compose"}
```

to:
```
EXCLUDED_BUILD_CONFIGS=${EXCLUDED_BUILD_CONFIGS:-"^./example-sandbox/my-config.yaml|^./cache/responses.yaml|^./jaeger-native-tracing|docker-compose"}
```

This variable is used as a regular expression, so you can exclude multiple or more targeted exclusions using an
appropriate bash `regex`.

### List configs in `BUILD` file

Configuration files that have been added to your sandbox should be listed in ``examples/BUILD``, in
the ``filegroup.srcs`` section.

### Increment the expected number of configuration files in `example_configs_test.cc`

You will also need to increment the number of expected files in ``test/config_test/example_configs_test.cc``

Find the section shown in the following code block:

```c++
#if defined(__APPLE__) || defined(WIN32)
// freebind/freebind.yaml is not supported on macOS or Windows and is disabled via Bazel.
EXPECT_EQ(37UL, ConfigTest::run(directory));
phlax marked this conversation as resolved.
Show resolved Hide resolved
#else
EXPECT_EQ(38UL, ConfigTest::run(directory));
#endif
```

If, for example, your sandbox includes 2 new configuration files - you should change `37 -> 39`
and `38 -> 40` (current numbers may differ).

## Verifying your sandbox



## Verifying multiple/all sandboxes