Skip to content

Added spec for ansible code minimal unit test framework#164

Open
hkumarmk wants to merge 1 commit intoJuniper:masterfrom
hkumarmk:spec_ut
Open

Added spec for ansible code minimal unit test framework#164
hkumarmk wants to merge 1 commit intoJuniper:masterfrom
hkumarmk:spec_ut

Conversation

@hkumarmk
Copy link
Contributor

No description provided.

opencontrail-ci-admin pushed a commit to Juniper/contrail-ansible-internal that referenced this pull request Apr 18, 2017
Partial-bug: 1682529
This is the initial patch to implement the spec documented in
Juniper/contrail-docker#164.

Here are the changes:
* Updated internal ansible code with
  * Added test tag to the tasks which update the service configurations
  * Addded conditionals for handlers not to run when the variable
    ansible_test_mode is defined to avoid running the handlers during test
* Added one sample test scenario directory - test scenario directories will have
  below files
  * contrailctl configuration files with configurations required for that scenario
  * env.yaml which containes inputs/configurations for the test scenario itself,
    which will be used by test.py
  * values.yaml - yaml file which defines what internal service configurations are
    expected out of the contrailctl configurations provided
* Added test.py which does below things:
  * iterate through test scenario directories found under tests/ directory
    found under same directory as test.py. For each scenario, test.py execute
    below
    * Read env.yaml file to get the inputs/configurations for the test scenarios
    * prepare the system to run ansible
      * Create certain directory structure where contrailctl/internal ansible write
      config files
      * Create files if required where contrailctl/internal ansible write config entries
      * Create a netns with appropriate network
    * Run contrailctl with contrailctl configuration files found under each scenario directory
      with playbooks directory found in the same directory as test.py
    * Read values.yaml to get expected service configurations and compare those values with
      actual configuration entries created by contrailctl run.
    * Print the test status and a failed configuration report if found any
* Print failures report after testing each scenario
  * Use tabulate module if found, if not print using str.format()

Change-Id: I3d66c88d8b7172b20a3cc0ab8bc0c85fea2be88c
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.

1 participant