-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[TT-748] TOML config for integration tests #11588
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I see that you haven't updated any CHANGELOG files. Would it make sense to do so? |
I see that you haven't updated any README files. Would it make sense to do so? |
skudasov
requested review from
a team,
chainchad,
javuto,
jkongie,
jmank88 and
samsondav
as code owners
January 23, 2024 22:36
skudasov
previously approved these changes
Jan 23, 2024
SonarQube Quality Gate 0 Bugs No Coverage information |
skudasov
approved these changes
Jan 24, 2024
This was referenced Feb 22, 2024
This was referenced Mar 21, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TOML is king!
Intro
Compared to CLIP by @kalverra there are some small changes in the implementation:
TEST_LOG_LEVEL
has been kept as env var for now (waiting for v2)TEST_TYPE
env vars was kept as some tests use to select configuration dynamicallyBy default all test configurations should live inside
testconfig
package in the folder specific for each application, but code is able to find them inside any folder inintegration-tests
subfolder. First file that's found will be used. To see which configuration files were used run tests withdebug
log level.testconfig
package provides a single point of entry for reading config for all products and a common part (which apart from logging and network settings provides also initial CL nodes funding). If a product config is not nil it will be validated. I based validations on common sense and values encountered in the code, but it's best if code owners have an extra look.TestConfig
struct also has aSave()
method in case you want to persist the final config used by tests once all overrides were applied.Configuration and Overrides
Overrides in precedence order:
BASE64_CONFIG_OVERRIDE
env varoverrides.toml
[product_name].toml
default.toml
BASE64_CONFIG_OVERRIDE
is designed to be used in CI (together with::add-mask::
) to override default values with secrets or user/trigger inputs. Example:For tests running in k8s it will be automatically forwarded there, so there's no need to add any manual handling in individual tests.
overrides.toml
should be used on local to provide dynamic/run-time variables or to override defaults stored in other files.[product_name].toml
is where most configurations (default and named) should be kept. It supports product-default config like this in case oflog_poller.toml
:And named configurations (which are processed as overrides) based on unique
configurationName
which can be any string, for example test name:or test type (in
vrfv2.toml
):When each TOML is read the code first looks for the default/unnamed configuration and then for named configuration, which for each file can override default configuration.
Finally
default.toml
was thought as one that should have the most basic and common settings, like logging configuration.I also removed all old configs and code that read it, so that there's just one single point of entry for everything.
Local/k8s usage
I have modified all GH workflows present in this repo, so that a base64-ed TOML config is built dynamically from user input or env vars and then sent to
GITHUB_ENV
for tests to pick up. When you want to run tests in k8s using remote runner or on your local you will need to provide some of these values yourself as they cannot be hardcoded in configuration files.These required variables might include elements like:
"Load", "Soak", "Stress", "Spike", "Volume"
)For local execution it's best to put these variables in
overrides.toml
file.For k8s/remote runner you need to:
cat your.toml | base64
BASE64_CONFIG_OVERRIDE
environment variable.Known issues/limitations
overrides.toml
for [VRFv2] config, that overrides 1 key, then we will validate whole VRFv2 config, since it's notnil
and thus should be valid (and in this case validation will of course fail)nil pointer exception
, when trying to access a config property further downstream, so it's up to the user to either make sure that the config they need is always set or to validate it's presence before accessing any of the properties[]Load
config is not implemented (currently it's an append)MustCopy()
function oftestconfig.TestConfig
that performs a deep copy and returns a new copy that can be freely modified without impacting the original. It is especially advised to use copy of config in nested tests to avoid unintended modifications of original that might be time-consuming to detect.GHA workflows
I've adjusted all of them, but one:
integration-staging-tests.yml
as it was disabled anyway. All the others butautomation-ondemand-tests.yml
now accept only 1 input parameter -base64Config
- which is what the name suggests. To get that value all you need to do is to execute thiscat your.toml | base64
or you could trigger the test from CLI the way @skudasov proposed here.So when tests expect a base64-ed config it should contain all information that's not present in GHA as secrets (which in case of all these on-demand workflows means Loki specifics). For workflows that use Loki and user inputs I am merging user-provided base64 config with Loki config created on flight, then base64-ed and saved in the env var.
Requirements
It requires this CTF version.