Skip to content

Commit fddcbd2

Browse files
committed
CI: run Python tests
1 parent 3fda8d5 commit fddcbd2

File tree

4 files changed

+20
-86
lines changed

4 files changed

+20
-86
lines changed

.github/workflows/main.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ on:
88
jobs:
99
linux-glibc:
1010
runs-on: ubuntu-latest
11+
services:
12+
ircd:
13+
image: linuxserver/ngircd
14+
ports:
15+
- 6667:6667
16+
xmppd:
17+
image: cr.spectrum.im/spectrumim/prosody:master
18+
ports:
19+
- 5222:5222
20+
- 5347:5347
21+
env:
22+
LOCAL: admin
23+
DOMAIN: localhost
24+
PASSWORD: secret
1125

1226
steps:
1327
- uses: actions/checkout@v2

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ ARG APT_LISTCHANGES_FRONTEND=none
2828

2929
WORKDIR /spectrum2
3030

31-
RUN apt-get install --no-install-recommends -y prosody ngircd python3-sleekxmpp python3-dateutil python3-dnspython libcppunit-dev purple-xmpp-carbons libglib2.0-dev psmisc
31+
RUN apt-get install --no-install-recommends -y python3-sleekxmpp python3-dateutil python3-dnspython libcppunit-dev purple-xmpp-carbons libglib2.0-dev psmisc
3232

3333
RUN cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TESTS=ON -DENABLE_QT4=OFF -DCMAKE_UNITY_BUILD=ON . && make -j4
3434

35-
ENTRYPOINT ["make", "extended_test"]
35+
ENTRYPOINT ["make", "test"]
3636

3737
FROM base as test-clang
3838

tests/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,5 @@ if(ENABLE_TESTS)
66
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/libtransport/libtransport_test
77
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests_output
88
)
9-
10-
add_custom_target(extended_test
11-
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/libtransport/libtransport_test
12-
COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/start.py
13-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests_output
14-
)
15-
169
endif()
1710

tests/start.py

Lines changed: 4 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ def start(self, TestCaseFile):
176176
return ret
177177

178178
def pre_test(self):
179-
os.system("../../spectrum/src/spectrum2 -n ./" + self.config + " > spectrum2.log &")
179+
pass
180180

181181
def post_test(self):
182-
os.system("killall -w spectrum2")
182+
pass
183183

184184
class LibcommuniServerModeSingleServerConf(BaseTest):
185185
def __init__(self):
@@ -191,29 +191,11 @@ def skip_test(self, test):
191191
return True
192192
return False
193193

194-
def pre_test(self):
195-
BaseTest.pre_test(self)
196-
os.system("/usr/sbin/ngircd -f ../libcommuni/ngircd.conf &")
197-
198-
def post_test(self):
199-
os.system("killall -w ngircd 2>/dev/null")
200-
os.system("killall -w spectrum2_libcommuni_backend 2>/dev/null")
201-
BaseTest.post_test(self)
202-
203194
class LibcommuniServerModeConf(BaseTest):
204195
def __init__(self):
205196
BaseTest.__init__(self, "../libcommuni/irc_test2.cfg", True, "#channel%localhost@localhost")
206197
self.directory = "../libcommuni/"
207198

208-
def pre_test(self):
209-
BaseTest.pre_test(self)
210-
os.system("/usr/sbin/ngircd -f ../libcommuni/ngircd.conf &")
211-
212-
def post_test(self):
213-
os.system("killall -w ngircd 2>/dev/null")
214-
os.system("killall -w spectrum2_libcommuni_backend 2>/dev/null")
215-
BaseTest.post_test(self)
216-
217199
class JabberServerModeConf(BaseTest):
218200
def __init__(self):
219201
BaseTest.__init__(self, "../libpurple_jabber/jabber_test.cfg", True, "room%conference.localhost@localhostxmpp")
@@ -233,68 +215,13 @@ def skip_test(self, test):
233215
def pre_test(self):
234216
os.system("cp ../libpurple_jabber/prefs.xml ./ -f >/dev/null")
235217
BaseTest.pre_test(self)
236-
os.system("prosody --config ../libpurple_jabber/prosody.cfg.lua >prosody.log &")
237-
time.sleep(3)
238-
os.system("../../spectrum_manager/src/spectrum2_manager -c ../libpurple_jabber/manager.conf localhostxmpp register client%localhost@localhostxmpp client@localhost password 2>/dev/null >/dev/null")
239-
os.system("../../spectrum_manager/src/spectrum2_manager -c ../libpurple_jabber/manager.conf localhostxmpp register responder%localhost@localhostxmpp responder@localhost password 2>/dev/null >/dev/null")
240-
241-
def post_test(self):
242-
os.system("killall -w -r lua.* 2>/dev/null")
243-
os.system("killall -w spectrum2_libpurple_backend 2>/dev/null")
244-
BaseTest.post_test(self)
245-
246-
class JabberSlackServerModeConf(BaseTest):
247-
def __init__(self):
248-
BaseTest.__init__(self, "../slack_jabber/jabber_slack_test.cfg", True, "room%conference.localhost@localhostxmpp")
249-
self.directory = "../slack_jabber/"
250-
self.client_jid = "client@localhost"
251-
self.client_room = "[email protected]"
252-
# Implicitly forces responder to connect to slack.com instead of localhost
253-
# by passing a nonstandard responder_roompassword
254-
self.responder_jid = "[email protected]"
255-
self.responder_password = "spectrum2tests.e2zJwtKjLhLmt14VsMKq"
256-
self.responder_room = "[email protected]"
257-
self.responder_nick = "owner"
258-
self.responder_roompassword = "spectrum2tests.e2zJwtKjLhLmt14VsMKq"
259-
260-
def skip_test(self, test):
261-
os.system("cp ../slack_jabber/slack.sql .")
262-
if test.find("bad_password") != -1:
263-
print("Changing password to 'badpassword'")
264-
os.system("sqlite3 slack.sql \"UPDATE users SET password='badpassword' WHERE id=1\"")
265-
return False
266-
267-
def pre_test(self):
268-
BaseTest.pre_test(self)
269-
os.system("prosody --config ../slack_jabber/prosody.cfg.lua > prosody.log &")
270-
271-
def post_test(self):
272-
os.system("killall -w -r lua.* 2>/dev/null")
273-
os.system("killall -w spectrum2_libpurple_backend 2>/dev/null")
274-
BaseTest.post_test(self)
275-
276-
class TwitterServerModeConf(BaseTest):
277-
def __init__(self):
278-
BaseTest.__init__(self, "../twitter/twitter_test.cfg", True, "")
279-
self.directory = "../twitter/"
280-
self.client_password = "testpass123"
281-
282-
def skip_test(self, test):
283-
os.system("cp ../twitter/twitter.sql .")
284-
285-
def pre_test(self):
286-
BaseTest.pre_test(self)
287-
288-
def post_test(self):
289-
os.system("killall -w spectrum2_twitter_backend 2>/dev/null")
290-
BaseTest.post_test(self)
218+
os.system("spectrum2_manager localhostxmpp register client%localhost@localhostxmpp client@localhost password")
219+
os.system("spectrum2_manager localhostxmpp register responder%localhost@localhostxmpp responder@localhost password")
291220

292221
configurations = []
293222
configurations.append(LibcommuniServerModeSingleServerConf())
294223
configurations.append(LibcommuniServerModeConf())
295224
configurations.append(JabberServerModeConf())
296-
#configurations.append(JabberSlackServerModeConf())
297-
#configurations.append(TwitterServerModeConf())
298225

299226
exitcode = 0
300227

0 commit comments

Comments
 (0)