xlab-si / xopera-opera

xOpera orchestrator compliant with TOSCA YAML v1.3 in the making
https://xlab-si.github.io/xopera-docs/
Apache License 2.0
35 stars 14 forks source link

Add unit tests for argparse and CLI commands #149

Closed anzoman closed 3 years ago

anzoman commented 3 years ago

Description

Opera already has a lot of unit tests and some integration tests. We use argparse for our CLI implementation but there are currently no unit tests for that. So, I want to propose adding unit tests for argparse in order to test all opera CLI commands and their options.

Also we have an integration test in tests/integration/cli_commands that aims to test all opera CLI commands along with their options. As we're adding new commands and flags this test is becoming bigger and difficult to read so I propose refactoring it. We can keep the test itself as it is but it would be better to remove testing of all opera command options as this is also consuming a lot of time within CI workflows. And as we will add a new unit test for testing CLI commands and options we don't need to do that again here, so we can keep for instance just one round of opera commands execution without repeating them again and again.

Steps

We can add a new unit test folder (called commands or argparse) to tests/unit and implement new unit tests there.

The other thing is to refactor tests/integration/cli_commands to call each CLI command only once (or twice - once for service template and once for CSAR) and show how opera CLI commands can be used in order.

Current behaviour

Right now opera doesn't have unit tests for argparse and our CLI commands.

Expected results

To add unit tests for our CLI commands and refactor the aforementioned integration test.

anzoman commented 3 years ago

This will be implemented in #208 with the initial structure for argparse unit tests, which will be improved in the future.