aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2021-09-16 13:52:46 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2021-09-16 13:52:46 +0200
commitdbd900371466edfdc7bb7f09080c6698e4f8e647 (patch)
tree46942c1b8956794da080bd0582f307d2ae618701
parenta08be6b395949a74efc8115a726112d64e96b44d (diff)
downloadbottin-dbd900371466edfdc7bb7f09080c6698e4f8e647.tar.gz
bottin-dbd900371466edfdc7bb7f09080c6698e4f8e647.zip
Disable reconnect in tests + some cosmetic changesbug/message-id
-rw-r--r--test/bottin_test.go14
-rw-r--r--test/handler.go14
-rw-r--r--test/request.go8
-rwxr-xr-xtest/runner.sh6
4 files changed, 12 insertions, 30 deletions
diff --git a/test/bottin_test.go b/test/bottin_test.go
index 00c0da9..c7a9761 100644
--- a/test/bottin_test.go
+++ b/test/bottin_test.go
@@ -147,14 +147,12 @@ func TestDeleteGroupsAfterAddedUsers(t *testing.T) {
//Example of paralellism Test
func TestPrincipal(t *testing.T) {
-
- t.Run("A=1", TestAddThenDelete)
- t.Run("A=2", TestModifyRequest)
+ t.Run("A=Add and delete", TestAddThenDelete)
+ t.Run("A=Modify", TestModifyRequest)
if !testing.Short() {
- t.Run("B=1", TestConfirmAddAttributes)
- t.Run("B=2", TestModifyRequestAndCheck)
- t.Run("C=1", TestAddUserInGroup)
- t.Run("C=2", TestDeleteGroupsAfterAddedUsers)
+ t.Run("B=Add attributes", TestConfirmAddAttributes)
+ t.Run("B=Modify and check", TestModifyRequestAndCheck)
+ t.Run("C=Add user in group", TestAddUserInGroup)
+ t.Run("C=Delete group", TestDeleteGroupsAfterAddedUsers)
}
-
}
diff --git a/test/handler.go b/test/handler.go
index 43fad77..7b3e480 100644
--- a/test/handler.go
+++ b/test/handler.go
@@ -54,18 +54,6 @@ func (inst *instance) GenerateName() (name string) {
return
}
-//Handler to around the bug with MessageId
-func (inst *instance) Reconnect() (err error) {
- inst.logging.Close()
- inst.logging, err = ldap.Dial("tcp", fmt.Sprintf("%s:%d", adresse, port))
- if err != nil {
- return
- }
- err = inst.logging.Bind(bindusername, bindpassword)
- //logging.Debug("Reconnect succesful")
- return
-}
-
//Transform attributes in map format to the struct attributes
func MapAttToStruct(att map[string][]string) []attributes {
resultat := []attributes{}
@@ -88,7 +76,7 @@ func Connect() (*ldap.Conn, error) {
if key, ok := os.LookupEnv("BOTTIN_DEFAULT_ADMIN_PW"); ok {
bindpassword = key
}
-
+ //l.Debug.Enable(true)
err = l.Bind(bindusername, bindpassword)
logging.Debug("Connection succesful")
return l, err
diff --git a/test/request.go b/test/request.go
index b693211..adde22e 100644
--- a/test/request.go
+++ b/test/request.go
@@ -13,8 +13,6 @@ func (inst *instance) Add_Request(dn string, attributes map[string][]string) err
//Send the request
err := inst.logging.Add(req)
- //@FIXME: Remove when you try to correct the bug MessageID
- inst.Reconnect()
return err
}
@@ -36,8 +34,6 @@ func (inst *instance) Modify_Request(dn string, add_attributes, delete_attribute
}
err := inst.logging.Modify(modifyReq)
- //@FIXME: Remove when you try to correct the bug MessageID
- inst.Reconnect()
return err
}
@@ -45,8 +41,6 @@ func (inst *instance) Delete_Request(dn string) error {
del := ldap.NewDelRequest(dn, nil)
err := inst.logging.Del(del)
- //@FIXME: Remove when you try to correct the bug MessageID
- inst.Reconnect()
return err
}
@@ -61,7 +55,5 @@ func (inst *instance) Search_Request(dn, filter string, name_attributes []string
res, err := inst.logging.Search(searchReq)
logging.Debugf("Search Request made with: dn: %s, filter: %s, attributes: %s. \n", dn, filter, name_attributes)
- //@FIXME: Remove when you try to correct the bug MessageID
- inst.Reconnect()
return res, err
}
diff --git a/test/runner.sh b/test/runner.sh
index 0b97068..04e42be 100755
--- a/test/runner.sh
+++ b/test/runner.sh
@@ -6,7 +6,11 @@ echo $BOTTIN_DEFAULT_ADMIN_PW
consul agent -dev > /dev/null 2>&1 &
sleep 2
cp test/config.json.test config.json
-./bottin > /dev/null 2>&1 &
+./bottin > /tmp/bottin.log 2>&1 &
sleep 1
./test/test -test.v -test.failfast -test.short -test.run TestPrincipal
./test/test -test.v -test.failfast -test.run TestPrincipal/B=
+
+jobs
+kill %2
+kill %1