In this point we show execution examples of the kinds of tests that our system has. In general, the "How does it works" section already shows the operation of each plugin, so here we will focus on how to produce a valid test. In short, since the configuration files are correctly written, the test will be executes successfully.
To exemplify the test operation we will consider the following directory structure:
hapi └── test ├── plugins/ ├── main.py └── fixtures ├── configs │ └── config-file.yaml ├── schemas │ └── policy-schema.json ├── valid-policy.yaml ├── invalid-policy.yaml └── not-yaml-policy.yaml
Now, with the config file
hapi/test/fixtures/configs/config-file.yaml it is
valid to say that all file references in
config-file.yaml is a relative path.
In other words: How the
config-file.yaml is in
then the paths specified by this file, must be considering the base
directory is the same as the config.
Thus, our parametrization file is:
schema: ../schemas/policy-schema.json policies: - ../valid-policy.yaml - ../invalid-policy.yaml - ../not-yaml-policy.yaml
To execute this plugin, type:
foo@bar:~/hapi/test$ python3 main.py -cyral_yaml fixtures/configs/config-file.yaml
To improve the processing of the test results, the output after the execution is given in YAML format. In this way the output has a good legibility for persons and machines.