diff --git a/kuksa-val-server/test/stresstest/config.ini b/kuksa-val-server/test/stresstest/config.ini index a3cd71058..c7bec0b4e 100644 --- a/kuksa-val-server/test/stresstest/config.ini +++ b/kuksa-val-server/test/stresstest/config.ini @@ -3,8 +3,8 @@ ip=127.0.0.1 port=8090 insecure=false -token=../../kuksa_certificates/jwt/all-read-write.json.token +token=../../../kuksa_certificates/jwt/all-read-write.json.token timeout=0.1 -certificate=../../kuksa_certificates/Client.pem -key=../../kuksa_certificates/Client.key -cacertificate=../../kuksa_certificates/CA.pem +certificate=../../../kuksa_certificates/Client.pem +#key=../../../kuksa_certificates/Client.key +root_ca_path=../../../kuksa_certificates/CA.pem diff --git a/kuksa-val-server/test/stresstest/stress.py b/kuksa-val-server/test/stresstest/stress.py index fd6faf34c..192bdd543 100644 --- a/kuksa-val-server/test/stresstest/stress.py +++ b/kuksa-val-server/test/stresstest/stress.py @@ -23,16 +23,19 @@ import stressClient vissClient = stressClient.StressClient() -count=0 +count = 0 -print("VSS Server : {}".format(vissClient.commThread.serverIP+':'+str(vissClient.commThread.serverPort))) -print("JWT token file : {}".format(vissClient.commThread.tokenfile)) +print("VSS Server : {}".format(vissClient.commThread.backend.serverIP + ':' + + str(vissClient.commThread.backend.serverPort))) +print("JWT token file : {}".format(vissClient.commThread.backend.token_or_tokenfile)) print("Timeout [s] : {}".format(vissClient.commThread.timeout)) while True: - vissClient.commThread.setValue("Vehicle.OBD.EngineLoad", (count%110)+1,timeout=vissClient.commThread.timeout) - vissClient.commThread.setValue("Vehicle.Speed", count,timeout=vissClient.commThread.timeout) - vissClient.commThread.setValue("Vehicle.Cabin.Door.Row1.Right.Shade.Switch", "Open",timeout=vissClient.commThread.timeout) - vissClient.commThread.getValue("Vehicle.Speed",vissClient.commThread.timeout) - + vissClient.commThread.setValue("Vehicle.OBD.EngineLoad", str((count % 110)+1), + timeout=vissClient.commThread.timeout) + vissClient.commThread.setValue("Vehicle.Speed", str(count), timeout=vissClient.commThread.timeout) + vissClient.commThread.setValue("Vehicle.Cabin.Door.Row1.Right.Shade.Switch", "Open", + timeout=vissClient.commThread.timeout) + vissClient.commThread.getValue("Vehicle.Speed", vissClient.commThread.timeout) + time.sleep(vissClient.commThread.timeout) diff --git a/kuksa-val-server/test/stresstest/stressClient.py b/kuksa-val-server/test/stresstest/stressClient.py index 19fd8be6c..78e70f2ce 100644 --- a/kuksa-val-server/test/stresstest/stressClient.py +++ b/kuksa-val-server/test/stresstest/stressClient.py @@ -18,11 +18,9 @@ import configparser import sys -import argparse -import time -from pickle import FALSE -from kuksa_client import * +from kuksa_client import KuksaClientThread + class StressClient(): @@ -34,25 +32,25 @@ def getConfig(self): config = configparser.ConfigParser() config.read('config.ini') - vsscfg = config['vss'] #get data from config file + vsscfg = config['vss'] # get data from config file return vsscfg - def connect(self,cfg): + def connect(self, cfg): """Connect to the VISS Server""" if hasattr(self, "commThread"): - if self.commThread != None: + if self.commThread is not None: self.commThread.stop() self.commThread = None - self.commThread = KuksaClientThread(self.cfg) #make new thread - self.commThread.start() #start thread + self.commThread = KuksaClientThread(self.cfg) # make new thread + self.commThread.start() # start thread def __init__(self): self.cfg = self.getConfig() try: self.connect(self.cfg) - self.commThread.timeout = self.cfg.getfloat("timeout", fallback=0.1) #get necessary timeout for stresstest - self.commThread.authorize(token=self.commThread.tokenfile) - except: + self.commThread.authorize() + self.commThread.timeout = self.cfg.getfloat("timeout", fallback=0.1) # get necessary timeout for stresstest + except Exception: print("Could not connect successfully") sys.exit(-1) diff --git a/kuksa-val-server/test/unit-test/SubscriptionHandlerTests.cpp b/kuksa-val-server/test/unit-test/SubscriptionHandlerTests.cpp index c7836b6a9..22f3e79e0 100644 --- a/kuksa-val-server/test/unit-test/SubscriptionHandlerTests.cpp +++ b/kuksa-val-server/test/unit-test/SubscriptionHandlerTests.cpp @@ -19,7 +19,7 @@ * Robert Bosch GmbH **********************************************************************/ -#include +#include #define BOOST_BIND_GLOBAL_PLACEHOLDERS #include @@ -34,8 +34,9 @@ #include #include #include +#include -#include +#include #include #include @@ -136,7 +137,7 @@ BOOST_AUTO_TEST_CASE(Given_SingleClient_When_SubscribeRequestOnDifferentPaths_Sh VSSPath::fromVSSGen1("Vehicle.Acceleration"), VSSPath::fromVSSGen1("Vehicle.Media"), VSSPath::fromVSSGen1("Vehicle.Acceleration.Lateral") }; - + // expectations @@ -204,7 +205,7 @@ BOOST_AUTO_TEST_CASE(Given_MultipleClients_When_SubscribeRequestOnSinglePath_Sha MOCK_EXPECT(dbMock->pathIsReadable) .exactly(clientNum) .with(vsspath) - .returns(true); + .returns(true); MOCK_EXPECT(accCheckMock->checkReadAccess) .exactly(clientNum) .with(mock::any, vsspath) @@ -321,7 +322,7 @@ BOOST_AUTO_TEST_CASE(Given_SingleClient_When_UnsubscribeRequestOnDifferentPaths_ MOCK_EXPECT(dbMock->pathIsReadable) .once() .with(vsspath[index]) - .returns(true); + .returns(true); MOCK_EXPECT(accCheckMock->checkReadAccess) .once() .with(mock::any, vsspath[index]) @@ -380,7 +381,7 @@ BOOST_AUTO_TEST_CASE(Given_MultipleClients_When_Unsubscribe_Shall_UnsubscribeAll MOCK_EXPECT(dbMock->pathIsReadable) .exactly(clientNum) .with(vsspath) - .returns(true); + .returns(true); MOCK_EXPECT(accCheckMock->checkReadAccess) .exactly(clientNum) .with(mock::any, vsspath) @@ -529,7 +530,7 @@ BOOST_AUTO_TEST_CASE(Given_MultipleClients_When_MultipleSignalsSubscribedAndUpda MOCK_EXPECT(dbMock->pathIsReadable) .exactly(channelCount) .with(vsspath[index]) - .returns(true); + .returns(true); MOCK_EXPECT(accCheckMock->checkReadAccess) .exactly(channelCount) .with(mock::any, vsspath[index]) @@ -627,7 +628,7 @@ BOOST_AUTO_TEST_CASE(Given_MultipleClients_When_MultipleSignalsSubscribedAndUpda MOCK_EXPECT(dbMock->pathIsReadable) .exactly(channelCount) .with(vsspath[index]) - .returns(true); + .returns(true); MOCK_EXPECT(accCheckMock->checkReadAccess) .exactly(channelCount) .with(mock::any, vsspath[index])