summaryrefslogtreecommitdiffstats
path: root/test/testcases/scripts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/testcases/scripts14
-rw-r--r--test/testcases/scripts.exp305
-rwxr-xr-xtest/testcases/scripts.filter4
3 files changed, 323 insertions, 0 deletions
diff --git a/test/testcases/scripts b/test/testcases/scripts
new file mode 100644
index 0000000..b89d75d
--- /dev/null
+++ b/test/testcases/scripts
@@ -0,0 +1,14 @@
+session Cluster scripts
+script
+list
+list all
+list names
+list names all
+list all names
+list bogus
+show mailto
+verify mailto id=foo email=test@example.com subject=hello
+run mailto id=foo email=test@example.com subject=hello nodes=node1 dry_run=true
+json '["show", "mailto"]'
+json '["verify", "mailto", {"id":"foo", "email":"test@example.com", "subject":"hello"}]'
+.
diff --git a/test/testcases/scripts.exp b/test/testcases/scripts.exp
new file mode 100644
index 0000000..ca086c9
--- /dev/null
+++ b/test/testcases/scripts.exp
@@ -0,0 +1,305 @@
+.TRY Cluster scripts
+.INP: script
+.INP: list
+.EXT crm_resource --show-metadata ocf:heartbeat:apache
+.EXT crm_resource --show-metadata ocf:heartbeat:IPaddr2
+.EXT crm_resource --show-metadata ocf:heartbeat:Filesystem
+.EXT crm_resource --show-metadata ocf:heartbeat:mysql
+.EXT crm_resource --show-metadata systemd:cryptctl-server
+.EXT crm_resource --show-metadata ocf:heartbeat:db2
+.EXT crm_resource --show-metadata ocf:heartbeat:exportfs
+.EXT crm_resource --show-metadata systemd:haproxy
+.EXT crm_resource --show-metadata ocf:heartbeat:LVM
+.EXT crm_resource --show-metadata ocf:heartbeat:MailTo
+.EXT crm_resource --show-metadata ocf:heartbeat:nginx
+.EXT crm_resource --show-metadata ocf:heartbeat:Raid1
+Basic:
+
+health Verify health and configuration
+mailto E-Mail
+virtual-ip Virtual IP
+
+Database:
+
+database MySQL/MariaDB Database
+db2 IBM DB2 Database
+db2-hadr IBM DB2 Database with HADR
+oracle Oracle Database
+
+Filesystem:
+
+clvm Cluster-aware LVM (lvmlockd)
+clvm-vg Cluster-aware LVM (auto activation)
+drbd DRBD Block Device
+filesystem File System (mount point)
+gfs2 GFS2 File System (Cloned)
+lvm-drbd LVM Group on DRBD
+ocfs2 OCFS2 File System
+raid-lvm RAID Hosting LVM
+
+NFS:
+
+exportfs NFS Exported File System
+nfsserver NFS Server
+nfsserver-lvm-drbd NFS Server on LVM and DRBD
+
+SAP:
+
+sap-as SAP ASCS Instance
+sap-ci SAP Central Instance
+sap-db SAP Database Instance
+sap-simple-stack SAP Simple Stack Instance
+sap-simple-stack-plus SAP SimpleStack+ Instance
+
+Server:
+
+apache Apache Webserver
+haproxy HAProxy
+nginx Nginx Webserver
+
+Stonith:
+
+libvirt STONITH for libvirt (kvm / Xen)
+sbd SBD, Shared storage based fencing
+vmware Fencing using vCenter / ESX Server
+
+System management:
+
+cryptctl A utility for setting up LUKS-based disk encryption
+
+.INP: list all
+Basic:
+
+health Verify health and configuration
+mailto E-Mail
+virtual-ip Virtual IP
+
+Database:
+
+database MySQL/MariaDB Database
+db2 IBM DB2 Database
+db2-hadr IBM DB2 Database with HADR
+oracle Oracle Database
+
+Filesystem:
+
+clvm Cluster-aware LVM (lvmlockd)
+clvm-vg Cluster-aware LVM (auto activation)
+drbd DRBD Block Device
+filesystem File System (mount point)
+gfs2 GFS2 File System (Cloned)
+lvm-drbd LVM Group on DRBD
+ocfs2 OCFS2 File System
+raid-lvm RAID Hosting LVM
+
+NFS:
+
+exportfs NFS Exported File System
+nfsserver NFS Server
+nfsserver-lvm-drbd NFS Server on LVM and DRBD
+
+SAP:
+
+sap-as SAP ASCS Instance
+sap-ci SAP Central Instance
+sap-db SAP Database Instance
+sap-simple-stack SAP Simple Stack Instance
+sap-simple-stack-plus SAP SimpleStack+ Instance
+
+Script:
+
+check-uptime Check uptime of nodes
+gfs2-base GFS2 File System Base (Cloned)
+lvm Controls the availability of an LVM Volume Group
+raid1 Manages Linux software RAID (MD) devices on shared storage
+sapdb SAP Database Instance
+sapinstance SAP Instance
+sbd-device Create SBD Device
+
+Server:
+
+apache Apache Webserver
+haproxy HAProxy
+nginx Nginx Webserver
+
+Stonith:
+
+libvirt STONITH for libvirt (kvm / Xen)
+sbd SBD, Shared storage based fencing
+vmware Fencing using vCenter / ESX Server
+
+System management:
+
+cryptctl A utility for setting up LUKS-based disk encryption
+
+.INP: list names
+apache
+clvm
+clvm-vg
+cryptctl
+database
+db2
+db2-hadr
+drbd
+exportfs
+filesystem
+gfs2
+haproxy
+health
+libvirt
+lvm-drbd
+mailto
+nfsserver
+nfsserver-lvm-drbd
+nginx
+ocfs2
+oracle
+raid-lvm
+sap-as
+sap-ci
+sap-db
+sap-simple-stack
+sap-simple-stack-plus
+sbd
+virtual-ip
+vmware
+.INP: list names all
+apache
+check-uptime
+clvm
+clvm-vg
+cryptctl
+database
+db2
+db2-hadr
+drbd
+exportfs
+filesystem
+gfs2
+gfs2-base
+haproxy
+health
+libvirt
+lvm
+lvm-drbd
+mailto
+nfsserver
+nfsserver-lvm-drbd
+nginx
+ocfs2
+oracle
+raid-lvm
+raid1
+sap-as
+sap-ci
+sap-db
+sap-simple-stack
+sap-simple-stack-plus
+sapdb
+sapinstance
+sbd
+sbd-device
+virtual-ip
+vmware
+.INP: list all names
+apache
+check-uptime
+clvm
+clvm-vg
+cryptctl
+database
+db2
+db2-hadr
+drbd
+exportfs
+filesystem
+gfs2
+gfs2-base
+haproxy
+health
+libvirt
+lvm
+lvm-drbd
+mailto
+nfsserver
+nfsserver-lvm-drbd
+nginx
+ocfs2
+oracle
+raid-lvm
+raid1
+sap-as
+sap-ci
+sap-db
+sap-simple-stack
+sap-simple-stack-plus
+sapdb
+sapinstance
+sbd
+sbd-device
+virtual-ip
+vmware
+.INP: list bogus
+ERROR: 7: script.list: Unexpected argument 'bogus': expected [all|names]
+Traceback (most recent call last):
+ rv = self.execute_command() is not False
+ rv = self.command_info.function(*arglist)
+ context.fatal_error("Unexpected argument '%s': expected [all|names]" % (arg))
+ raise ValueError(msg)
+ValueError: Unexpected argument 'bogus': expected [all|names]
+.INP: show mailto
+mailto (Basic)
+E-Mail
+
+Notifies recipient by e-mail in the event of a resource takeover.
+
+1. Notifies recipients by email in the event of resource takeover
+
+ id (required) (unique)
+ Identifier for the cluster resource
+ email (required)
+ Email address
+ subject
+ Subject
+
+
+.INP: verify mailto id=foo email=test@example.com subject=hello
+1. Ensure mail package is installed
+
+ mailx
+
+2. Configure cluster resources
+
+ primitive foo ocf:heartbeat:MailTo
+ email="test@example.com"
+ subject="hello"
+ op start timeout="10"
+ op stop timeout="10"
+ op monitor interval="10" timeout="10"
+
+ clone c-foo foo
+
+.INP: run mailto id=foo email=test@example.com subject=hello nodes=node1 dry_run=true
+INFO: 10: E-Mail
+INFO: 10: Nodes: node1
+** all - #!/usr/bin/env python3
+import crm_script
+import crm_init
+
+crm_init.install_packages(['mailx'])
+crm_script.exit_ok(True)
+
+INFO: 10: Ensure mail package is installed
+** localhost - temporary file <<END
+primitive foo ocf:heartbeat:MailTo email="test@example.com" subject="hello" op start timeout="10" op stop timeout="10" op monitor interval="10" timeout="10"
+clone c-foo foo
+
+END
+
+** localhost - crm --wait --no configure load update <<temporary file>>
+INFO: 10: Configure cluster resources
+.INP: json '["show", "mailto"]'
+{"category": "basic", "longdesc": "Notifies recipient by e-mail in the event of a resource takeover.", "name": "mailto", "shortdesc": "E-Mail", "steps": [{"longdesc": " This is a resource agent for MailTo. It sends email to a sysadmin\nwhenever a takeover occurs.", "parameters": [{"advanced": false, "longdesc": "", "name": "id", "required": true, "shortdesc": "Identifier for the cluster resource", "type": "resource", "unique": true}, {"advanced": false, "example": "", "longdesc": " The email address of sysadmin.", "name": "email", "required": true, "shortdesc": "Email address", "type": "email", "unique": false}, {"advanced": false, "example": "Resource Group", "longdesc": " The subject of the email.", "name": "subject", "required": false, "shortdesc": "Subject", "type": "string", "unique": false}], "required": true, "shortdesc": "Notifies recipients by email in the event of resource takeover"}]}
+.INP: json '["verify", "mailto", {"id":"foo", "email":"test@example.com", "subject":"hello"}]'
+{"longdesc": "", "name": "install", "nodes": "", "shortdesc": "Ensure mail package is installed", "text": "mailx"}
+{"longdesc": "", "name": "cib", "nodes": "", "shortdesc": "Configure cluster resources", "text": "primitive foo ocf:heartbeat:MailTo\n\temail=\"test@example.com\"\n\tsubject=\"hello\"\n\top start timeout=\"10\"\n\top stop timeout=\"10\"\n\top monitor interval=\"10\" timeout=\"10\"\n\nclone c-foo foo"}
diff --git a/test/testcases/scripts.filter b/test/testcases/scripts.filter
new file mode 100755
index 0000000..05e098a
--- /dev/null
+++ b/test/testcases/scripts.filter
@@ -0,0 +1,4 @@
+#!/usr/bin/awk -f
+# 1. replace .EXT [path/]<cmd> <parameter> with .EXT <cmd> <parameter>
+/\*\* localhost - crm --wait --no configure load update (\/tmp\/crm-tmp-.+)/ { gsub(/.*/, "<<temporary file>>", $NF) }
+{ print }