Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
M
MEC Robot Test Suite
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MEC - Multi-access Edge Computing
MEC Robot Test Suite
Commits
2a7e4578
Commit
2a7e4578
authored
Nov 05, 2019
by
Elian Kraja
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding MockServerLibrary to the dockerFile. Fixing running process
parent
e681c0a7
Pipeline
#2715
passed with stage
in 0 seconds
Changes
4
Pipelines
8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
15 deletions
+68
-15
mockserverlibrary.patch
extensions/mockserverlibrary.patch
+59
-0
Dockerfile
scripts/docker/Dockerfile
+6
-2
run-all.bash
scripts/run-all.bash
+3
-3
variables.txt
variables.txt
+0
-10
No files found.
extensions/mockserverlibrary.patch
0 → 100644
View file @
2a7e4578
diff --git a/src/MockServerLibrary/library.py b/src/MockServerLibrary/library.py
index a9e6227..7ba1eed 100644
--- a/src/MockServerLibrary/library.py
+++ b/src/MockServerLibrary/library.py
@@ -66,6 +66,9 @@ class MockServerLibrary(object):
match_type = 'STRICT' if exact else 'ONLY_MATCHING_FIELDS'
req['body'] = {'type': body_type, 'json': json.dumps(body), 'matchType': match_type}
+ if body_type is 'JSON_SCHEMA' and body:
+ req['body'] = {'type': body_type, 'json': json.dumps(body)}
+
return req
def create_mock_response(self, status_code, headers=None, body_type='JSON', body=None):
@@ -97,6 +100,42 @@ class MockServerLibrary(object):
return rsp
+ def create_mock_http_forward(self, path, delay=1, unit='SECONDS'):
+ """Creates a mock http override forward to be used by mockserver.
+
+ Returns the http forward in a dictionary format.
+
+ `path` is the new url where to forward the request
+
+ `delay` is the delay of the forward action
+
+ `unit` is the unit of the delay time (default "SECONDS")
+ """
+ fwd = {}
+ fwd['httpRequest'] = {'path': path}
+ fwd['delay'] = {'timeUnit': unit, 'value': delay}
+
+ return fwd
+
+ def create_mock_expectation_with_http_forward(self, request, forward, count=1, unlimited=True):
+ """Creates a mock expectation with request and forward action to be used by mockserver.
+
+ `request` is a mock request matcher in a dictionary format.
+
+ `forward` is a mock forward in a dictionary format.
+
+ `count` is the number of expected requests
+
+ `unlimited` is a boolean value which, if enabled, allows unspecified number of
+ requests to reply to
+ """
+ data = {}
+ data['httpRequest'] = request
+ data['httpOverrideForwardedRequest'] = forward
+ data['times'] = {'remainingTimes': int(count), 'unlimited': unlimited}
+
+ self.create_mock_expectation_with_data(data)
+
def create_mock_expectation(self, request, response, count=1, unlimited=True):
"""Creates a mock expectation to be used by mockserver.
scripts/docker/Dockerfile
View file @
2a7e4578
...
...
@@ -13,7 +13,7 @@ ARG ssh_prv_key
RUN
DEBIAN_FRONTEND
=
noninteractive apt update
\
&&
apt
install
python3
-y
\
&&
apt
install
python3
git
-y
\
&&
apt
install
python3-pip
-y
\
&&
apt
install
openssh-server
-y
\
&&
DEBIAN_FRONTEND
=
noninteractive apt-get autoremove
--purge
-y
\
...
...
@@ -42,7 +42,11 @@ RUN pip3 install robotframework
RUN
DEBIAN_FRONTEND
=
noninteractive
\
&&
cd
/home/etsi/dev/robot
\
&&
pip3
install
-r
requirements.txt
\
&&
chmod
+x /home/etsi/dev/robot/scripts/
*
&&
chmod
+x /home/etsi/dev/robot/scripts/
*
\
&&
git clone https://github.com/etsi-cti-admin/robotframework-mockserver
\
&&
cd
robotframework-mockserver
\
&&
patch
-p1
< ../extensions/mockserverlibrary.patch
\
&&
python3
-m
pip
install
-e
.
CMD
tail -f /dev/null
...
...
scripts/run-all.bash
View file @
2a7e4578
...
...
@@ -23,15 +23,15 @@ if [ "${ERRORS}" -eq 0 ]; then
fi
if
[
!
-z
logs/errors.log
]
;
then
if
[
-f
logs/errors.log
]
;
then
cat
logs/errors.log
fi
if
[
!
-z
logs/failures.log
]
;
then
if
[
-f
logs/failures.log
]
;
then
cat
logs/failures.log
fi
if
[
!
-z
logs/erros.log
]
||
[
!
-z
logs.failures.log
]
;
then
if
[
-f
logs/erros.log
]
||
[
-f
logs.failures.log
]
;
then
echo
"Errors are found. Job failed"
exit
1
fi
...
...
variables.txt
deleted
100644 → 0
View file @
e681c0a7
*** Variables ***
MEC_SERVER_SCHEMA = "http"
MEC_SERVER_HOST = "localhost"
MEC_SERVER_PORT = 8000
MEC_SERVER_SSL_VERITY = "false"
MEC_SERVER_IUT = "{}://{}:{}".format(MEC_SERVER_SCHEMA, MEC_SERVER_HOST, MEC_SERVER_PORT)
JSONS_SCHEMAS = "schemas"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment