Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
ce8c8ea4
Verified
Commit
ce8c8ea4
authored
1 year ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
update iptrunk creation test
parent
c1cd83f6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!96
Make use of new callback step for external provisioning
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/__init__.py
+21
-0
21 additions, 0 deletions
test/__init__.py
test/workflows/iptrunk/test_create_iptrunk.py
+10
-32
10 additions, 32 deletions
test/workflows/iptrunk/test_create_iptrunk.py
with
31 additions
and
32 deletions
test/__init__.py
+
21
−
0
View file @
ce8c8ea4
from
uuid
import
uuid4
LSO_RESULT_SUCCESS
=
{
"
callback_result
"
:
{
"
status
"
:
"
success
"
,
"
job_id
"
:
str
(
uuid4
()),
"
output
"
:
"
parsed_output
"
,
"
return_code
"
:
0
,
}
}
LSO_RESULT_FAILURE
=
{
"
callback_result
"
:
{
"
status
"
:
"
failure
"
,
"
job_id
"
:
str
(
uuid4
()),
"
output
"
:
"
parsed_output
"
,
"
return_code
"
:
1
,
}
}
USER_CONFIRM_EMPTY_FORM
=
[{}]
This diff is collapsed.
Click to expand it.
test/workflows/iptrunk/test_create_iptrunk.py
+
10
−
32
View file @
ce8c8ea4
import
uuid
from
os
import
PathLike
from
unittest.mock
import
patch
...
...
@@ -9,6 +8,7 @@ from gso.products.product_blocks.iptrunk import IptrunkType, PhyPortCapacity
from
gso.services.crm
import
customer_selector
,
get_customer_by_name
from
gso.services.subscriptions
import
get_product_id_by_name
from
gso.utils.helpers
import
LAGMember
from
test
import
LSO_RESULT_SUCCESS
,
LSO_RESULT_FAILURE
,
USER_CONFIRM_EMPTY_FORM
from
test.services.conftest
import
MockedNetboxClient
from
test.workflows
import
(
assert_aborted
,
...
...
@@ -17,8 +17,7 @@ from test.workflows import (
assert_suspended
,
extract_state
,
resume_workflow
,
run_workflow
,
user_accept_and_assert_suspended
,
run_workflow
,
assert_failed
,
)
...
...
@@ -110,18 +109,9 @@ def test_successful_iptrunk_creation_with_standard_lso_result(
initial_site_data
=
[{
"
product
"
:
product_id
},
*
input_form_wizard_data
]
result
,
process_stat
,
step_log
=
run_workflow
(
"
create_iptrunk
"
,
initial_site_data
)
standard_lso_result
=
{
"
callback_result
"
:
{
"
status
"
:
"
success
"
,
"
job_id
"
:
str
(
uuid
.
uuid4
()),
"
output
"
:
"
parsed_output
"
,
"
return_code
"
:
0
,
}
}
for
_
in
range
(
6
):
assert_awaiting_callback
(
result
)
result
,
step_log
=
resume_workflow
(
process_stat
,
step_log
,
input_data
=
standard_lso_result
)
result
,
step_log
=
resume_workflow
(
process_stat
,
step_log
,
input_data
=
LSO_RESULT_SUCCESS
)
assert_suspended
(
result
)
result
,
step_log
=
resume_workflow
(
process_stat
,
step_log
,
input_data
=
[{}])
...
...
@@ -160,26 +150,14 @@ def test_iptrunk_creation_fails_when_lso_return_code_is_one(
initial_site_data
=
[{
"
product
"
:
product_id
},
*
input_form_wizard_data
]
result
,
process_stat
,
step_log
=
run_workflow
(
"
create_iptrunk
"
,
initial_site_data
)
assert_suspended
(
result
)
standard_lso_result
=
{
"
pp_run_results
"
:
{
"
status
"
:
"
ok
"
,
"
job_id
"
:
"
random_job_id
"
,
"
output
"
:
"
parsed_output
"
,
"
return_code
"
:
1
,
},
"
confirm
"
:
"
ACCEPTED
"
,
}
attempts
=
3
for
_
in
range
(
0
,
attempts
-
1
):
result
,
step_log
=
user_accept_and_assert_suspended
(
process_stat
,
step_log
,
standard_lso_result
)
result
,
step_log
=
user_accept_and_assert_suspended
(
process_stat
,
step_log
,
[{},
{}])
assert_awaiting_callback
(
result
)
result
,
step_log
=
resume_workflow
(
process_stat
,
step_log
,
input_data
=
LSO_RESULT_SUCCESS
)
assert_suspended
(
result
)
result
,
step_log
=
resume_workflow
(
process_stat
,
step_log
,
input_data
=
USER_CONFIRM_EMPTY_FORM
)
result
,
step_log
=
user_accept_and_assert_suspended
(
process_stat
,
step_log
,
standard_lso_
result
)
result
,
step_log
=
resume_workflow
(
process_stat
,
step_log
,
[{},
{}]
)
assert_
abort
ed
(
result
)
assert_awaiting_callback
(
result
)
result
,
step_log
=
resume_workflow
(
process_stat
,
step_log
,
input_data
=
LSO_RESULT_FAILURE
)
assert_
fail
ed
(
result
)
assert
mock_provision_ip_trunk
.
call_count
==
attempts
assert
mock_check_ip_trunk
.
call_count
==
0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment