[Asterisk-code-review] CI: Add realtime checks to dailies (asterisk[master])

George Joseph asteriskteam at digium.com
Mon Jul 16 10:54:45 CDT 2018


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/9448


Change subject: CI:  Add realtime checks to dailies
......................................................................

CI:  Add realtime checks to dailies

Change-Id: I6dc8ab1679b3505c6dde1d47e1b9276df47814f8
---
M tests/CI/periodic-dailyTestGroups.json
M tests/CI/periodics-daily.jenkinsfile
M tests/CI/runTestsuite.sh
A tests/CI/setupRealtime.sh
4 files changed, 135 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/48/9448/1

diff --git a/tests/CI/periodic-dailyTestGroups.json b/tests/CI/periodic-dailyTestGroups.json
index b8c8e9b..01f51d1 100644
--- a/tests/CI/periodic-dailyTestGroups.json
+++ b/tests/CI/periodic-dailyTestGroups.json
@@ -28,5 +28,11 @@
 		"name": "othr",
 		"dir": "tests/CI/output/other",
 		"testcmd": " -T tests/(apps|agi|blind-transfer-parkingtimeout|rest_api|channels|realtime|example|skeleton_test|remote-test)"
+	},
+	{
+		"name": "real",
+		"dir": "tests/CI/output/realtime",
+		"runTestsuiteOptions": "--realtime",
+		"testcmd": " -t tests/channels/pjsip -G realtime-incompatible"
 	}
 ]
diff --git a/tests/CI/periodics-daily.jenkinsfile b/tests/CI/periodics-daily.jenkinsfile
index fd9fa6b..c879040 100644
--- a/tests/CI/periodics-daily.jenkinsfile
+++ b/tests/CI/periodics-daily.jenkinsfile
@@ -65,6 +65,7 @@
 						def groupName = testGroup.name
 						def groupDir = testGroup.dir
 						def groupTestcmd = testGroup.testcmd
+						def groupRunTestsuiteOptions = testGroup.runTestsuiteOptions
 						def testsuiteUrl = env.GIT_URL.replaceAll(/\/(Security-)?[^\/]+$/, "/\$1testsuite")
 
 						parallelTasks[groupName] = {
@@ -92,7 +93,7 @@
 											userRemoteConfigs: [[url: testsuiteUrl]]
 										]
 
-									sh "sudo tests/CI/runTestsuite.sh --testsuite-dir='${groupDir}' --test-command='${groupTestcmd}'"
+									sh "sudo tests/CI/runTestsuite.sh ${groupRunTestsuiteOptions} --testsuite-dir='${groupDir}' --test-command='${groupTestcmd}'"
 
 									archiveArtifacts allowEmptyArchive: true, defaultExcludes: false, fingerprint: true,
 										artifacts: "${groupDir}/asterisk-test-suite-report.xml, ${groupDir}/logs/**, ${groupDir}/core*.txt"
diff --git a/tests/CI/runTestsuite.sh b/tests/CI/runTestsuite.sh
index d295421..35f4d58 100755
--- a/tests/CI/runTestsuite.sh
+++ b/tests/CI/runTestsuite.sh
@@ -1,11 +1,17 @@
 #!/usr/bin/env bash
 CIDIR=$(dirname $(readlink -fn $0))
+REALTIME=0
 source $CIDIR/ci.functions
 ASTETCDIR=$DESTDIR/etc/asterisk
 
 pushd $TESTSUITE_DIR
 
 ./cleanup-test-remnants.sh
+
+if [ $REALTIME -eq 0 ] ; then
+	$CIDIR/setupRealtime.sh
+fi
+
 export PYTHONPATH=./lib/python/
 echo "Running tests ${TEST_COMMAND}"
 ./runtests.py --cleanup ${TEST_COMMAND} | contrib/scripts/pretty_print --no-color --no-timer --term-width=120 --show-errors || :
