[457373] Fix tests when compiled with WITH_TLS=no.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=457373
This commit is contained in:
Roger A. Light 2015-01-16 21:39:42 +00:00
parent 9332a731bf
commit 4c72b2dd45
5 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,3 @@
port 1888
password_file 01-connect-uname-password-success-no-tls.pwfile
allow_anonymous false

View File

@ -0,0 +1 @@
user:password

View File

@ -0,0 +1,38 @@
#!/usr/bin/env python
# Test whether a connection is denied if it provides a correct username but
# incorrect password.
import subprocess
import socket
import time
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
if cmd_subfolder not in sys.path:
sys.path.insert(0, cmd_subfolder)
import mosq_test
rc = 1
keepalive = 10
connect_packet = mosq_test.gen_connect("connect-uname-pwd-test", keepalive=keepalive, username="user", password="password")
connack_packet = mosq_test.gen_connack(rc=0)
broker = mosq_test.start_broker(filename=os.path.basename(__file__))
try:
sock = mosq_test.do_client_connect(connect_packet, connack_packet)
sock.close()
rc = 0
finally:
broker.terminate()
broker.wait()
if rc:
(stdo, stde) = broker.communicate()
print(stde)
exit(rc)

View File

@ -1,3 +1,5 @@
include ../../config.mk
.PHONY: all clean test
.NOTPARALLEL:
@ -21,7 +23,12 @@ test : test-compile 01 02 03 04 05 06 07 08 09 10
./01-connect-anon-denied.py
./01-connect-uname-no-password-denied.py
./01-connect-uname-password-denied.py
ifeq ($(WITH_TLS),yes)
./01-connect-uname-password-success.py
else
./01-connect-uname-password-success-no-tls.py
endif
02 :
./02-subscribe-qos0.py
@ -68,6 +75,7 @@ test : test-compile 01 02 03 04 05 06 07 08 09 10
./07-will-null-topic.py
08 :
ifeq ($(WITH_TLS),yes)
./08-ssl-connect-no-auth.py
./08-ssl-connect-no-auth-wrong-ca.py
./08-ssl-connect-cert-auth.py
@ -80,6 +88,7 @@ test : test-compile 01 02 03 04 05 06 07 08 09 10
./08-ssl-bridge.py
./08-tls-psk-pub.py
./08-tls-psk-bridge.py
endif
09 :
./09-plugin-auth-unpwd-success.py

View File

@ -1,3 +1,5 @@
include ../../config.mk
.PHONY: all test test-compile test-compile-c test-compile-cpp c cpp
.NOTPARALLEL:
@ -36,11 +38,13 @@ c cpp : test-compile
./03-publish-b2c-qos1.py $@/03-publish-b2c-qos1.test
./03-publish-b2c-qos2.py $@/03-publish-b2c-qos2.test
./04-retain-qos0.py $@/04-retain-qos0.test
ifeq ($(WITH_TLS),yes)
./08-ssl-connect-no-auth.py $@/08-ssl-connect-no-auth.test
./08-ssl-connect-cert-auth.py $@/08-ssl-connect-cert-auth.test
./08-ssl-connect-cert-auth-enc.py $@/08-ssl-connect-cert-auth-enc.test
./08-ssl-bad-cacert.py $@/08-ssl-bad-cacert.test
./08-ssl-fake-cacert.py $@/08-ssl-fake-cacert.test
endif
./09-util-topic-matching.py $@/09-util-topic-matching.test
./09-util-topic-tokenise.py $@/09-util-topic-tokenise.test