Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
spbro
OpenXG-RAN
Commits
02d5f953
Commit
02d5f953
authored
Sep 23, 2024
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add simple unit test cases for Deployment, including instructions
parent
25f7f61d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
0 deletions
+82
-0
ci-scripts/tests/README.md
ci-scripts/tests/README.md
+11
-0
ci-scripts/tests/deployment.py
ci-scripts/tests/deployment.py
+47
-0
ci-scripts/tests/simple-dep/docker-compose.yml
ci-scripts/tests/simple-dep/docker-compose.yml
+12
-0
ci-scripts/tests/simple-fail/docker-compose.yml
ci-scripts/tests/simple-fail/docker-compose.yml
+12
-0
No files found.
ci-scripts/tests/README.md
0 → 100644
View file @
02d5f953
In this directory and subdirectories are various CI code test cases and helper
scripts.
# Unit test
There are some unit tests. From the parent directory, i.e.,
`ci-scripts/`
,
start with
python tests/deployment.py -v
It will indicate if all tests passed.
ci-scripts/tests/deployment.py
0 → 100644
View file @
02d5f953
import
sys
import
logging
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
stream
=
sys
.
stdout
,
format
=
"[%(asctime)s] %(levelname)8s: %(message)s"
)
import
os
os
.
system
(
f'rm -rf cmake_targets'
)
os
.
system
(
f'mkdir -p cmake_targets/log'
)
import
unittest
sys
.
path
.
append
(
'./'
)
# to find OAI imports below
import
cls_oai_html
import
cls_oaicitest
import
cls_containerize
import
ran
class
TestDeploymentMethods
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
html
=
cls_oai_html
.
HTMLManagement
()
self
.
html
.
testCaseId
=
"000000"
self
.
ci
=
cls_oaicitest
.
OaiCiTest
()
self
.
cont
=
cls_containerize
.
Containerize
()
self
.
ran
=
ran
.
RANManagement
()
self
.
cont
.
yamlPath
[
0
]
=
'tests/simple-dep/'
self
.
cont
.
eNB_serverId
[
0
]
=
'0'
self
.
cont
.
eNBIPAddress
=
'localhost'
self
.
cont
.
eNBUserName
=
None
self
.
cont
.
eNBPassword
=
None
self
.
cont
.
eNBSourceCodePath
=
os
.
getcwd
()
def
test_deploy
(
self
):
self
.
cont
.
DeployObject
(
self
.
html
)
self
.
assertEqual
(
self
.
cont
.
exitStatus
,
0
)
self
.
cont
.
UndeployObject
(
self
.
html
,
self
.
ran
)
def
test_deployfails
(
self
):
old
=
self
.
cont
.
yamlPath
self
.
cont
.
yamlPath
[
0
]
=
'tests/simple-fail/'
self
.
cont
.
DeployObject
(
self
.
html
)
self
.
assertEqual
(
self
.
cont
.
exitStatus
,
1
)
self
.
cont
.
UndeployObject
(
self
.
html
,
self
.
ran
)
self
.
cont
.
yamlPath
=
old
if
__name__
==
'__main__'
:
unittest
.
main
()
ci-scripts/tests/simple-dep/docker-compose.yml
0 → 100644
View file @
02d5f953
services
:
test
:
image
:
ubuntu:jammy
container_name
:
test_container
cap_drop
:
-
ALL
entrypoint
:
/bin/bash -c "sleep infinity"
healthcheck
:
test
:
/bin/bash -c "true"
interval
:
1s
timeout
:
1s
retries
:
1
ci-scripts/tests/simple-fail/docker-compose.yml
0 → 100644
View file @
02d5f953
services
:
test
:
image
:
ubuntu:jammy
container_name
:
test_container
cap_drop
:
-
ALL
entrypoint
:
/bin/bash -c "false"
healthcheck
:
test
:
/bin/bash -c "true"
interval
:
1s
timeout
:
1s
retries
:
1
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