[SEBA-449]
Makefile for running all XOS tests, used both by developers and
Jenkins jobs.
Includes llp's "pass over migration" #13204 patchset:
Add ability for core migration to be run/checked from outside of the repo
tree (useful in tests)
Change-Id: I47d027a5492a51273a92296e9da5310b8bc49a8c
diff --git a/lib/__init__.py b/lib/__init__.py
deleted file mode 100644
index b0fb0b2..0000000
--- a/lib/__init__.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
diff --git a/lib/xos-migrate/xosmigrate/main.py b/lib/xos-migrate/xosmigrate/main.py
index f8f5d6b..8d76197 100644
--- a/lib/xos-migrate/xosmigrate/main.py
+++ b/lib/xos-migrate/xosmigrate/main.py
@@ -293,12 +293,22 @@
help="The name of the folder containing the service in cord/orchestration/xos_services"
)
-parser.add_argument(
+pathgroup = parser.add_mutually_exclusive_group()
+
+pathgroup.add_argument(
"-r",
"--repo",
- default=get_abs_path("~/cord"),
+ default=get_abs_path("../.."),
dest="repo_root",
- help="The location of the folder containing the CORD repo root (default to ~/cord)"
+ help="Path to the CORD repo root (defaults to '../..'). Mutually exclusive with '--xos'."
+)
+
+pathgroup.add_argument(
+ "-x",
+ "--xos",
+ default=None,
+ dest="xos_root",
+ help="Path to directory of the XOS repo. Incompatible with '--repo' and only works for core migrations."
)
parser.add_argument(
@@ -330,10 +340,17 @@
print_banner(args.repo_root)
# find absolute path to the code
- xos_path = get_abs_path(os.path.join(args.repo_root, "orchestration/xos/xos/"))
+ if args.xos_root: # if args.xos_root is set, testing only the core
+ xos_path = get_abs_path(args.xos_root)
+ if args.service_names != ["core"]:
+ log.error("When using --xos, can only check the core models")
+ sys.exit(1)
+ else:
+ xos_path = get_abs_path(os.path.join(args.repo_root, "orchestration/xos/xos/"))
+ service_base_dir = get_abs_path(os.path.join(xos_path, "../../xos_services/"))
+ service_dest_dir = get_abs_path(os.path.join(xos_path, "services/"))
+
core_dir = get_abs_path(os.path.join(xos_path, "core/models/"))
- service_base_dir = get_abs_path(os.path.join(xos_path, "../../xos_services/"))
- service_dest_dir = get_abs_path(os.path.join(xos_path, "services/"))
# we need to append the xos folder to sys.path
original_sys_path = sys.path
diff --git a/lib/xos-synchronizer/tox.ini b/lib/xos-synchronizer/tox.ini
index 2e09d5e..b98744a 100644
--- a/lib/xos-synchronizer/tox.ini
+++ b/lib/xos-synchronizer/tox.ini
@@ -25,18 +25,18 @@
commands =
nose2 -c tox.ini --verbose --junit-xml
-; should widen flake8 to also cover xos-synchronizer-tests
+; FIXME: should widen flake8 to also cover xos-synchronizer-tests
flake8 xossynchronizer
[flake8]
-; F821, ignoring undefined names would be valuable, but synchronizer dynamically loads them
-; W503, allow breaks before binary operators (see: https://github.com/PyCQA/pycodestyle/issues/498)
-;ignore = F821,W503
max-line-length = 119
[unittest]
plugins=nose2.plugins.junitxml
+[junit-xml]
+path=nose2-results.xml
+
[coverage]
always-on = True
coverage = xossynchronizer