Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin-telecom
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paul Graydon
wendelin-telecom
Commits
41bc8fdc
Commit
41bc8fdc
authored
Oct 21, 2024
by
Paul Graydon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wendelin_telecom_test: Update tests
parent
de82baa9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
22 deletions
+77
-22
bt5/wendelin_telecom_test/TestTemplateItem/portal_components/test.erp5.testWendelinTelecom.py
...teItem/portal_components/test.erp5.testWendelinTelecom.py
+77
-22
No files found.
bt5/wendelin_telecom_test/TestTemplateItem/portal_components/test.erp5.testWendelinTelecom.py
View file @
41bc8fdc
...
...
@@ -112,7 +112,14 @@ class WendelinTelecomTest(SecurityTestCase):
tag_comp_id_seed
=
generateRandomString
(
length
=
4
,
only_digits
=
True
)
if
tag_enb_id_seed
is
None
:
tag_enb_id_seed
=
generateRandomString
(
length
=
5
,
hexadecimal
=
True
)
ors_tag
=
'ors%s_COMP-%s_e0x%sTest'
%
(
tag_hostname_seed
,
tag_comp_id_seed
,
tag_enb_id_seed
)
ors_tag
=
'ors%s'
%
tag_hostname_seed
# Only include a subsequent section if a non-empty string is explicitly provided for it
if
tag_comp_id_seed
!=
''
:
ors_tag
+=
'_COMP-%s'
%
tag_comp_id_seed
if
tag_enb_id_seed
!=
''
:
ors_tag
+=
'_e0x%s'
%
tag_enb_id_seed
ors_tag
+=
'Test'
response
=
self
.
portal
.
ERP5Site_registerOrs
(
ors_tag
)
self
.
tic
()
...
...
@@ -476,12 +483,13 @@ class WendelinTelecomTest(SecurityTestCase):
self
.
assertTrue
(
new_project_item_dict
[
'project'
]
is
None
)
self
.
assertTrue
(
new_project_item_dict
[
'client_user'
]
==
project_item_dict
[
'client_user'
])
def
test_03_
register
Ors
(
self
):
def
test_03_
1_registerValid
Ors
(
self
):
'''
Test the script called during slave instantiation in SlapOS by an ORS to automatically register itself.
Check all
detecte
d cases.
Check all
vali
d cases.
'''
# Call the script with an initial seed setup
tag_hostname_seed
=
generateRandomString
(
length
=
3
,
only_digits
=
True
)
tag_comp_id_seed
=
generateRandomString
(
length
=
4
,
only_digits
=
True
)
tag_enb_id_seed
=
generateRandomString
(
length
=
5
,
hexadecimal
=
True
)
...
...
@@ -512,25 +520,6 @@ class WendelinTelecomTest(SecurityTestCase):
self
.
assertTrue
(
'error_msg'
in
response_dict
)
self
.
assertTrue
(
response_dict
[
'error_msg'
]
==
"ORS with tag %s already exists."
%
ors_item_dict
[
'data_acquisition_unit'
].
getReference
())
# Generate a new seed that will cause the tag to be invalid
invalid_tag_hostname_seed
=
'invalid_hostname'
# Call the script a third time with the new seed
# This should error out as the tag is invalid
invalid_ors_item_dict
=
self
.
registerOrs
(
tag_hostname_seed
=
invalid_tag_hostname_seed
,
tag_comp_id_seed
=
tag_comp_id_seed
,
tag_enb_id_seed
=
tag_enb_id_seed
)
# Parse the JSON response and check the error message
response_dict
=
json
.
loads
(
invalid_ors_item_dict
[
'response'
])
self
.
assertTrue
(
'error_msg'
in
response_dict
)
self
.
assertTrue
(
response_dict
[
'error_msg'
]
==
"Invalid ORS tag ors%s_COMP-%s_e0x%sTest found"
%
(
invalid_tag_hostname_seed
,
tag_comp_id_seed
,
tag_enb_id_seed
))
# Check that the Data Acquisition Unit and Data Supply have NOT been created
self
.
assertTrue
(
invalid_ors_item_dict
[
'data_acquisition_unit'
]
is
None
)
self
.
assertTrue
(
invalid_ors_item_dict
[
'data_supply'
]
is
None
)
# Now, link the original Data Supply to a client project
project_a_item_dict
=
self
.
registerOrsClientProject
()
project_a_url
=
project_a_item_dict
[
'project'
].
getRelativeUrl
()
...
...
@@ -546,6 +535,7 @@ class WendelinTelecomTest(SecurityTestCase):
)
# Check that the Data Acquisition Unit and Data Supply have been created
# And that the new Data Supply has automatically been linked to the project
self
.
assertTrue
(
new_enb_id_ors_item_dict
[
'data_acquisition_unit'
]
is
not
None
)
self
.
assertTrue
(
new_enb_id_ors_item_dict
[
'data_supply'
]
is
not
None
)
self
.
assertTrue
(
new_enb_id_ors_item_dict
[
'data_supply'
].
getDestinationProject
()
==
project_a_url
)
...
...
@@ -572,6 +562,71 @@ class WendelinTelecomTest(SecurityTestCase):
# it cannot be automatically decided to which project this version should be assigned to
self
.
assertTrue
(
another_enb_id_ors_item_dict
[
'data_supply'
].
getDestinationProject
()
is
None
)
# Generate a new set of seeds
new_tag_hostname_seed
=
generateRandomString
(
length
=
3
,
only_digits
=
True
)
new_tag_comp_id_seed
=
generateRandomString
(
length
=
4
,
only_digits
=
True
)
# Call the script with a tag that does not contain an eNB identifier
no_enb_id_ors_item_dict
=
self
.
registerOrs
(
tag_hostname_seed
=
new_tag_hostname_seed
,
tag_comp_id_seed
=
new_tag_comp_id_seed
,
tag_enb_id_seed
=
''
)
# Parse the JSON response and check that it is empty, indicating a success
response_dict
=
json
.
loads
(
no_enb_id_ors_item_dict
[
'response'
])
self
.
assertTrue
(
response_dict
==
{})
# Check that the Data Acquisition Unit and Data Supply have been created
self
.
assertTrue
(
no_enb_id_ors_item_dict
[
'data_acquisition_unit'
]
is
not
None
)
self
.
assertTrue
(
no_enb_id_ors_item_dict
[
'data_supply'
]
is
not
None
)
def
test_03_2_registerInvalidOrs
(
self
):
'''
Test the script called during slave instantiation in SlapOS by an ORS to automatically register itself.
Check all invalid cases.
'''
tag_hostname_seed
=
generateRandomString
(
length
=
3
,
only_digits
=
True
)
tag_comp_id_seed
=
generateRandomString
(
length
=
4
,
only_digits
=
True
)
tag_enb_id_seed
=
generateRandomString
(
length
=
5
,
hexadecimal
=
True
)
# Generate a hostname seed that will cause the tag to have too many underscores
too_long_tag_hostname_seed
=
'invalid_hostname'
# Call the script with this seed setup
# This should error out as the tag has too many underscore-separated sections
too_long_tag_ors_item_dict
=
self
.
registerOrs
(
tag_hostname_seed
=
too_long_tag_hostname_seed
,
tag_comp_id_seed
=
tag_comp_id_seed
,
tag_enb_id_seed
=
tag_enb_id_seed
)
# Parse the JSON response and check the error message
response_dict
=
json
.
loads
(
too_long_tag_ors_item_dict
[
'response'
])
self
.
assertTrue
(
'error_msg'
in
response_dict
)
self
.
assertTrue
(
response_dict
[
'error_msg'
]
==
"Invalid ORS tag ors%s_COMP-%s_e0x%sTest found"
\
%
(
too_long_tag_hostname_seed
,
tag_comp_id_seed
,
tag_enb_id_seed
))
# Check that the Data Acquisition Unit and Data Supply have NOT been created
self
.
assertTrue
(
too_long_tag_ors_item_dict
[
'data_acquisition_unit'
]
is
None
)
self
.
assertTrue
(
too_long_tag_ors_item_dict
[
'data_supply'
]
is
None
)
# Now, call the script with only the first section in the tag: 'orsXXX'
# This should error out as the tag has too few underscore-separated sections
too_long_tag_ors_item_dict
=
self
.
registerOrs
(
tag_hostname_seed
=
tag_hostname_seed
,
tag_comp_id_seed
=
''
,
tag_enb_id_seed
=
''
)
# Parse the JSON response and check the error message
response_dict
=
json
.
loads
(
too_long_tag_ors_item_dict
[
'response'
])
self
.
assertTrue
(
'error_msg'
in
response_dict
)
self
.
assertTrue
(
response_dict
[
'error_msg'
]
==
"Invalid ORS tag ors%sTest found"
%
tag_hostname_seed
)
# Check that the Data Acquisition Unit and Data Supply have NOT been created
self
.
assertTrue
(
too_long_tag_ors_item_dict
[
'data_acquisition_unit'
]
is
None
)
self
.
assertTrue
(
too_long_tag_ors_item_dict
[
'data_supply'
]
is
None
)
def
test_04_1_ingestValidOrsLogDataFromFluentd
(
self
,
data_key
=
"valid"
):
'''
Test a simple valid ORS log ingestion: simulate a fluentd gateway forwarding valid ORS logs to the platform,
...
...
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