From bc94f47c9ee420bd79965c71e85fee8d3f8a101a Mon Sep 17 00:00:00 2001 From: Ben Yanke Date: Tue, 5 Jun 2018 20:21:42 -0500 Subject: [PATCH] Add new group tests to integration tests --- scripts/travis/good-results/posixAccountList0 | 27 ++++++++++++++++ scripts/travis/good-results/posixGroupList0 | 28 ++++++++++++++++ scripts/travis/good-results/userFetchTest3 | 27 ++++++++++++++++ scripts/travis/integration-test.sh | 32 +++++++++++++------ scripts/travis/test-config.cfg | 28 ++++++++++++++++ 5 files changed, 132 insertions(+), 10 deletions(-) create mode 100644 scripts/travis/good-results/userFetchTest3 diff --git a/scripts/travis/good-results/posixAccountList0 b/scripts/travis/good-results/posixAccountList0 index be76069..0e5588a 100644 --- a/scripts/travis/good-results/posixAccountList0 +++ b/scripts/travis/good-results/posixAccountList0 @@ -39,6 +39,33 @@ sshPublicKey: ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA3UKCEllO2IZXgqNygiVb+dDLJJwV YnA0GO8oTa2VY4dTQSeDAUJSUxbzevbL0ll9Gi1uYaTDQyE5gbn2NfJSqq0OYA+3eyGtIVjFYZgi+ txSuhw== rsa-key-20160209 +dn: cn=jamesdoe,ou=superheros,dc=glauth,dc=com +cn: jamesdoe +uid: jamesdoe +givenName: James +sn: Doe +ou: superheros +uidNumber: 5003 +accountStatus: active +mail: jdoe2@example.com +objectClass: posixAccount +loginShell: /bin/sh +homeDirectory: /home/jamesdoe +description: jamesdoe via LDAP +gecos: jamesdoe via LDAP +gidNumber: 5501 +memberOf: cn=allaccs,ou=groups,dc=glauth,dc=com +memberOf: cn=fulltime,ou=groups,dc=glauth,dc=com +memberOf: cn=mailadmin,ou=groups,dc=glauth,dc=com +memberOf: cn=superheros,ou=groups,dc=glauth,dc=com +memberOf: cn=vpnaccess,ou=groups,dc=glauth,dc=com +sshPublicKey: ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA3UKCEllO2IZXgqNygiVb+dDLJJwV + w3AJwV34t2jzR+/tUNVeJ9XddKpYQektNHsFmY93lJw5QDSbeH/mAC4KPoUM47EriINKEelRbyG4h + C/ko/e2JWqEclPS9LP7GtqGmscXXo4JFkqnKw4TIRD52XI9n1syYM9Y8rJ88fjC/Lpn+01AB0paLV + IfppJU35t0Ho9doHAEfEvcQA6tcm7FLJUvklAxc8WUbdziczbRV40KzDroIkXAZRjX7vXXhh/p7XB + YnA0GO8oTa2VY4dTQSeDAUJSUxbzevbL0ll9Gi1uYaTDQyE5gbn2NfJSqq0OYA+3eyGtIVjFYZgi+ + txSuhw== rsa-key-20160209 + dn: cn=serviceuser,ou=svcaccts,dc=glauth,dc=com cn: serviceuser uid: serviceuser diff --git a/scripts/travis/good-results/posixGroupList0 b/scripts/travis/good-results/posixGroupList0 index 1e3f8ec..b8d4dd1 100644 --- a/scripts/travis/good-results/posixGroupList0 +++ b/scripts/travis/good-results/posixGroupList0 @@ -4,8 +4,10 @@ description: superheros via LDAP gidNumber: 5501 objectClass: posixGroup uniqueMember: cn=hackers,ou=superheros,dc=glauth,dc=com +uniqueMember: cn=jamesdoe,ou=superheros,dc=glauth,dc=com uniqueMember: cn=johndoe,ou=superheros,dc=glauth,dc=com memberUid: hackers +memberUid: jamesdoe memberUid: johndoe dn: cn=svcaccts,ou=groups,dc=glauth,dc=com @@ -22,8 +24,10 @@ description: vpnaccess via LDAP gidNumber: 5503 objectClass: posixGroup uniqueMember: cn=hackers,ou=superheros,dc=glauth,dc=com +uniqueMember: cn=jamesdoe,ou=superheros,dc=glauth,dc=com uniqueMember: cn=johndoe,ou=superheros,dc=glauth,dc=com memberUid: hackers +memberUid: jamesdoe memberUid: johndoe dn: cn=allaccs,ou=groups,dc=glauth,dc=com @@ -32,9 +36,33 @@ description: allaccs via LDAP gidNumber: 5504 objectClass: posixGroup uniqueMember: cn=hackers,ou=superheros,dc=glauth,dc=com +uniqueMember: cn=jamesdoe,ou=superheros,dc=glauth,dc=com uniqueMember: cn=johndoe,ou=superheros,dc=glauth,dc=com uniqueMember: cn=serviceuser,ou=svcaccts,dc=glauth,dc=com memberUid: hackers +memberUid: jamesdoe memberUid: johndoe memberUid: serviceuser +dn: cn=mailadmin,ou=groups,dc=glauth,dc=com +cn: mailadmin +description: mailadmin via LDAP +gidNumber: 5505 +objectClass: posixGroup +uniqueMember: cn=jamesdoe,ou=superheros,dc=glauth,dc=com +memberUid: jamesdoe + +dn: cn=webmail,ou=groups,dc=glauth,dc=com +cn: webmail +description: webmail via LDAP +gidNumber: 5506 +objectClass: posixGroup + +dn: cn=fulltime,ou=groups,dc=glauth,dc=com +cn: fulltime +description: fulltime via LDAP +gidNumber: 5507 +objectClass: posixGroup +uniqueMember: cn=jamesdoe,ou=superheros,dc=glauth,dc=com +memberUid: jamesdoe + diff --git a/scripts/travis/good-results/userFetchTest3 b/scripts/travis/good-results/userFetchTest3 new file mode 100644 index 0000000..3eadadf --- /dev/null +++ b/scripts/travis/good-results/userFetchTest3 @@ -0,0 +1,27 @@ +dn: cn=jamesdoe,ou=superheros,dc=glauth,dc=com +cn: jamesdoe +uid: jamesdoe +givenName: James +sn: Doe +ou: superheros +uidNumber: 5003 +accountStatus: active +mail: jdoe2@example.com +objectClass: posixAccount +loginShell: /bin/sh +homeDirectory: /home/jamesdoe +description: jamesdoe via LDAP +gecos: jamesdoe via LDAP +gidNumber: 5501 +memberOf: cn=allaccs,ou=groups,dc=glauth,dc=com +memberOf: cn=fulltime,ou=groups,dc=glauth,dc=com +memberOf: cn=mailadmin,ou=groups,dc=glauth,dc=com +memberOf: cn=superheros,ou=groups,dc=glauth,dc=com +memberOf: cn=vpnaccess,ou=groups,dc=glauth,dc=com +sshPublicKey: ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA3UKCEllO2IZXgqNygiVb+dDLJJwV + w3AJwV34t2jzR+/tUNVeJ9XddKpYQektNHsFmY93lJw5QDSbeH/mAC4KPoUM47EriINKEelRbyG4h + C/ko/e2JWqEclPS9LP7GtqGmscXXo4JFkqnKw4TIRD52XI9n1syYM9Y8rJ88fjC/Lpn+01AB0paLV + IfppJU35t0Ho9doHAEfEvcQA6tcm7FLJUvklAxc8WUbdziczbRV40KzDroIkXAZRjX7vXXhh/p7XB + YnA0GO8oTa2VY4dTQSeDAUJSUxbzevbL0ll9Gi1uYaTDQyE5gbn2NfJSqq0OYA+3eyGtIVjFYZgi+ + txSuhw== rsa-key-20160209 + diff --git a/scripts/travis/integration-test.sh b/scripts/travis/integration-test.sh index ae91b8f..ea330aa 100755 --- a/scripts/travis/integration-test.sh +++ b/scripts/travis/integration-test.sh @@ -73,19 +73,30 @@ function snapshotTest() { $1 > "$testResults/$2" - THISFAIL="0" - diff -u "$goodResults/$2" "$testResults/$2" || THISFAIL="1" + # Handle the first-run case, saving the test results + if [ ! -f "$goodResults/$2" ]; then + echo " - FIRST RUN - SAVING SNAPSHOT, RUN AGAIN TO PASS : '$2'"; + # Copy the results to the goodResults dir, for future runs. + cp "$testResults/$2" "$goodResults/$2"; + + # NOTE: fail=1 must still be set, otherwise CI runs would succeed when they shouldn't + FAIL="1" + else + + THISFAIL="0" + diff -u "$goodResults/$2" "$testResults/$2" || THISFAIL="1" - if [[ "$CLEANUP" = "cleanup" ]] ; then - rm -rf "$testResults" + if [[ "$CLEANUP" = "cleanup" ]] ; then + rm -rf "$testResults" + fi + + if [[ "$THISFAIL" = "0" ]] ; then + echo " - PASS : '$2'"; + else + echo " - FAIL : '$2'"; + FAIL="1" fi - - if [[ "$THISFAIL" = "0" ]] ; then - echo " - PASS : '$2'"; - else - echo " - FAIL : '$2'"; - FAIL="1" fi } @@ -100,6 +111,7 @@ echo ""; snapshotTest "cn=hackers" userFetchTest0 snapshotTest "cn=johndoe" userFetchTest1 snapshotTest "cn=serviceuser" userFetchTest2 +snapshotTest "cn=jamesdoe" userFetchTest3 # Test result of fetching nonexistent users snapshotTest "cn=fakeuser" userFetchNonexistentUser0 diff --git a/scripts/travis/test-config.cfg b/scripts/travis/test-config.cfg index 8c8bfb5..6869b10 100644 --- a/scripts/travis/test-config.cfg +++ b/scripts/travis/test-config.cfg @@ -42,6 +42,20 @@ debug = true passsha256 = "6478579e37aff45f013e14eeb30b3cc56c72ccdc310123bcdf53e0333e3f416a" # dogood sshkeys = ["ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA3UKCEllO2IZXgqNygiVb+dDLJJwVw3AJwV34t2jzR+/tUNVeJ9XddKpYQektNHsFmY93lJw5QDSbeH/mAC4KPoUM47EriINKEelRbyG4hC/ko/e2JWqEclPS9LP7GtqGmscXXo4JFkqnKw4TIRD52XI9n1syYM9Y8rJ88fjC/Lpn+01AB0paLVIfppJU35t0Ho9doHAEfEvcQA6tcm7FLJUvklAxc8WUbdziczbRV40KzDroIkXAZRjX7vXXhh/p7XBYnA0GO8oTa2VY4dTQSeDAUJSUxbzevbL0ll9Gi1uYaTDQyE5gbn2NfJSqq0OYA+3eyGtIVjFYZgi+txSuhw== rsa-key-20160209"] +# This user record tests lots of groups, including group inheritence +[[users]] + name = "jamesdoe" + givenname="James" + sn="Doe" + mail = "jdoe2@example.com" + unixid = 5003 + primarygroup = 5501 + loginShell = "/bin/sh" + otherGroups = [5505,5507] + homeDir = "/home/jamesdoe" + passsha256 = "ff522a502031e5f37054892d642c2c0f36af6c4e8f62225470d4a1a99f3c9c2a" # dogood1 + sshkeys = ["ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA3UKCEllO2IZXgqNygiVb+dDLJJwVw3AJwV34t2jzR+/tUNVeJ9XddKpYQektNHsFmY93lJw5QDSbeH/mAC4KPoUM47EriINKEelRbyG4hC/ko/e2JWqEclPS9LP7GtqGmscXXo4JFkqnKw4TIRD52XI9n1syYM9Y8rJ88fjC/Lpn+01AB0paLVIfppJU35t0Ho9doHAEfEvcQA6tcm7FLJUvklAxc8WUbdziczbRV40KzDroIkXAZRjX7vXXhh/p7XBYnA0GO8oTa2VY4dTQSeDAUJSUxbzevbL0ll9Gi1uYaTDQyE5gbn2NfJSqq0OYA+3eyGtIVjFYZgi+txSuhw== rsa-key-20160209"] + [[users]] name = "serviceuser" @@ -59,6 +73,7 @@ debug = true name = "svcaccts" unixid = 5502 + [[groups]] name = "vpnaccess" unixid = 5503 @@ -69,6 +84,19 @@ debug = true unixid = 5504 includegroups = [ 5501, 5502 ] +[[groups]] + name = "mailadmin" + unixid = 5505 + +[[groups]] + name = "webmail" + unixid = 5506 + + +[[groups]] + name = "fulltime" + unixid = 5507 + ################# # Enable and configure the optional REST API here. [api]