From de1bfde2d82938350c61761ea96252ab6f992f3a Mon Sep 17 00:00:00 2001 From: Ricardo Carrillo Cruz Date: Tue, 21 Nov 2017 13:24:48 +0100 Subject: [PATCH] Add very basic openvswitch_bridge integration test (#33134) More to come on this module. --- .../targets/openvswitch_bridge/aliases | 1 + .../openvswitch_bridge/defaults/main.yaml | 3 +++ .../targets/openvswitch_bridge/meta/main.yaml | 2 ++ .../targets/openvswitch_bridge/tasks/main.yml | 17 +++++++++++++ .../openvswitch_bridge/tests/basic.yaml | 25 +++++++++++++++++++ 5 files changed, 48 insertions(+) create mode 100644 test/integration/targets/openvswitch_bridge/aliases create mode 100644 test/integration/targets/openvswitch_bridge/defaults/main.yaml create mode 100644 test/integration/targets/openvswitch_bridge/meta/main.yaml create mode 100644 test/integration/targets/openvswitch_bridge/tasks/main.yml create mode 100644 test/integration/targets/openvswitch_bridge/tests/basic.yaml diff --git a/test/integration/targets/openvswitch_bridge/aliases b/test/integration/targets/openvswitch_bridge/aliases new file mode 100644 index 00000000000..a51f9c505f2 --- /dev/null +++ b/test/integration/targets/openvswitch_bridge/aliases @@ -0,0 +1 @@ +non_local diff --git a/test/integration/targets/openvswitch_bridge/defaults/main.yaml b/test/integration/targets/openvswitch_bridge/defaults/main.yaml new file mode 100644 index 00000000000..9ef5ba51651 --- /dev/null +++ b/test/integration/targets/openvswitch_bridge/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "*" +test_items: [] diff --git a/test/integration/targets/openvswitch_bridge/meta/main.yaml b/test/integration/targets/openvswitch_bridge/meta/main.yaml new file mode 100644 index 00000000000..20d55f506f8 --- /dev/null +++ b/test/integration/targets/openvswitch_bridge/meta/main.yaml @@ -0,0 +1,2 @@ +dependencies: + - prepare_ovs_tests diff --git a/test/integration/targets/openvswitch_bridge/tasks/main.yml b/test/integration/targets/openvswitch_bridge/tasks/main.yml new file mode 100644 index 00000000000..8e4e36a51a1 --- /dev/null +++ b/test/integration/targets/openvswitch_bridge/tasks/main.yml @@ -0,0 +1,17 @@ +--- + +- name: collect all test cases + find: + paths: "{{ role_path }}/tests" + patterns: "{{ testcase }}.yaml" + delegate_to: localhost + register: test_cases + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case + include: "{{ test_case_to_run }}" + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/openvswitch_bridge/tests/basic.yaml b/test/integration/targets/openvswitch_bridge/tests/basic.yaml new file mode 100644 index 00000000000..b8e859b34ed --- /dev/null +++ b/test/integration/targets/openvswitch_bridge/tests/basic.yaml @@ -0,0 +1,25 @@ +--- + +- name: Make sure test bridge does not exist before tests + command: ovs-vsctl del-br br-test + +- name: Create bridge + openvswitch_bridge: + bridge: br-test + register: result + +- assert: + that: + - "result.changed == true" + +- name: Create bridge again (idempotent) + openvswitch_bridge: + bridge: br-test + register: result + +- assert: + that: + - "result.changed == false" + +- name: Tear down test bridge + command: ovs-vsctl del-br br-test