Closed naftulikay closed 5 years ago
Okay so finding the latest release can be done with the following in cross-version Python:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import six
if six.PY3:
from urllib.request import Request, urlopen
else:
from urllib2 import Request, urlopen
r = Request("https://github.com/aelsabbahy/goss/releases/latest")
response = urlopen(r)
print(response.getcode())
print(response.geturl())
Okay so I'm doing some experiments with securely passing variables and parsing JSON output from Goss, as this is the next step.
I've defined a sample file called vars.yml
:
---
var_1: true
I've also defined a Goss file called goss.yml
:
---
file:
'/dev':
exists: {{.Vars.var_1}}
The command-line that I'm invoking is:
cat vars.yml | ./goss \
--gossfile ./goss.yml \
--vars /dev/stdin \
validate \
--no-color \
--format json
This /dev/stdin
switcheroo works great.
The output I receive on success is:
{
"results": [
{
"duration": 12408,
"err": null,
"expected": [
"true"
],
"found": [
"true"
],
"human": "",
"meta": null,
"property": "exists",
"resource-id": "/dev",
"resource-type": "File",
"result": 0,
"successful": true,
"summary-line": "File: /dev: exists: matches expectation: [true]",
"test-type": 0,
"title": ""
}
],
"summary": {
"failed-count": 0,
"summary-line": "Count: 1, Failed: 0, Duration: 0.000s",
"test-count": 1,
"total-duration": 240902
}
}
By changing var_1
to false
, we can get a failing test case, which looks like this:
{
"results": [
{
"duration": 71056,
"err": null,
"expected": [
"false"
],
"found": [
"true"
],
"human": "Expected\n <bool>: true\nto equal\n <bool>: false",
"meta": null,
"property": "exists",
"resource-id": "/dev",
"resource-type": "File",
"result": 1,
"successful": false,
"summary-line": "File: /dev: exists:\nExpected\n <bool>: true\nto equal\n <bool>: false",
"test-type": 0,
"title": ""
}
],
"summary": {
"failed-count": 1,
"summary-line": "Count: 1, Failed: 1, Duration: 0.000s",
"test-count": 1,
"total-duration": 337757
}
}
When Goss fails outright and is unable to run the test cases, the following output and return codes are observed
$ cat vars.yml | goss --gossfile ./yangus.yml --vars /dev/stdin validate --no-color --format json
parse error: Invalid numeric literal at line 1, column 5
$ echo $?
4
This is bad:
$ cat vars.yml | goss --gossfile /dev/null --vars /dev/stdin validate --no-color --format json
2018/12/05 21:17:18 Unknown file extension:
$ echo $?
0
I guess the return code can't be used as a reliable way of determining whether Goss was able to run or not. If we can't parse JSON out of the output, assume failure.
This is also bad:
$ ./goss --gossfile ./goss.yml --vars /dev/null validate --no-color --format json
2018/12/05 21:19:09 template: test:4:19: executing "test" at <.Vars.var_1>: map has no entry for key "var_1"
$ echo $?
0
The same thing happens when a variable is undefined in the Goss file or when Goss can't render a file.
Marching orders for handling errors:
0
but the JSON reveals the error details.4
and text output.0
and text output.0
and emits text output.Therefore:
This walks and talks like a duck, it's a bug, see aelsabbahy/goss#317
-vvv
output from three sample runs, no special output formatter yet. Module configuration:
- name: pass
hosts: all
become: true
any_errors_fatal: true
roles:
- role: default
degoss_clean: false
degoss_debug: false
degoss_log_file: /tmp/degoss.log
degoss_verbose: false
goss_file: goss.yml
goss_addtl_dirs: [goss]
{
"changed": false,
"invocation": {
"module_args": {
"bin_dir": "/tmp/degoss.CIXffaVc7N/bin",
"clean": "False",
"debug": "False",
"facts": "{\"kernel\": \"3.10.0-693.21.1.el7.x86_64\", \"domain\": \"\", \"distribution_major_version\": \"7\", \"lsb\": {}, \"swaptotal_mb\": 2047, \"distribution_version\": \"7.4.1708\", \"selinux\": {\"status\": \"Missing selinux Python library\"}, \"product_version\": \"1.2\", \"system_vendor\": \"innotek GmbH\", \"module_setup\": true, \"processor_count\": 1, \"cmdline\": {\"LANG\": \"en_US.UTF-8\", \"BOOT_IMAGE\": \"/vmlinuz-3.10.0-693.21.1.el7.x86_64\", \"quiet\": true, \"rhgb\": true, \"rd.lvm.lv\": \"centos/swap\", \"crashkernel\": \"auto\", \"ro\": true, \"root\": \"/dev/mapper/centos-root\"}, \"product_uuid\": \"03E7AEFC-92ED-4614-8CD6-76C6AA2F8D59\", \"gather_subset\": [\"all\"], \"system_capabilities_enforced\": \"True\", \"effective_group_id\": 0, \"form_factor\": \"Other\", \"ansible_local\": {}, \"processor_vcpus\": 12, \"env\": {\"container\": \"docker\", \"SHLVL\": \"2\", \"HOSTNAME\": \"826c6eebe35f\", \"PWD\": \"/etc/ansible/roles/default/tests\", \"PATH\": \"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\", \"HOME\": \"/root\", \"ANSIBLE_FORCE_COLOR\": \"yes\", \"_\": \"/usr/bin/python\"}, \"python_version\": \"2.7.5\", \"user_dir\": \"/root\", \"effective_user_id\": 0, \"lo\": {\"mtu\": 65536, \"device\": \"lo\", \"promisc\": false, \"ipv4\": {\"broadcast\": \"host\", \"netmask\": \"255.0.0.0\", \"network\": \"127.0.0.0\", \"address\": \"127.0.0.1\"}, \"active\": true, \"type\": \"loopback\"}, \"hostname\": \"826c6eebe35f\", \"user_gid\": 0, \"system\": \"Linux\", \"pkg_mgr\": \"yum\", \"machine\": \"x86_64\", \"default_ipv4\": {\"macaddress\": \"02:42:ac:12:00:03\", \"network\": \"172.18.0.0\", \"mtu\": 1500, \"broadcast\": \"172.18.255.255\", \"alias\": \"eth0\", \"netmask\": \"255.255.0.0\", \"address\": \"172.18.0.3\", \"interface\": \"eth0\", \"type\": \"ether\", \"gateway\": \"172.18.0.1\"}, \"processor_threads_per_core\": 1, \"distribution_file_variety\": \"RedHat\", \"apparmor\": {\"status\": \"disabled\"}, \"distribution_file_parsed\": true, \"bios_version\": \"VirtualBox\", \"selinux_python_present\": false, \"eth0\": {\"macaddress\": \"02:42:ac:12:00:03\", \"type\": \"ether\", \"mtu\": 1500, \"device\": \"eth0\", \"promisc\": false, \"ipv4\": {\"broadcast\": \"172.18.255.255\", \"netmask\": \"255.255.0.0\", \"network\": \"172.18.0.0\", \"address\": \"172.18.0.3\"}, \"active\": true, \"speed\": 10000}, \"uptime_seconds\": 11512, \"virtualization_type\": \"docker\", \"system_capabilities\": [\"cap_chown\", \"cap_dac_override\", \"cap_dac_read_search\", \"cap_fowner\", \"cap_fsetid\", \"cap_kill\", \"cap_setgid\", \"cap_setuid\", \"cap_setpcap\", \"cap_linux_immutable\", \"cap_net_bind_service\", \"cap_net_broadcast\", \"cap_net_admin\", \"cap_net_raw\", \"cap_ipc_lock\", \"cap_ipc_owner\", \"cap_sys_module\", \"cap_sys_rawio\", \"cap_sys_chroot\", \"cap_sys_ptrace\", \"cap_sys_pacct\", \"cap_sys_admin\", \"cap_sys_boot\", \"cap_sys_nice\", \"cap_sys_resource\", \"cap_sys_time\", \"cap_sys_tty_config\", \"cap_mknod\", \"cap_lease\", \"cap_audit_write\", \"cap_audit_control\", \"cap_setfcap\", \"cap_mac_override\", \"cap_mac_admin\", \"cap_syslog\", \"35\", \"36+eip\"], \"distribution_release\": \"Core\", \"userspace_bits\": \"64\", \"user_uid\": 0, \"nodename\": \"826c6eebe35f\", \"python\": {\"executable\": \"/usr/bin/python\", \"version\": {\"micro\": 5, \"major\": 2, \"releaselevel\": \"final\", \"serial\": 0, \"minor\": 7}, \"type\": \"CPython\", \"has_sslcontext\": true, \"version_info\": [2, 7, 5, \"final\", 0]}, \"default_ipv6\": {}, \"interfaces\": [\"lo\", \"eth0\"], \"memtotal_mb\": 990, \"distribution_file_path\": \"/etc/redhat-release\", \"memfree_mb\": 113, \"fips\": false, \"processor_cores\": 12, \"all_ipv4_addresses\": [\"172.18.0.3\"], \"user_gecos\": \"root\", \"user_shell\": \"/bin/bash\", \"swapfree_mb\": 1858, \"device_links\": {\"masters\": {\"sda2\": [\"dm-0\", \"dm-1\", \"dm-2\"]}, \"labels\": {}, \"ids\": {\"sda2\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5-part2\"], \"sda\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5\"], \"sda1\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5-part1\"]}, \"uuids\": {\"sda1\": [\"6bd03c61-c02b-4d0f-9951-1c0c84c784d8\"]}}, \"virtualization_role\": \"guest\", \"real_user_id\": 0, \"date_time\": {\"weekday_number\": \"4\", \"iso8601_basic_short\": \"20181206T220906\", \"tz\": \"UTC\", \"weeknumber\": \"49\", \"hour\": \"22\", \"year\": \"2018\", \"minute\": \"09\", \"tz_offset\": \"+0000\", \"month\": \"12\", \"epoch\": \"1544134146\", \"iso8601_micro\": \"2018-12-06T22:09:06.391719Z\", \"weekday\": \"Thursday\", \"time\": \"22:09:06\", \"date\": \"2018-12-06\", \"iso8601\": \"2018-12-06T22:09:06Z\", \"day\": \"06\", \"iso8601_basic\": \"20181206T220906391676\", \"second\": \"06\"}, \"product_serial\": \"0\", \"dns\": {\"nameservers\": [\"127.0.0.11\"], \"search\": [\"localdomain\"], \"options\": {\"single-request-reopen\": true, \"ndots\": \"0\"}}, \"service_mgr\": \"systemd\", \"user_id\": \"root\", \"product_name\": \"VirtualBox\", \"fqdn\": \"826c6eebe35f\", \"devices\": {\"dm-2\": {\"scheduler_mode\": \"\", \"rotational\": \"1\", \"vendor\": null, \"sectors\": \"41959424\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [], \"uuids\": []}, \"sas_device_handle\": null, \"sas_address\": null, \"virtual\": 1, \"host\": \"\", \"sectorsize\": \"512\", \"removable\": \"0\", \"support_discard\": \"0\", \"model\": null, \"partitions\": {}, \"holders\": [], \"size\": \"20.01 GB\"}, \"sda\": {\"scheduler_mode\": \"cfq\", \"rotational\": \"1\", \"vendor\": \"ATA\", \"sectors\": \"134217728\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5\"], \"uuids\": []}, \"sas_device_handle\": null, \"sas_address\": null, \"virtual\": 1, \"host\": \"\", \"sectorsize\": \"512\", \"removable\": \"0\", \"support_discard\": \"0\", \"model\": \"VBOX HARDDISK\", \"partitions\": {\"sda2\": {\"sectorsize\": 512, \"uuid\": null, \"links\": {\"masters\": [\"dm-0\", \"dm-1\", \"dm-2\"], \"labels\": [], \"ids\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5-part2\"], \"uuids\": []}, \"sectors\": \"132118528\", \"start\": \"2099200\", \"holders\": [\"centos-root\", \"centos-swap\", \"centos-home\"], \"size\": \"63.00 GB\"}, \"sda1\": {\"sectorsize\": 512, \"uuid\": \"6bd03c61-c02b-4d0f-9951-1c0c84c784d8\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5-part1\"], \"uuids\": [\"6bd03c61-c02b-4d0f-9951-1c0c84c784d8\"]}, \"sectors\": \"2097152\", \"start\": \"2048\", \"holders\": [], \"size\": \"1.00 GB\"}}, \"holders\": [], \"size\": \"64.00 GB\"}, \"dm-0\": {\"scheduler_mode\": \"\", \"rotational\": \"1\", \"vendor\": null, \"sectors\": \"85950464\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [], \"uuids\": []}, \"sas_device_handle\": null, \"sas_address\": null, \"virtual\": 1, \"host\": \"\", \"sectorsize\": \"512\", \"removable\": \"0\", \"support_discard\": \"0\", \"model\": null, \"partitions\": {}, \"holders\": [], \"size\": \"40.98 GB\"}, \"dm-1\": {\"scheduler_mode\": \"\", \"rotational\": \"1\", \"vendor\": null, \"sectors\": \"4194304\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [], \"uuids\": []}, \"sas_device_handle\": null, \"sas_address\": null, \"virtual\": 1, \"host\": \"\", \"sectorsize\": \"512\", \"removable\": \"0\", \"support_discard\": \"0\", \"model\": null, \"partitions\": {}, \"holders\": [], \"size\": \"2.00 GB\"}}, \"userspace_architecture\": \"x86_64\", \"memory_mb\": {\"real\": {\"total\": 990, \"used\": 877, \"free\": 113}, \"swap\": {\"cached\": 103, \"total\": 2047, \"free\": 1858, \"used\": 189}, \"nocache\": {\"used\": 393, \"free\": 597}}, \"real_group_id\": 0, \"all_ipv6_addresses\": [], \"architecture\": \"x86_64\", \"is_chroot\": false, \"mounts\": [{\"block_used\": 579997, \"uuid\": \"N/A\", \"size_total\": 43985149952, \"block_total\": 10738562, \"mount\": \"/etc/resolv.conf\", \"block_available\": 10158565, \"size_available\": 41609482240, \"fstype\": \"xfs\", \"inode_total\": 21487616, \"options\": \"rw,seclabel,relatime,attr2,inode64,noquota,bind\", \"device\": \"/dev/mapper/centos-root\", \"inode_used\": 64319, \"block_size\": 4096, \"inode_available\": 21423297}, {\"block_used\": 579997, \"uuid\": \"N/A\", \"size_total\": 43985149952, \"block_total\": 10738562, \"mount\": \"/etc/hostname\", \"block_available\": 10158565, \"size_available\": 41609482240, \"fstype\": \"xfs\", \"inode_total\": 21487616, \"options\": \"rw,seclabel,relatime,attr2,inode64,noquota,bind\", \"device\": \"/dev/mapper/centos-root\", \"inode_used\": 64319, \"block_size\": 4096, \"inode_available\": 21423297}, {\"block_used\": 579997, \"uuid\": \"N/A\", \"size_total\": 43985149952, \"block_total\": 10738562, \"mount\": \"/etc/hosts\", \"block_available\": 10158565, \"size_available\": 41609482240, \"fstype\": \"xfs\", \"inode_total\": 21487616, \"options\": \"rw,seclabel,relatime,attr2,inode64,noquota,bind\", \"device\": \"/dev/mapper/centos-root\", \"inode_used\": 64319, \"block_size\": 4096, \"inode_available\": 21423297}], \"os_family\": \"RedHat\", \"distribution\": \"CentOS\", \"machine_id\": \"6a3597a1fb83486a89dedee19eb92853\", \"processor\": [\"0\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"1\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"2\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"3\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"4\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"5\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"6\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"7\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"8\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"9\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"10\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"11\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\"], \"bios_date\": \"12/01/2006\"}",
"log_file": "/tmp/degoss.log",
"test_dir": "/tmp/degoss.CIXffaVc7N/tests",
"test_file": "goss.yml",
"tmp_root": "/tmp/degoss.CIXffaVc7N",
"variables": "{}",
"verbose": "False",
"version": "latest"
}
},
"msg": "Goss Test(s) Passed (3 Total Tests)",
"tests_failed": 0,
"tests_passed": 3,
"tests_total": 3
}
{
"changed": false,
"failures": [
"File: /dev: exists:\nExpected\n <bool>: true\nto equal\n <bool>: false"
],
"invocation": {
"module_args": {
"bin_dir": "/tmp/degoss.LJO4gkEL8E/bin",
"clean": "False",
"debug": "False",
"facts": "{\"kernel\": \"3.10.0-693.21.1.el7.x86_64\", \"domain\": \"\", \"distribution_major_version\": \"7\", \"lsb\": {}, \"swaptotal_mb\": 2047, \"distribution_version\": \"7.4.1708\", \"selinux\": {\"status\": \"Missing selinux Python library\"}, \"product_version\": \"1.2\", \"system_vendor\": \"innotek GmbH\", \"module_setup\": true, \"processor_count\": 1, \"cmdline\": {\"LANG\": \"en_US.UTF-8\", \"BOOT_IMAGE\": \"/vmlinuz-3.10.0-693.21.1.el7.x86_64\", \"quiet\": true, \"rhgb\": true, \"rd.lvm.lv\": \"centos/swap\", \"crashkernel\": \"auto\", \"ro\": true, \"root\": \"/dev/mapper/centos-root\"}, \"product_uuid\": \"03E7AEFC-92ED-4614-8CD6-76C6AA2F8D59\", \"gather_subset\": [\"all\"], \"system_capabilities_enforced\": \"True\", \"effective_group_id\": 0, \"form_factor\": \"Other\", \"ansible_local\": {}, \"processor_vcpus\": 12, \"env\": {\"container\": \"docker\", \"SHLVL\": \"2\", \"HOSTNAME\": \"826c6eebe35f\", \"PWD\": \"/etc/ansible/roles/default/tests\", \"PATH\": \"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\", \"HOME\": \"/root\", \"ANSIBLE_FORCE_COLOR\": \"yes\", \"_\": \"/usr/bin/python\"}, \"python_version\": \"2.7.5\", \"user_dir\": \"/root\", \"effective_user_id\": 0, \"lo\": {\"mtu\": 65536, \"device\": \"lo\", \"promisc\": false, \"ipv4\": {\"broadcast\": \"host\", \"netmask\": \"255.0.0.0\", \"network\": \"127.0.0.0\", \"address\": \"127.0.0.1\"}, \"active\": true, \"type\": \"loopback\"}, \"hostname\": \"826c6eebe35f\", \"user_gid\": 0, \"system\": \"Linux\", \"pkg_mgr\": \"yum\", \"machine\": \"x86_64\", \"default_ipv4\": {\"macaddress\": \"02:42:ac:12:00:03\", \"network\": \"172.18.0.0\", \"mtu\": 1500, \"broadcast\": \"172.18.255.255\", \"alias\": \"eth0\", \"netmask\": \"255.255.0.0\", \"address\": \"172.18.0.3\", \"interface\": \"eth0\", \"type\": \"ether\", \"gateway\": \"172.18.0.1\"}, \"processor_threads_per_core\": 1, \"distribution_file_variety\": \"RedHat\", \"apparmor\": {\"status\": \"disabled\"}, \"distribution_file_parsed\": true, \"bios_version\": \"VirtualBox\", \"selinux_python_present\": false, \"eth0\": {\"macaddress\": \"02:42:ac:12:00:03\", \"type\": \"ether\", \"mtu\": 1500, \"device\": \"eth0\", \"promisc\": false, \"ipv4\": {\"broadcast\": \"172.18.255.255\", \"netmask\": \"255.255.0.0\", \"network\": \"172.18.0.0\", \"address\": \"172.18.0.3\"}, \"active\": true, \"speed\": 10000}, \"uptime_seconds\": 11431, \"virtualization_type\": \"docker\", \"system_capabilities\": [\"cap_chown\", \"cap_dac_override\", \"cap_dac_read_search\", \"cap_fowner\", \"cap_fsetid\", \"cap_kill\", \"cap_setgid\", \"cap_setuid\", \"cap_setpcap\", \"cap_linux_immutable\", \"cap_net_bind_service\", \"cap_net_broadcast\", \"cap_net_admin\", \"cap_net_raw\", \"cap_ipc_lock\", \"cap_ipc_owner\", \"cap_sys_module\", \"cap_sys_rawio\", \"cap_sys_chroot\", \"cap_sys_ptrace\", \"cap_sys_pacct\", \"cap_sys_admin\", \"cap_sys_boot\", \"cap_sys_nice\", \"cap_sys_resource\", \"cap_sys_time\", \"cap_sys_tty_config\", \"cap_mknod\", \"cap_lease\", \"cap_audit_write\", \"cap_audit_control\", \"cap_setfcap\", \"cap_mac_override\", \"cap_mac_admin\", \"cap_syslog\", \"35\", \"36+eip\"], \"distribution_release\": \"Core\", \"userspace_bits\": \"64\", \"user_uid\": 0, \"nodename\": \"826c6eebe35f\", \"python\": {\"executable\": \"/usr/bin/python\", \"version\": {\"micro\": 5, \"major\": 2, \"releaselevel\": \"final\", \"serial\": 0, \"minor\": 7}, \"type\": \"CPython\", \"has_sslcontext\": true, \"version_info\": [2, 7, 5, \"final\", 0]}, \"default_ipv6\": {}, \"interfaces\": [\"lo\", \"eth0\"], \"memtotal_mb\": 990, \"distribution_file_path\": \"/etc/redhat-release\", \"memfree_mb\": 122, \"fips\": false, \"processor_cores\": 12, \"all_ipv4_addresses\": [\"172.18.0.3\"], \"user_gecos\": \"root\", \"user_shell\": \"/bin/bash\", \"swapfree_mb\": 1858, \"device_links\": {\"masters\": {\"sda2\": [\"dm-0\", \"dm-1\", \"dm-2\"]}, \"labels\": {}, \"ids\": {\"sda2\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5-part2\"], \"sda\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5\"], \"sda1\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5-part1\"]}, \"uuids\": {\"sda1\": [\"6bd03c61-c02b-4d0f-9951-1c0c84c784d8\"]}}, \"virtualization_role\": \"guest\", \"real_user_id\": 0, \"date_time\": {\"weekday_number\": \"4\", \"iso8601_basic_short\": \"20181206T220745\", \"tz\": \"UTC\", \"weeknumber\": \"49\", \"hour\": \"22\", \"year\": \"2018\", \"minute\": \"07\", \"tz_offset\": \"+0000\", \"month\": \"12\", \"epoch\": \"1544134065\", \"iso8601_micro\": \"2018-12-06T22:07:45.608808Z\", \"weekday\": \"Thursday\", \"time\": \"22:07:45\", \"date\": \"2018-12-06\", \"iso8601\": \"2018-12-06T22:07:45Z\", \"day\": \"06\", \"iso8601_basic\": \"20181206T220745608767\", \"second\": \"45\"}, \"product_serial\": \"0\", \"dns\": {\"nameservers\": [\"127.0.0.11\"], \"search\": [\"localdomain\"], \"options\": {\"single-request-reopen\": true, \"ndots\": \"0\"}}, \"service_mgr\": \"systemd\", \"user_id\": \"root\", \"product_name\": \"VirtualBox\", \"fqdn\": \"826c6eebe35f\", \"devices\": {\"dm-2\": {\"scheduler_mode\": \"\", \"rotational\": \"1\", \"vendor\": null, \"sectors\": \"41959424\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [], \"uuids\": []}, \"sas_device_handle\": null, \"sas_address\": null, \"virtual\": 1, \"host\": \"\", \"sectorsize\": \"512\", \"removable\": \"0\", \"support_discard\": \"0\", \"model\": null, \"partitions\": {}, \"holders\": [], \"size\": \"20.01 GB\"}, \"sda\": {\"scheduler_mode\": \"cfq\", \"rotational\": \"1\", \"vendor\": \"ATA\", \"sectors\": \"134217728\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5\"], \"uuids\": []}, \"sas_device_handle\": null, \"sas_address\": null, \"virtual\": 1, \"host\": \"\", \"sectorsize\": \"512\", \"removable\": \"0\", \"support_discard\": \"0\", \"model\": \"VBOX HARDDISK\", \"partitions\": {\"sda2\": {\"sectorsize\": 512, \"uuid\": null, \"links\": {\"masters\": [\"dm-0\", \"dm-1\", \"dm-2\"], \"labels\": [], \"ids\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5-part2\"], \"uuids\": []}, \"sectors\": \"132118528\", \"start\": \"2099200\", \"holders\": [\"centos-root\", \"centos-swap\", \"centos-home\"], \"size\": \"63.00 GB\"}, \"sda1\": {\"sectorsize\": 512, \"uuid\": \"6bd03c61-c02b-4d0f-9951-1c0c84c784d8\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5-part1\"], \"uuids\": [\"6bd03c61-c02b-4d0f-9951-1c0c84c784d8\"]}, \"sectors\": \"2097152\", \"start\": \"2048\", \"holders\": [], \"size\": \"1.00 GB\"}}, \"holders\": [], \"size\": \"64.00 GB\"}, \"dm-0\": {\"scheduler_mode\": \"\", \"rotational\": \"1\", \"vendor\": null, \"sectors\": \"85950464\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [], \"uuids\": []}, \"sas_device_handle\": null, \"sas_address\": null, \"virtual\": 1, \"host\": \"\", \"sectorsize\": \"512\", \"removable\": \"0\", \"support_discard\": \"0\", \"model\": null, \"partitions\": {}, \"holders\": [], \"size\": \"40.98 GB\"}, \"dm-1\": {\"scheduler_mode\": \"\", \"rotational\": \"1\", \"vendor\": null, \"sectors\": \"4194304\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [], \"uuids\": []}, \"sas_device_handle\": null, \"sas_address\": null, \"virtual\": 1, \"host\": \"\", \"sectorsize\": \"512\", \"removable\": \"0\", \"support_discard\": \"0\", \"model\": null, \"partitions\": {}, \"holders\": [], \"size\": \"2.00 GB\"}}, \"userspace_architecture\": \"x86_64\", \"memory_mb\": {\"real\": {\"total\": 990, \"used\": 868, \"free\": 122}, \"swap\": {\"cached\": 103, \"total\": 2047, \"free\": 1858, \"used\": 189}, \"nocache\": {\"used\": 392, \"free\": 598}}, \"real_group_id\": 0, \"all_ipv6_addresses\": [], \"architecture\": \"x86_64\", \"is_chroot\": false, \"mounts\": [{\"block_used\": 577872, \"uuid\": \"N/A\", \"size_total\": 43985149952, \"block_total\": 10738562, \"mount\": \"/etc/resolv.conf\", \"block_available\": 10160690, \"size_available\": 41618186240, \"fstype\": \"xfs\", \"inode_total\": 21487616, \"options\": \"rw,seclabel,relatime,attr2,inode64,noquota,bind\", \"device\": \"/dev/mapper/centos-root\", \"inode_used\": 64311, \"block_size\": 4096, \"inode_available\": 21423305}, {\"block_used\": 577872, \"uuid\": \"N/A\", \"size_total\": 43985149952, \"block_total\": 10738562, \"mount\": \"/etc/hostname\", \"block_available\": 10160690, \"size_available\": 41618186240, \"fstype\": \"xfs\", \"inode_total\": 21487616, \"options\": \"rw,seclabel,relatime,attr2,inode64,noquota,bind\", \"device\": \"/dev/mapper/centos-root\", \"inode_used\": 64311, \"block_size\": 4096, \"inode_available\": 21423305}, {\"block_used\": 577872, \"uuid\": \"N/A\", \"size_total\": 43985149952, \"block_total\": 10738562, \"mount\": \"/etc/hosts\", \"block_available\": 10160690, \"size_available\": 41618186240, \"fstype\": \"xfs\", \"inode_total\": 21487616, \"options\": \"rw,seclabel,relatime,attr2,inode64,noquota,bind\", \"device\": \"/dev/mapper/centos-root\", \"inode_used\": 64311, \"block_size\": 4096, \"inode_available\": 21423305}], \"os_family\": \"RedHat\", \"distribution\": \"CentOS\", \"machine_id\": \"6a3597a1fb83486a89dedee19eb92853\", \"processor\": [\"0\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"1\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"2\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"3\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"4\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"5\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"6\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"7\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"8\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"9\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"10\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"11\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\"], \"bios_date\": \"12/01/2006\"}",
"log_file": "/tmp/degoss.log",
"test_dir": "/tmp/degoss.LJO4gkEL8E/tests",
"test_file": "goss.yml",
"tmp_root": "/tmp/degoss.LJO4gkEL8E",
"variables": "{}",
"verbose": "False",
"version": "latest"
}
},
"msg": "Goss found 1 test failure(s).",
"tests_failed": 1,
"tests_passed": 2,
"tests_total": 3
}
{
"changed": false,
"failed_tests": null,
"invocation": {
"module_args": {
"bin_dir": "/tmp/degoss.wpc9WcbGa7/bin",
"clean": "False",
"debug": "False",
"facts": "{\"kernel\": \"3.10.0-693.21.1.el7.x86_64\", \"domain\": \"\", \"distribution_major_version\": \"7\", \"lsb\": {}, \"swaptotal_mb\": 2047, \"distribution_version\": \"7.4.1708\", \"selinux\": {\"status\": \"Missing selinux Python library\"}, \"product_version\": \"1.2\", \"system_vendor\": \"innotek GmbH\", \"module_setup\": true, \"processor_count\": 1, \"cmdline\": {\"LANG\": \"en_US.UTF-8\", \"BOOT_IMAGE\": \"/vmlinuz-3.10.0-693.21.1.el7.x86_64\", \"quiet\": true, \"rhgb\": true, \"rd.lvm.lv\": \"centos/swap\", \"crashkernel\": \"auto\", \"ro\": true, \"root\": \"/dev/mapper/centos-root\"}, \"product_uuid\": \"03E7AEFC-92ED-4614-8CD6-76C6AA2F8D59\", \"gather_subset\": [\"all\"], \"system_capabilities_enforced\": \"True\", \"effective_group_id\": 0, \"form_factor\": \"Other\", \"ansible_local\": {}, \"processor_vcpus\": 12, \"env\": {\"container\": \"docker\", \"SHLVL\": \"2\", \"HOSTNAME\": \"826c6eebe35f\", \"PWD\": \"/etc/ansible/roles/default/tests\", \"PATH\": \"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\", \"HOME\": \"/root\", \"ANSIBLE_FORCE_COLOR\": \"yes\", \"_\": \"/usr/bin/python\"}, \"python_version\": \"2.7.5\", \"user_dir\": \"/root\", \"effective_user_id\": 0, \"lo\": {\"mtu\": 65536, \"device\": \"lo\", \"promisc\": false, \"ipv4\": {\"broadcast\": \"host\", \"netmask\": \"255.0.0.0\", \"network\": \"127.0.0.0\", \"address\": \"127.0.0.1\"}, \"active\": true, \"type\": \"loopback\"}, \"hostname\": \"826c6eebe35f\", \"user_gid\": 0, \"system\": \"Linux\", \"pkg_mgr\": \"yum\", \"machine\": \"x86_64\", \"default_ipv4\": {\"macaddress\": \"02:42:ac:12:00:03\", \"network\": \"172.18.0.0\", \"mtu\": 1500, \"broadcast\": \"172.18.255.255\", \"alias\": \"eth0\", \"netmask\": \"255.255.0.0\", \"address\": \"172.18.0.3\", \"interface\": \"eth0\", \"type\": \"ether\", \"gateway\": \"172.18.0.1\"}, \"processor_threads_per_core\": 1, \"distribution_file_variety\": \"RedHat\", \"apparmor\": {\"status\": \"disabled\"}, \"distribution_file_parsed\": true, \"bios_version\": \"VirtualBox\", \"selinux_python_present\": false, \"eth0\": {\"macaddress\": \"02:42:ac:12:00:03\", \"type\": \"ether\", \"mtu\": 1500, \"device\": \"eth0\", \"promisc\": false, \"ipv4\": {\"broadcast\": \"172.18.255.255\", \"netmask\": \"255.255.0.0\", \"network\": \"172.18.0.0\", \"address\": \"172.18.0.3\"}, \"active\": true, \"speed\": 10000}, \"uptime_seconds\": 11580, \"virtualization_type\": \"docker\", \"system_capabilities\": [\"cap_chown\", \"cap_dac_override\", \"cap_dac_read_search\", \"cap_fowner\", \"cap_fsetid\", \"cap_kill\", \"cap_setgid\", \"cap_setuid\", \"cap_setpcap\", \"cap_linux_immutable\", \"cap_net_bind_service\", \"cap_net_broadcast\", \"cap_net_admin\", \"cap_net_raw\", \"cap_ipc_lock\", \"cap_ipc_owner\", \"cap_sys_module\", \"cap_sys_rawio\", \"cap_sys_chroot\", \"cap_sys_ptrace\", \"cap_sys_pacct\", \"cap_sys_admin\", \"cap_sys_boot\", \"cap_sys_nice\", \"cap_sys_resource\", \"cap_sys_time\", \"cap_sys_tty_config\", \"cap_mknod\", \"cap_lease\", \"cap_audit_write\", \"cap_audit_control\", \"cap_setfcap\", \"cap_mac_override\", \"cap_mac_admin\", \"cap_syslog\", \"35\", \"36+eip\"], \"distribution_release\": \"Core\", \"userspace_bits\": \"64\", \"user_uid\": 0, \"nodename\": \"826c6eebe35f\", \"python\": {\"executable\": \"/usr/bin/python\", \"version\": {\"micro\": 5, \"major\": 2, \"releaselevel\": \"final\", \"serial\": 0, \"minor\": 7}, \"type\": \"CPython\", \"has_sslcontext\": true, \"version_info\": [2, 7, 5, \"final\", 0]}, \"default_ipv6\": {}, \"interfaces\": [\"lo\", \"eth0\"], \"memtotal_mb\": 990, \"distribution_file_path\": \"/etc/redhat-release\", \"memfree_mb\": 106, \"fips\": false, \"processor_cores\": 12, \"all_ipv4_addresses\": [\"172.18.0.3\"], \"user_gecos\": \"root\", \"user_shell\": \"/bin/bash\", \"swapfree_mb\": 1858, \"device_links\": {\"masters\": {\"sda2\": [\"dm-0\", \"dm-1\", \"dm-2\"]}, \"labels\": {}, \"ids\": {\"sda2\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5-part2\"], \"sda\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5\"], \"sda1\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5-part1\"]}, \"uuids\": {\"sda1\": [\"6bd03c61-c02b-4d0f-9951-1c0c84c784d8\"]}}, \"virtualization_role\": \"guest\", \"real_user_id\": 0, \"date_time\": {\"weekday_number\": \"4\", \"iso8601_basic_short\": \"20181206T221014\", \"tz\": \"UTC\", \"weeknumber\": \"49\", \"hour\": \"22\", \"year\": \"2018\", \"minute\": \"10\", \"tz_offset\": \"+0000\", \"month\": \"12\", \"epoch\": \"1544134214\", \"iso8601_micro\": \"2018-12-06T22:10:14.602538Z\", \"weekday\": \"Thursday\", \"time\": \"22:10:14\", \"date\": \"2018-12-06\", \"iso8601\": \"2018-12-06T22:10:14Z\", \"day\": \"06\", \"iso8601_basic\": \"20181206T221014602497\", \"second\": \"14\"}, \"product_serial\": \"0\", \"dns\": {\"nameservers\": [\"127.0.0.11\"], \"search\": [\"localdomain\"], \"options\": {\"single-request-reopen\": true, \"ndots\": \"0\"}}, \"service_mgr\": \"systemd\", \"user_id\": \"root\", \"product_name\": \"VirtualBox\", \"fqdn\": \"826c6eebe35f\", \"devices\": {\"dm-2\": {\"scheduler_mode\": \"\", \"rotational\": \"1\", \"vendor\": null, \"sectors\": \"41959424\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [], \"uuids\": []}, \"sas_device_handle\": null, \"sas_address\": null, \"virtual\": 1, \"host\": \"\", \"sectorsize\": \"512\", \"removable\": \"0\", \"support_discard\": \"0\", \"model\": null, \"partitions\": {}, \"holders\": [], \"size\": \"20.01 GB\"}, \"sda\": {\"scheduler_mode\": \"cfq\", \"rotational\": \"1\", \"vendor\": \"ATA\", \"sectors\": \"134217728\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5\"], \"uuids\": []}, \"sas_device_handle\": null, \"sas_address\": null, \"virtual\": 1, \"host\": \"\", \"sectorsize\": \"512\", \"removable\": \"0\", \"support_discard\": \"0\", \"model\": \"VBOX HARDDISK\", \"partitions\": {\"sda2\": {\"sectorsize\": 512, \"uuid\": null, \"links\": {\"masters\": [\"dm-0\", \"dm-1\", \"dm-2\"], \"labels\": [], \"ids\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5-part2\"], \"uuids\": []}, \"sectors\": \"132118528\", \"start\": \"2099200\", \"holders\": [\"centos-root\", \"centos-swap\", \"centos-home\"], \"size\": \"63.00 GB\"}, \"sda1\": {\"sectorsize\": 512, \"uuid\": \"6bd03c61-c02b-4d0f-9951-1c0c84c784d8\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [\"ata-VBOX_HARDDISK_VB5c02dd1f-bc8623c5-part1\"], \"uuids\": [\"6bd03c61-c02b-4d0f-9951-1c0c84c784d8\"]}, \"sectors\": \"2097152\", \"start\": \"2048\", \"holders\": [], \"size\": \"1.00 GB\"}}, \"holders\": [], \"size\": \"64.00 GB\"}, \"dm-0\": {\"scheduler_mode\": \"\", \"rotational\": \"1\", \"vendor\": null, \"sectors\": \"85950464\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [], \"uuids\": []}, \"sas_device_handle\": null, \"sas_address\": null, \"virtual\": 1, \"host\": \"\", \"sectorsize\": \"512\", \"removable\": \"0\", \"support_discard\": \"0\", \"model\": null, \"partitions\": {}, \"holders\": [], \"size\": \"40.98 GB\"}, \"dm-1\": {\"scheduler_mode\": \"\", \"rotational\": \"1\", \"vendor\": null, \"sectors\": \"4194304\", \"links\": {\"masters\": [], \"labels\": [], \"ids\": [], \"uuids\": []}, \"sas_device_handle\": null, \"sas_address\": null, \"virtual\": 1, \"host\": \"\", \"sectorsize\": \"512\", \"removable\": \"0\", \"support_discard\": \"0\", \"model\": null, \"partitions\": {}, \"holders\": [], \"size\": \"2.00 GB\"}}, \"userspace_architecture\": \"x86_64\", \"memory_mb\": {\"real\": {\"total\": 990, \"used\": 884, \"free\": 106}, \"swap\": {\"cached\": 103, \"total\": 2047, \"free\": 1858, \"used\": 189}, \"nocache\": {\"used\": 391, \"free\": 599}}, \"real_group_id\": 0, \"all_ipv6_addresses\": [], \"architecture\": \"x86_64\", \"is_chroot\": false, \"mounts\": [{\"block_used\": 582072, \"uuid\": \"N/A\", \"size_total\": 43985149952, \"block_total\": 10738562, \"mount\": \"/etc/resolv.conf\", \"block_available\": 10156490, \"size_available\": 41600983040, \"fstype\": \"xfs\", \"inode_total\": 21487616, \"options\": \"rw,seclabel,relatime,attr2,inode64,noquota,bind\", \"device\": \"/dev/mapper/centos-root\", \"inode_used\": 64327, \"block_size\": 4096, \"inode_available\": 21423289}, {\"block_used\": 582072, \"uuid\": \"N/A\", \"size_total\": 43985149952, \"block_total\": 10738562, \"mount\": \"/etc/hostname\", \"block_available\": 10156490, \"size_available\": 41600983040, \"fstype\": \"xfs\", \"inode_total\": 21487616, \"options\": \"rw,seclabel,relatime,attr2,inode64,noquota,bind\", \"device\": \"/dev/mapper/centos-root\", \"inode_used\": 64327, \"block_size\": 4096, \"inode_available\": 21423289}, {\"block_used\": 582072, \"uuid\": \"N/A\", \"size_total\": 43985149952, \"block_total\": 10738562, \"mount\": \"/etc/hosts\", \"block_available\": 10156490, \"size_available\": 41600983040, \"fstype\": \"xfs\", \"inode_total\": 21487616, \"options\": \"rw,seclabel,relatime,attr2,inode64,noquota,bind\", \"device\": \"/dev/mapper/centos-root\", \"inode_used\": 64327, \"block_size\": 4096, \"inode_available\": 21423289}], \"os_family\": \"RedHat\", \"distribution\": \"CentOS\", \"machine_id\": \"6a3597a1fb83486a89dedee19eb92853\", \"processor\": [\"0\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"1\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"2\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"3\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"4\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"5\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"6\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"7\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"8\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"9\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"10\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\", \"11\", \"GenuineIntel\", \"Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz\"], \"bios_date\": \"12/01/2006\"}",
"log_file": "/tmp/degoss.log",
"test_dir": "/tmp/degoss.wpc9WcbGa7/tests",
"test_file": "goss.yml",
"tmp_root": "/tmp/degoss.wpc9WcbGa7",
"variables": "{}",
"verbose": "False",
"version": "latest"
}
},
"msg": "[FATAL] Unable to execute Goss tests: 2018/12/06 22:10:21 template: test:10:19: executing \"test\" at <.Vars.UNKNOWN>: map has no entry for key \"UNKNOWN\"\n",
"output_lines": [
"[INFO ] Detected latest available Goss version as 0.3.6",
"[INFO ] Installing the Goss binary from https://github.com/aelsabbahy/goss/releases/download/v0.3.6/goss-linux-amd64 into /tmp/degoss.wpc9WcbGa7/bin",
"[INFO ] Executing Goss test cases",
"[ERROR] Fatal Goss error (rc=1): Extra data: line 1 column 5 - line 2 column 1 (char 4 - 114)",
"[ERROR] Fatal module or Goss execution error: [FATAL] Unable to execute Goss tests: 2018/12/06 22:10:21 template: test:10:19: executing \"test\" at <.Vars.UNKNOWN>: map has no entry for key \"UNKNOWN\"",
"[INFO ] Cleaning is disabled, taking no action to remove /tmp/degoss.wpc9WcbGa7"
],
"rc": 1,
"stdout_lines": [
"2018/12/06 22:10:21 template: test:10:19: executing \"test\" at <.Vars.UNKNOWN>: map has no entry for key \"UNKNOWN\"",
""
],
"test_count": null
}
Fancy output has been completed, and the new implementation yields much better portability and less brittleness in the callback plugin.
TASK [default : run tests] *****************************************************
ok: [localhost]
Goss Tests Passed
(Count: 3, Failed: 0, Skipped: 0)
TASK [default : run tests] *****************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failures": ["File: /dev: exists:\nExpected\n <bool>: true\nto equal\n <bool>: false"], "msg": "Goss Tests Failed", "tests_failed": 1, "tests_passed": 2, "tests_total": 3}
Goss Tests Failed
File: /dev: exists:
Expected
<bool>: true
to equal
<bool>: false
(Count: 3, Failed: 1, Skipped: 0)
TASK [default : run tests] *****************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed_tests": null, "module_failed": true, "msg": "Goss Execution Failed (Unable to run tests) (rc=1)", "output_lines": ["[INFO ] Detected latest available Goss version as 0.3.6", "[INFO ] Installing the Goss binary from https://github.com/aelsabbahy/goss/releases/download/v0.3.6/goss-linux-amd64 into /tmp/degoss.Wr9wAc6ahi/bin", "[INFO ] Executing Goss test cases", "[ERROR] Fatal Goss error (rc=1): Extra data: line 1 column 5 - line 2 column 1 (char 4 - 114)", "[ERROR] Fatal module or Goss execution error: Goss Execution Failed (Unable to run tests) (rc=1)", "[INFO ] Cleaning is disabled, taking no action to remove /tmp/degoss.Wr9wAc6ahi"], "rc": 1, "stdout_lines": ["2018/12/07 00:58:48 template: test:10:19: executing \"test\" at <.Vars.unknown>: map has no entry for key \"unknown\"", ""], "test_count": null}
Goss Execution Failed (Unable to run tests) (rc=1)
2018/12/07 00:58:48 template: test:10:19: executing "test" at <.Vars.unknown>: map has no entry for key "unknown"
Now returning the JSON output as test_result
from the module execution.
Okay so I've figured out how to do unit-testing.
tests/
which installs pip and then installs requirements.txt
, which for the moment only includes mock
.tests.py
, which runs the unit tests against everything.7 tests implemented and passing, 9 tests skipped, 43.8% there.
Refactoring such that:
{{ degoss_tmp_root }}/logs/degoss.log
{{ degoss_tmp_root }}/result.json
It looks solid, only thing I can think of is to verify it works in an ansible environment that doesn't use Naftuli © grade ansible layouts/modules for everything. I might be able to verify this later, just in the middle of something
WHEN YOUR TESTS GO GREEN
TODO
Basic Functionality
install
test
{{ tmp_root }}/log/goss.log
{{ tmp_root }}/result.json
Testing
tests/
to capture the JSON result of thedegoss
task to disk to then run introspection on it to confirm desired failure cases.Output