|
Packit Service |
e080da |
#!/bin/bash
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
. $(dirname $0)/../include.rc
|
|
Packit Service |
e080da |
. $(dirname $0)/../volume.rc
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
NG_FILES=$(dirname $0)/../configfiles
|
|
Packit Service |
e080da |
cleanup;
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
function test_ng_1 ()
|
|
Packit Service |
e080da |
{
|
|
Packit Service |
e080da |
glusterfsd --print-netgroups $1 | sed -n 1p
|
|
Packit Service |
e080da |
}
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
function test_ng_2 ()
|
|
Packit Service |
e080da |
{
|
|
Packit Service |
e080da |
glusterfsd --print-netgroups $1 | sed -n 2p
|
|
Packit Service |
e080da |
}
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
function test_ng_3 ()
|
|
Packit Service |
e080da |
{
|
|
Packit Service |
e080da |
glusterfsd --print-netgroups $1 | sed -n 3p
|
|
Packit Service |
e080da |
}
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
function test_ng_4 ()
|
|
Packit Service |
e080da |
{
|
|
Packit Service |
e080da |
glusterfsd --print-netgroups $1 | sed -n 4p
|
|
Packit Service |
e080da |
}
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
function test_bad_ng ()
|
|
Packit Service |
e080da |
{
|
|
Packit Service |
e080da |
glusterfsd --print-netgroups $1 2>&1 | sed -n 1p
|
|
Packit Service |
e080da |
}
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
function test_large_file ()
|
|
Packit Service |
e080da |
{
|
|
Packit Service |
e080da |
# The build system needs this path for the test to pass.
|
|
Packit Service |
e080da |
# This is an important test because this file is ~1800 lines
|
|
Packit Service |
e080da |
# longs and is a "real-world" netgroups file.
|
|
Packit Service |
e080da |
glusterfsd --print-netgroups ~/opsfiles/storage/netgroup/netgroup | sed -n 1p
|
|
Packit Service |
e080da |
}
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
function test_empty_ng ()
|
|
Packit Service |
e080da |
{
|
|
Packit Service |
e080da |
glusterfsd --print-netgroups $1 2>&1 | sed -n 2p
|
|
Packit Service |
e080da |
}
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
EXPECT_KEYWORD "ng3 (dev-1763.prn-2.example.com,,)" test_ng_1 $NG_FILES/netgroups
|
|
Packit Service |
e080da |
EXPECT_KEYWORD "ng2 (dev1763.prn2.example.com,,)" test_ng_2 $NG_FILES/netgroups
|
|
Packit Service |
e080da |
EXPECT_KEYWORD "ng1 ng2 (dev1763.prn2.example.com,,)" test_ng_3 $NG_FILES/netgroups
|
|
Packit Service |
e080da |
EXPECT_KEYWORD "asdf ng1 ng2 (dev1763.prn2.example.com,,)" test_ng_4 $NG_FILES/netgroups
|
|
Packit Service |
e080da |
# TODO: get a real-world large netgroup file
|
|
Packit Service |
e080da |
#EXPECT_KEYWORD "wikipedia001.07.prn1 (wikipedia003.prn1.example.com,,)(wikipedia002.prn1.example.com,,)(wikipedia001.prn1.example.com,,)" test_large_file
|
|
Packit Service |
e080da |
EXPECT_KEYWORD "Parse error" test_bad_ng $NG_FILES/bad_netgroups
|
|
Packit Service |
e080da |
EXPECT_KEYWORD "No netgroups were specified except for the parent" test_empty_ng $NG_FILES/bad_netgroups
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
cleanup;
|