diff options
author | ned <ned@appliedtrust.com> | 2015-06-02 20:56:59 +0200 |
---|---|---|
committer | ned <ned@appliedtrust.com> | 2015-06-02 20:56:59 +0200 |
commit | 4237472cb11fa548c203e6fa21ff372728f60f3b (patch) | |
tree | 33a14f140765cc162ab89e9ffc90a0d42a9134bf /server_search_test.go | |
parent | Tolerate DerefAliases requests w/o falling over (diff) | |
download | ldap-4237472cb11fa548c203e6fa21ff372728f60f3b.tar ldap-4237472cb11fa548c203e6fa21ff372728f60f3b.tar.gz ldap-4237472cb11fa548c203e6fa21ff372728f60f3b.tar.bz2 ldap-4237472cb11fa548c203e6fa21ff372728f60f3b.tar.lz ldap-4237472cb11fa548c203e6fa21ff372728f60f3b.tar.xz ldap-4237472cb11fa548c203e6fa21ff372728f60f3b.tar.zst ldap-4237472cb11fa548c203e6fa21ff372728f60f3b.zip |
Diffstat (limited to 'server_search_test.go')
-rw-r--r-- | server_search_test.go | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/server_search_test.go b/server_search_test.go index c3f42b0..ed05f68 100644 --- a/server_search_test.go +++ b/server_search_test.go @@ -66,13 +66,23 @@ func TestSearchSizelimit(t *testing.T) { go func() { cmd := exec.Command("ldapsearch", "-H", ldapURL, "-x", - "-b", serverBaseDN, "-D", "cn=testy,"+serverBaseDN, "-w", "iLike2test", "-z", "9") // effectively no limit for this test + "-b", serverBaseDN, "-D", "cn=testy,"+serverBaseDN, "-w", "iLike2test") // no limit for this test out, _ := cmd.CombinedOutput() if !strings.Contains(string(out), "result: 0 Success") { t.Errorf("ldapsearch failed: %v", string(out)) } if !strings.Contains(string(out), "numEntries: 3") { - t.Errorf("ldapsearch sizelimit failed - not enough entries: %v", string(out)) + t.Errorf("ldapsearch sizelimit unlimited failed - not enough entries: %v", string(out)) + } + + cmd = exec.Command("ldapsearch", "-H", ldapURL, "-x", + "-b", serverBaseDN, "-D", "cn=testy,"+serverBaseDN, "-w", "iLike2test", "-z", "9") // effectively no limit for this test + out, _ = cmd.CombinedOutput() + if !strings.Contains(string(out), "result: 0 Success") { + t.Errorf("ldapsearch failed: %v", string(out)) + } + if !strings.Contains(string(out), "numEntries: 3") { + t.Errorf("ldapsearch sizelimit 9 failed - not enough entries: %v", string(out)) } cmd = exec.Command("ldapsearch", "-H", ldapURL, "-x", @@ -82,7 +92,27 @@ func TestSearchSizelimit(t *testing.T) { t.Errorf("ldapsearch failed: %v", string(out)) } if !strings.Contains(string(out), "numEntries: 2") { - t.Errorf("ldapsearch sizelimit failed - too many entries: %v", string(out)) + t.Errorf("ldapsearch sizelimit 2 failed - too many entries: %v", string(out)) + } + + cmd = exec.Command("ldapsearch", "-H", ldapURL, "-x", + "-b", serverBaseDN, "-D", "cn=testy,"+serverBaseDN, "-w", "iLike2test", "-z", "1") + out, _ = cmd.CombinedOutput() + if !strings.Contains(string(out), "result: 0 Success") { + t.Errorf("ldapsearch failed: %v", string(out)) + } + if !strings.Contains(string(out), "numEntries: 1") { + t.Errorf("ldapsearch sizelimit 1 failed - too many entries: %v", string(out)) + } + + cmd = exec.Command("ldapsearch", "-H", ldapURL, "-x", + "-b", serverBaseDN, "-D", "cn=testy,"+serverBaseDN, "-w", "iLike2test", "-z", "0") + out, _ = cmd.CombinedOutput() + if !strings.Contains(string(out), "result: 0 Success") { + t.Errorf("ldapsearch failed: %v", string(out)) + } + if !strings.Contains(string(out), "numEntries: 3") { + t.Errorf("ldapsearch sizelimit 0 failed - wrong number of entries: %v", string(out)) } done <- true }() |