Commit 02d5f953 authored by Robert Schmidt's avatar Robert Schmidt

Add simple unit test cases for Deployment, including instructions

parent 25f7f61d
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.
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()
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
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment