Skip to content

Commit

Permalink
chore(agw): 'nose' is replaced by 'pytest' for S1AP integration tests (
Browse files Browse the repository at this point in the history
…#13060)

* chore(agw): import commands are adapted

Signed-off-by: Marco Pfirrmann <marco.pfirrmann@tngtech.com>

* chore(agw): 'nose' is replaced by 'pytest' for S1AP integration tests

Signed-off-by: Marco Pfirrmann <marco.pfirrmann@tngtech.com>
  • Loading branch information
mpfirrmann committed Jul 15, 2022
1 parent 26f0162 commit a484080
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
12 changes: 6 additions & 6 deletions lte/gateway/python/integ_tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ $(PYTHON_BUILD)/setupinteg_env:
# TODO T21489739 - Don't sleep and don't stop after a failure
RESULTS_DIR := /var/tmp/test_results
ifdef enable-flaky-retry
FLAKY_CMD_ARGS := --with-flaky --force-flaky --no-flaky-report --max-runs=3 --min-passes=1
FLAKY_CMD_ARGS := --force-flaky --no-flaky-report --max-runs=3 --min-passes=1
else
FLAKY_CMD_ARGS :=
endif
define execute_test
echo "Running test: $(1)"
timeout --foreground -k 930s 900s sudo -E PATH=$(PATH) PYTHONPATH=$(PYTHONPATH):$(S1AP_TESTER_PYTHON_PATH) $(PYTHON_BUILD)/bin/nosetests $(FLAKY_CMD_ARGS) --with-xunit --xunit-file=$(RESULTS_DIR)/$(basename $(notdir $(1))).xml -x -s $(1) || (echo "fail" > $(MAGMA_ROOT)/test_status.txt && exit 1)
timeout --foreground -k 930s 900s sudo -E PATH=$(PATH) PYTHONPATH=$(PYTHONPATH):$(S1AP_TESTER_PYTHON_PATH) $(BIN)/pytest $(FLAKY_CMD_ARGS) --capture=tee-sys --junit-xml=$(RESULTS_DIR)/$(basename $(notdir $(1))).xml -x $(1) || (echo "fail" > $(MAGMA_ROOT)/test_status.txt && exit 1)
sleep 1
endef

.PHONY: precommit
precommit: $(PYTHON_BUILD)/setupinteg_env $(BIN)/nosetests
precommit: $(PYTHON_BUILD)/setupinteg_env $(BIN)/pytest
. $(PYTHON_BUILD)/bin/activate
ifdef TESTS
$(call execute_test,$(TESTS))
Expand All @@ -45,7 +45,7 @@ else
endif

.PHONY: integ_test
integ_test: $(PYTHON_BUILD)/setupinteg_env $(BIN)/nosetests
integ_test: $(PYTHON_BUILD)/setupinteg_env $(BIN)/pytest
. $(PYTHON_BUILD)/bin/activate
ifdef TESTS
$(call execute_test,$(TESTS))
Expand All @@ -55,7 +55,7 @@ else
endif

.PHONY: nonsanity
nonsanity: $(PYTHON_BUILD)/setupinteg_env $(BIN)/nosetests
nonsanity: $(PYTHON_BUILD)/setupinteg_env $(BIN)/pytest
. $(PYTHON_BUILD)/bin/activate
ifdef TESTS
$(call execute_test,$(TESTS))
Expand All @@ -66,4 +66,4 @@ endif
local_integ_test:
# check if magma services are running
systemctl is-active --quiet magma@magmad || (echo "Local integ tests should be run on access gw with magma services running"; exit 1)
. $(PYTHON_BUILD)/bin/activate; sudo $(BIN)/nosetests -s $(LOCAL_INTEG_TESTS)
. $(PYTHON_BUILD)/bin/activate; sudo $(BIN)/pytest -s $(LOCAL_INTEG_TESTS)
22 changes: 22 additions & 0 deletions lte/gateway/python/integ_tests/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2022 The Magma Authors.

# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

# 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.

[pytest]
python_files =
*_test.py
*_tests.py
test_*.py
python_classes =
*Test
*Tests
Test*
python_functions = test*
junit_logging = system-out
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import s1ap_types
import s1ap_wrapper
from python.integ_tests.common.service303_utils import (
from integ_tests.common.service303_utils import (
MetricValue,
verify_gateway_metrics,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import s1ap_types
import s1ap_wrapper
from python.integ_tests.common.service303_utils import (
from integ_tests.common.service303_utils import (
MetricValue,
verify_gateway_metrics,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import s1ap_types
import s1ap_wrapper
from python.integ_tests.common.service303_utils import (
from integ_tests.common.service303_utils import (
MetricValue,
verify_gateway_metrics,
)
Expand Down

0 comments on commit a484080

Please sign in to comment.