From a4916e848db297a9fff061066803fb58fc712c22 Mon Sep 17 00:00:00 2001 From: Jocelyn Jaubert Date: Thu, 16 Aug 2018 17:37:42 +0200 Subject: [PATCH] interfaces_file: Add test for multiple address_family for same iface --- .../address_family.test_no_changes | 10 ++++++++++ .../address_family.test_no_changes.json | 19 +++++++++++++++++++ .../golden_output/address_family_add_aggi_up | 10 ++++++++++ .../address_family_add_aggi_up.exceptions.txt | 8 ++++++++ .../address_family_add_aggi_up.json | 19 +++++++++++++++++++ .../address_family_add_and_delete_aggi_up | 10 ++++++++++ ...mily_add_and_delete_aggi_up.exceptions.txt | 17 +++++++++++++++++ ...address_family_add_and_delete_aggi_up.json | 19 +++++++++++++++++++ .../address_family_change_method | 10 ++++++++++ ...ddress_family_change_method.exceptions.txt | 0 .../address_family_change_method.json | 19 +++++++++++++++++++ .../golden_output/address_family_revert | 10 ++++++++++ .../address_family_revert.exceptions.txt | 0 .../golden_output/address_family_revert.json | 19 +++++++++++++++++++ .../address_family_set_aggi_and_eth0_mtu | 11 +++++++++++ ...amily_set_aggi_and_eth0_mtu.exceptions.txt | 8 ++++++++ .../address_family_set_aggi_and_eth0_mtu.json | 19 +++++++++++++++++++ .../address_family_set_aggi_slaves | 10 ++++++++++ ...ress_family_set_aggi_slaves.exceptions.txt | 8 ++++++++ .../address_family_set_aggi_slaves.json | 19 +++++++++++++++++++ .../fixtures/input/address_family | 10 ++++++++++ 21 files changed, 255 insertions(+) create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/input/address_family diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes new file mode 100644 index 00000000000..26f9d012d0f --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes @@ -0,0 +1,10 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet static + address 192.168.0.1 + +iface eth0 inet6 static + address fc00::1 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes.json new file mode 100644 index 00000000000..bd635949083 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes.json @@ -0,0 +1,19 @@ +{ + "eth0": { + "address": "fc00::1", + "address_family": "inet6", + "down": [], + "method": "static", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up new file mode 100644 index 00000000000..26f9d012d0f --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up @@ -0,0 +1,10 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet static + address 192.168.0.1 + +iface eth0 inet6 static + address fc00::1 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.exceptions.txt new file mode 100644 index 00000000000..8d223b041b6 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.exceptions.txt @@ -0,0 +1,8 @@ +[0] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "up", + "state": "present", + "value": "route add -net 224.0.0.0 netmask 240.0.0.0 dev aggi" +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.json new file mode 100644 index 00000000000..bd635949083 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.json @@ -0,0 +1,19 @@ +{ + "eth0": { + "address": "fc00::1", + "address_family": "inet6", + "down": [], + "method": "static", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up new file mode 100644 index 00000000000..26f9d012d0f --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up @@ -0,0 +1,10 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet static + address 192.168.0.1 + +iface eth0 inet6 static + address fc00::1 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.exceptions.txt new file mode 100644 index 00000000000..1c9adbd9fcf --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.exceptions.txt @@ -0,0 +1,17 @@ +[0] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "up", + "state": "present", + "value": "route add -net 224.0.0.0 netmask 240.0.0.0 dev aggi" +} +===== +[1] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "up", + "state": "absent", + "value": null +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.json new file mode 100644 index 00000000000..bd635949083 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.json @@ -0,0 +1,19 @@ +{ + "eth0": { + "address": "fc00::1", + "address_family": "inet6", + "down": [], + "method": "static", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method new file mode 100644 index 00000000000..3e30d6b5a2a --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method @@ -0,0 +1,10 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet manual + address 192.168.0.1 + +iface eth0 inet6 manual + address fc00::1 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method.exceptions.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method.json new file mode 100644 index 00000000000..2f8251eb0af --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method.json @@ -0,0 +1,19 @@ +{ + "eth0": { + "address": "fc00::1", + "address_family": "inet6", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert new file mode 100644 index 00000000000..26f9d012d0f --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert @@ -0,0 +1,10 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet static + address 192.168.0.1 + +iface eth0 inet6 static + address fc00::1 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert.exceptions.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert.json new file mode 100644 index 00000000000..bd635949083 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert.json @@ -0,0 +1,19 @@ +{ + "eth0": { + "address": "fc00::1", + "address_family": "inet6", + "down": [], + "method": "static", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu new file mode 100644 index 00000000000..f8ec44e7a14 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu @@ -0,0 +1,11 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet static + address 192.168.0.1 + +iface eth0 inet6 static + address fc00::1 + mtu 1350 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.exceptions.txt new file mode 100644 index 00000000000..3f0da8b1c71 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.exceptions.txt @@ -0,0 +1,8 @@ +[0] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "mtu", + "state": "present", + "value": "1350" +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.json new file mode 100644 index 00000000000..bd635949083 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.json @@ -0,0 +1,19 @@ +{ + "eth0": { + "address": "fc00::1", + "address_family": "inet6", + "down": [], + "method": "static", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves new file mode 100644 index 00000000000..26f9d012d0f --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves @@ -0,0 +1,10 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet static + address 192.168.0.1 + +iface eth0 inet6 static + address fc00::1 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.exceptions.txt new file mode 100644 index 00000000000..0af87750b71 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.exceptions.txt @@ -0,0 +1,8 @@ +[0] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "slaves", + "state": "present", + "value": "int1 int3" +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.json new file mode 100644 index 00000000000..bd635949083 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.json @@ -0,0 +1,19 @@ +{ + "eth0": { + "address": "fc00::1", + "address_family": "inet6", + "down": [], + "method": "static", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/input/address_family b/test/units/modules/system/interfaces_file/fixtures/input/address_family new file mode 100644 index 00000000000..26f9d012d0f --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/input/address_family @@ -0,0 +1,10 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet static + address 192.168.0.1 + +iface eth0 inet6 static + address fc00::1