Added SASL authentication test case
This commit is contained in:
parent
c7bb1679c3
commit
3e0cbbf4e6
64
tests/Sanity/SASL-authentication-check/Makefile
Normal file
64
tests/Sanity/SASL-authentication-check/Makefile
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Makefile of /tools/pcp/Sanity/SASL-authentication-check
|
||||||
|
# Description: A basic test of SASL authentication
|
||||||
|
# Author: Jan Kuřík <jkurik@redhat.com>
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Copyright (c) 2020 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=/tools/pcp/Sanity/SASL-authentication-check
|
||||||
|
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: Jan Kuřík <jkurik@redhat.com>" > $(METADATA)
|
||||||
|
@echo "Name: $(TEST)" >> $(METADATA)
|
||||||
|
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||||
|
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||||
|
@echo "Description: A basic test of SASL authentication" >> $(METADATA)
|
||||||
|
@echo "Type: Sanity" >> $(METADATA)
|
||||||
|
@echo "TestTime: 15m" >> $(METADATA)
|
||||||
|
@echo "RunFor: pcp" >> $(METADATA)
|
||||||
|
@echo "Requires: pcp cyrus-sasl-md5 cyrus-sasl-scram" >> $(METADATA)
|
||||||
|
@echo "Requires: cyrus-sasl-lib" >> $(METADATA)
|
||||||
|
@echo "Priority: Normal" >> $(METADATA)
|
||||||
|
@echo "License: GPLv2+" >> $(METADATA)
|
||||||
|
@echo "Confidential: no" >> $(METADATA)
|
||||||
|
@echo "Destructive: no" >> $(METADATA)
|
||||||
|
@echo "Releases: -RHEL4 -RHEL6 -RHELClient5 -RHELServer5 -RHEL7" >> $(METADATA)
|
||||||
|
|
||||||
|
rhts-lint $(METADATA)
|
3
tests/Sanity/SASL-authentication-check/PURPOSE
Normal file
3
tests/Sanity/SASL-authentication-check/PURPOSE
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
PURPOSE of /tools/pcp/Sanity/SASL-authentication-check
|
||||||
|
Description: A basic test of SASL authentication
|
||||||
|
Author: Jan Kuřík <jkurik@redhat.com>
|
15
tests/Sanity/SASL-authentication-check/main.fmf
Normal file
15
tests/Sanity/SASL-authentication-check/main.fmf
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
summary: A basic test of SASL authentication
|
||||||
|
description: ''
|
||||||
|
contact: Jan Kuřík <jkurik@redhat.com>
|
||||||
|
component:
|
||||||
|
- pcp
|
||||||
|
test: ./runtest.sh
|
||||||
|
framework: beakerlib
|
||||||
|
recommend:
|
||||||
|
- pcp
|
||||||
|
- cyrus-sasl-md5
|
||||||
|
- cyrus-sasl-scram
|
||||||
|
- cyrus-sasl-lib
|
||||||
|
duration: 15m
|
||||||
|
extra-summary: /tools/pcp/Sanity/SASL-authentication-check
|
||||||
|
extra-task: /tools/pcp/Sanity/SASL-authentication-check
|
79
tests/Sanity/SASL-authentication-check/runtest.sh
Executable file
79
tests/Sanity/SASL-authentication-check/runtest.sh
Executable file
@ -0,0 +1,79 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# runtest.sh of /tools/pcp/Sanity/SASL-authentication-check
|
||||||
|
# Description: A basic test of SASL authentication
|
||||||
|
# Author: Jan Kuřík <jkurik@redhat.com>
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Copyright (c) 2020 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/share/beakerlib/beakerlib.sh || exit 1
|
||||||
|
|
||||||
|
PACKAGE="pcp"
|
||||||
|
METRICUSER="pcpmetricuser"
|
||||||
|
METRICUSERPW="pcpmetricuserpw"
|
||||||
|
|
||||||
|
HASHES="scram-sha-256 digest-md5"
|
||||||
|
|
||||||
|
rlJournalStart
|
||||||
|
rlPhaseStartSetup
|
||||||
|
rlAssertRpm $PACKAGE
|
||||||
|
|
||||||
|
rlServiceStart "pmcd"
|
||||||
|
|
||||||
|
rlFileBackup --clean --missing-ok \
|
||||||
|
/etc/pcp.env \
|
||||||
|
/etc/sasl2/pmcd.conf \
|
||||||
|
/etc/pcp/passwd.db
|
||||||
|
rlRun "useradd -r ${METRICUSER}"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
for HASH in ${HASHES}; do
|
||||||
|
|
||||||
|
rlPhaseStartTest "Test for ${HASH}"
|
||||||
|
rlRun "rm -f /etc/pcp/passwd.db"
|
||||||
|
rlRun "echo -e 'mech_list: ${HASH}\nsasldb_path: /etc/pcp/passwd.db\n' \
|
||||||
|
> /etc/sasl2/pmcd.conf"
|
||||||
|
|
||||||
|
rlRun "echo ${METRICUSERPW} | saslpasswd2 -p -a pmcd ${METRICUSER}"
|
||||||
|
rlRun "chown root:pcp /etc/pcp/passwd.db"
|
||||||
|
rlRun "chmod 640 /etc/pcp/passwd.db"
|
||||||
|
|
||||||
|
rlServiceStart "pmcd"
|
||||||
|
rlRun "sleep 3" 0 "Give pmcd some time to start"
|
||||||
|
|
||||||
|
rlRun -s "pminfo -f -h 'pcp://127.0.0.1?username=${METRICUSER}&password=${METRICUSERPW}' disk.dev.read"
|
||||||
|
rlFileSubmit "${rlRun_LOG}" "pminfo.output"
|
||||||
|
rlAssertNotGrep "user not found" "${rlRun_LOG}"
|
||||||
|
rlAssertGrep ".*inst .*value .*" "${rlRun_LOG}" -E
|
||||||
|
rlFileSubmit "/var/log/pcp/pmcd/pmcd.log"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
rlPhaseStartCleanup
|
||||||
|
rlRun "userdel -fr ${METRICUSER}"
|
||||||
|
rlFileRestore
|
||||||
|
rlServiceRestore
|
||||||
|
rlPhaseEnd
|
||||||
|
rlJournalPrintText
|
||||||
|
rlJournalEnd
|
Loading…
Reference in New Issue
Block a user