Kaynağa Gözat

- extend registrar test for db_mysql and db_postgres: test also for contact
persistence accross server restarts (the NULL value behaviour differ between
the two database types)


git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5198 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt 17 yıl önce
ebeveyn
işleme
e37837a0b9
2 değiştirilmiş dosya ile 60 ekleme ve 2 silme
  1. 30 2
      test/unit/11.sh
  2. 30 0
      test/unit/22.sh

+ 30 - 2
test/unit/11.sh

@@ -149,13 +149,41 @@ if [ "$ret" -eq 0 ]; then
 	fi;
 	fi;
 fi;
 fi;
 
 
-# cleanup
 $MYSQL "delete from location where username like '49721123456789%';"
 $MYSQL "delete from location where username like '49721123456789%';"
 
 
-cd ../test
+if [ "$ret" -eq 0 ]; then
+	# register again
+	sipsak -U -C sip:foobar@localhost -s sip:49721123456789@localhost -H localhost &> /dev/null
+	ret=$?
+fi;
 
 
 $KILL
 $KILL
 
 
+# restart to test preload_udomain functionality
+../$BIN -w . -f ../test/$CFG > /dev/null
+ret=$?
+
+sleep 1
+
+if [ "$ret" -eq 0 ]; then
+	# check if the contact is still registered
+	sipsak -U -C empty -s sip:[email protected] -H localhost -q "Contact: <sip:foobar@localhost>" &> /dev/null
+	ret=$?
+fi;
+
+# check if the methods value is correct
+if [ "$ret" -eq 0 ]; then
+	./$CTL ul show | grep "Methods:: 4294967295" &> /dev/null
+	ret=$?
+fi;
+
+# cleanup
+$MYSQL "delete from location where username like '49721123456789%';"
+
+$KILL
+
+cd ../test
+
 mv $CFG.bak $CFG
 mv $CFG.bak $CFG
 
 
 exit $ret
 exit $ret

+ 30 - 0
test/unit/22.sh

@@ -74,8 +74,38 @@ if [ "$ret" -eq 0 ]; then
 	ret=`$PSQL "select COUNT(*) from location where username='49721123456789';" | tail -n 1`
 	ret=`$PSQL "select COUNT(*) from location where username='49721123456789';" | tail -n 1`
 fi;
 fi;
 
 
+$PSQL "delete from location where username like '49721123456789%';"
+
+if [ "$ret" -eq 0 ]; then
+	# register again
+	sipsak -U -C sip:foobar@localhost -s sip:49721123456789@localhost -H localhost &> /dev/null
+	ret=$?
+fi;
+
+$KILL
+
+# restart to test preload_udomain functionality
+../$BIN -w . -f ../test/$CFG > /dev/null
+ret=$?
+
+sleep 1
+
+if [ "$ret" -eq 0 ]; then
+	# check if the contact is still registered
+	sipsak -U -C empty -s sip:[email protected] -H localhost -q "Contact: <sip:foobar@localhost>" &> /dev/null
+	ret=$?
+fi;
+
+# check if the methods value is correct
+if [ "$ret" -eq 0 ]; then
+	./$CTL ul show | grep "Methods:: 4294967295" &> /dev/null
+	ret=$?
+fi;
+
 $KILL
 $KILL
 
 
+$PSQL "delete from location where username like '49721123456789%';"
+
 cd ../test
 cd ../test
 mv $CFG.tmp $CFG
 mv $CFG.tmp $CFG