diff --git a/tests/changing-password-with-stdin-opiton-limits/Makefile b/tests/changing-password-with-stdin-opiton-limits/Makefile new file mode 100644 index 0000000..89be2ed --- /dev/null +++ b/tests/changing-password-with-stdin-opiton-limits/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/passwd/Regression/changing-password-with-stdin-opiton-limits +# Description: Test for changing password with --stdin opiton limits +# Author: Eva Mrakova +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/passwd/Regression/changing-password-with-stdin-opiton-limits +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Eva Mrakova " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for changing password with --stdin opiton limits" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: passwd" >> $(METADATA) + @echo "Requires: passwd" >> $(METADATA) + @echo "Requires: expect" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/changing-password-with-stdin-opiton-limits/PURPOSE b/tests/changing-password-with-stdin-opiton-limits/PURPOSE new file mode 100644 index 0000000..e45dcb8 --- /dev/null +++ b/tests/changing-password-with-stdin-opiton-limits/PURPOSE @@ -0,0 +1,6 @@ +PURPOSE of /CoreOS/passwd/Regression/changing-password-with-stdin-opiton-limits +Description: Test for changing password with --stdin opiton limits 512 bytes long +Author: Eva Mrakova +Bug summary: changing password with --stdin opiton limits password size to 79 characters + +Tests changing password 511 chars long diff --git a/tests/changing-password-with-stdin-opiton-limits/runtest.sh b/tests/changing-password-with-stdin-opiton-limits/runtest.sh new file mode 100644 index 0000000..8300888 --- /dev/null +++ b/tests/changing-password-with-stdin-opiton-limits/runtest.sh @@ -0,0 +1,94 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/passwd/Regression/changing-password-with-stdin-opiton-limits +# Description: Test for changing password with --stdin opiton limits +# Author: Eva Mrakova +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="passwd" + +TSTUSR="testuser" +# max length password: 512 chars (supported by pam_unix, PAM_MAX_RESP_SIZE) +# such long passwords do not work on RHEL6 for pam <= pam-1.1.1-20.el6 +# similarly for RHEL7 and pam-1.1.8-12.el7 +TSTPASSWD=$(tr -dc 'A-Za-z0-9' +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/passwd/Regression/passwd-exit-status-1 +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Ondrej Moris " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for passwd exit status 1" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: passwd" >> $(METADATA) + @echo "Requires: passwd" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/passwd-exit-status-1/PURPOSE b/tests/passwd-exit-status-1/PURPOSE new file mode 100644 index 0000000..e043296 --- /dev/null +++ b/tests/passwd-exit-status-1/PURPOSE @@ -0,0 +1,26 @@ +PURPOSE of /CoreOS/passwd/Regression/passwd-exit-status-1 +Description: Test for passwd exit status 1 +Author: Ondrej Moris +Bug summary: passwd exit status 1 + +Description: + +Description of problem: +passwd exits with status 1 when argument -S is passed. + +Version-Release number of selected component (if applicable): +5.X + +How reproducible: +allways + +Steps to Reproduce: +1. passwd -S user +2. echo $? + + +Actual results: +1 + +Expected results: +0 diff --git a/tests/passwd-exit-status-1/runtest.sh b/tests/passwd-exit-status-1/runtest.sh new file mode 100644 index 0000000..1dd27f2 --- /dev/null +++ b/tests/passwd-exit-status-1/runtest.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/passwd/Regression/passwd-exit-status-1 +# Description: Test for passwd exit status 1 +# Author: Ondrej Moris +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include rhts environment +. /usr/bin/rhts-environment.sh +. /usr/share/beakerlib/beakerlib.sh + +PACKAGE="passwd" + +rlJournalStart + + rlPhaseStartSetup + + rlAssertRpm $PACKAGE + + rlPhaseEnd + + rlPhaseStartTest + + rlRun "passwd -S root" 0 + rlRun "passwd -S nonExistingUser" 1-255 + + rlPhaseEnd + + rlPhaseStartCleanup + rlPhaseEnd + +rlJournalPrintText + +rlJournalEnd diff --git a/tests/smoke-test/Makefile b/tests/smoke-test/Makefile new file mode 100644 index 0000000..1dc28d2 --- /dev/null +++ b/tests/smoke-test/Makefile @@ -0,0 +1,65 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/passwd/Sanity/smoke-test +# Description: Test basic functionality. +# Author: Ondrej Moris +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/passwd/Sanity/smoke-test +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Ondrej Moris " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test basic functionality." >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: passwd" >> $(METADATA) + @echo "Requires: passwd" >> $(METADATA) + @echo "Requires: openssh" >> $(METADATA) + @echo "Requires: expect" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/smoke-test/PURPOSE b/tests/smoke-test/PURPOSE new file mode 100644 index 0000000..9e29998 --- /dev/null +++ b/tests/smoke-test/PURPOSE @@ -0,0 +1,5 @@ +PURPOSE of /CoreOS/passwd/Sanity/smoke-test +Description: Test basic functionality. +Author: Ondrej Moris + +tests basic passwd command usage scenarios diff --git a/tests/smoke-test/runtest.sh b/tests/smoke-test/runtest.sh new file mode 100644 index 0000000..a819137 --- /dev/null +++ b/tests/smoke-test/runtest.sh @@ -0,0 +1,141 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/passwd/Sanity/smoke-test +# Description: Test basic functionality. +# Author: Ondrej Moris +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include rhts environment +. /usr/bin/rhts-environment.sh +. /usr/share/beakerlib/beakerlib.sh + +PACKAGE="passwd" + +function set_password { + +expect >/tmp/out 2>&1 </tmp/out 2>&1 < /tmp/out 2>&1" 1-255 "Unlocking account" + rlRun "grep \"Unsafe\" /tmp/out" 0 "Checking warning message" + rlRun "passwd -uf $U" 0 "Force Unlocking account" + sleep 3 + rlRun "echo c | passwd --stdin $U" 0 "Changing password via stdin to 'c'" + sleep 3 + rlRun "check_password $U c" 0 "Checking good password" + rlRun "check_password $U x" 1-255 "Checking wrong password" + rlRun "passwd -d $U" 0 "Disabling account" + sleep 3 + rlRun "check_password $U c" 1-255 "Checking good password" + rlRun "check_password $U x" 1-255 "Checking wrong password" + rlRun "echo d | passwd --stdin $U" 0 "Changing password via stdin to 'd'" + sleep 3 + rlRun "check_password $U d" 0 "Checking good password" + rlRun "check_password $U x" 1-255 "Checking wrong password" + rlRun "passwd -S $U" 0 "Checking good account information" + rlRun "passwd -S nonexistinguser" 1-255 "Checking wrong account information" + + rlPhaseEnd + + rlPhaseStartCleanup + + rlRun "userdel -r $U" 0 "Removing testing account" + rlRun "rm -f /tmp/out" 0 "Removing output file" + + rlPhaseEnd + +rlJournalPrintText + +rlJournalEnd diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..9ed8858 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,30 @@ +--- +# Tests that run in classic context +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - classic + tests: + - changing-password-with-stdin-opiton-limits + - passwd-exit-status-1 + - smoke-test + required_packages: + - expect + - findutils # beakerlib needs find command + - openssh # smoke-test needs openssh + - passwd + +# Tests that run in container context +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - container + tests: + - changing-password-with-stdin-opiton-limits + - passwd-exit-status-1 + required_packages: + - expect + - findutils # beakerlib needs find command + - passwd