diff --git a/tests/CI/setupRealtime.sh b/tests/CI/setupRealtime.sh
new file mode 100755
index 0000000..01593a1
--- /dev/null
+++ b/tests/CI/setupRealtime.sh
@@ -0,0 +1,121 @@
+#!/usr/bin/env bash
+CIDIR=$(dirname $(readlink -fn $0))
+source $CIDIR/ci.functions
+
+set -e
+
+cat >test-config.yaml <<EOF
+	global-settings:
+	    test-configuration: config-realtime
+
+	    condition-definitions:
+	        -
+	            name: 'threads'
+	            pre:
+	                typename: 'thread_test_condition.ThreadPreTestCondition'
+	            post:
+	                typename: 'thread_test_condition.ThreadPostTestCondition'
+	                related-type: 'thread_test_condition.ThreadPreTestCondition'
+	        -
+	            name: 'sip-dialogs'
+	            pre:
+	                typename: 'sip_dialog_test_condition.SipDialogPreTestCondition'
+	            post:
+	                typename: 'sip_dialog_test_condition.SipDialogPostTestCondition'
+	        -
+	            name: 'locks'
+	            pre:
+	                typename: 'lock_test_condition.LockTestCondition'
+	            post:
+	                typename: 'lock_test_condition.LockTestCondition'
+	        -
+	            name: 'file-descriptors'
+	            pre:
+	                typename: 'fd_test_condition.FdPreTestCondition'
+	            post:
+	                typename: 'fd_test_condition.FdPostTestCondition'
+	                related-type: 'fd_test_condition.FdPreTestCondition'
+	        -
+	            name: 'channels'
+	            pre:
+	                typename: 'channel_test_condition.ChannelTestCondition'
+	            post:
+	                typename: 'channel_test_condition.ChannelTestCondition'
+	        -
+	            name: 'sip-channels'
+	            pre:
+	                typename: 'sip_channel_test_condition.SipChannelTestCondition'
+	            post:
+	                typename: 'sip_channel_test_condition.SipChannelTestCondition'
+	        -
+	            name: 'memory'
+	            pre:
+	                typename: 'memory_test_condition.MemoryPreTestCondition'
+	            post:
+	                typename: 'memory_test_condition.MemoryPostTestCondition'
+	                related-type: 'memory_test_condition.MemoryPreTestCondition'
+
+	config-realtime:
+	    test-modules:
+	        modules:
+	            -
+	                typename: realtime_converter.RealtimeConverter
+	                config-section: realtime-config
+		
+	    realtime-config:
+	        username: "asterisk"
+	        host: "localhost"
+	        db: "asterisk"
+	        dsn: "asterisk-connector"
+EOF
+
+ASTTOP=$(readlink -fn $CIDIR/../../)
+
+cat >/tmp/config.ini <<-EOF
+	[alembic]
+	script_location = config
+	sqlalchemy.url = postgresql://asterisk@localhost/asterisk
+		
+	[loggers]
+	keys = root,sqlalchemy,alembic
+		
+	[handlers]
+	keys = console
+		
+	[formatters]
+	keys = generic
+		
+	[logger_root]
+	level = WARN
+	handlers = console
+	qualname =
+		
+	[logger_sqlalchemy]
+	level = WARN
+	handlers =
+	qualname = sqlalchemy.engine
+		
+	[logger_alembic]
+	level = INFO
+	handlers =
+	qualname = alembic
+		
+	[handler_console]
+	class = StreamHandler
+	args = (sys.stderr,)
+	level = NOTSET
+	formatter = generic
+		
+	[formatter_generic]
+	format = %(levelname)-5.5s [%(name)s] %(message)s
+	datefmt = %H:%M:%S
+EOF
+
+pushd $ASTTOP/contrib/ast-db-manage
+if [ -x /usr/local/bin/postgresql-start ] ; then
+	/usr/local/bin/postgresql-start
+fi
+psql --username=asterisk --host=localhost --db=asterisk --command='DROP OWNED BY asterisk CASCADE'
+alembic -c /tmp/config.ini upgrade head
+rm -rf /tmp/config.ini || :
+popd

-- 
To view, visit https://gerrit.asterisk.org/9448
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6dc8ab1679b3505c6dde1d47e1b9276df47814f8
Gerrit-Change-Number: 9448
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180716/c7d873cc/attachment-0001.html>


More information about the asterisk-code-review mailing list