Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue:3897880:PDR:Exclusion list tests #214

Closed
wants to merge 89 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
babe045
3897880:PDR black list tests (initial steps)
vg12345 May 15, 2024
5dee646
Pylint test
vg12345 May 15, 2024
c6aa08a
Fix for requirements file location
vg12345 May 15, 2024
ee3564a
Added missing empty file
vg12345 May 15, 2024
9451c9b
First simple pytest test
vg12345 May 15, 2024
1d7629f
Test file path fix
vg12345 May 15, 2024
389a353
Minor fix
vg12345 May 15, 2024
5bf6458
Minor fix
vg12345 May 15, 2024
0b34f10
Import paths
vg12345 May 15, 2024
d57b663
Fix
vg12345 May 15, 2024
f3d08b2
Fix
vg12345 May 15, 2024
056af80
Fix 3
vg12345 May 15, 2024
b874461
Fix 4
vg12345 May 15, 2024
3193651
Fix 5
vg12345 May 15, 2024
e9a4617
Fix 6
vg12345 May 15, 2024
7199f4b
Fix 7
vg12345 May 15, 2024
2b8d6f0
Fix 8
vg12345 May 15, 2024
8e2edc3
issue: 3899827: Updating TFS documentations for 1.0.0-14 (#213)
ananalaghbar May 16, 2024
b2b889c
issue: 3799995: Integrate PEP8/ pylint into TFS CI process (#210)
ananalaghbar May 16, 2024
fc2fca1
Test ExcludeList class methods directly
vg12345 May 16, 2024
26070aa
Initial REST API test and generated requirements file
vg12345 May 16, 2024
4d94359
Rollback for requirements file
vg12345 May 16, 2024
2702989
Disable REST API test
vg12345 May 16, 2024
2110e43
Experimental
vg12345 May 16, 2024
aad96f7
Rollback experimental
vg12345 May 16, 2024
e15b99b
Experiment with standalone plugin
vg12345 May 16, 2024
f405f1d
Experiment with standalone plugin
vg12345 May 16, 2024
e6cd666
Experiment with standalone plugin
vg12345 May 16, 2024
7aee83f
Experiment with standalone plugin
vg12345 May 16, 2024
6ed1bcc
Experiment with standalone plugin
vg12345 May 16, 2024
8d9ce72
Experiment with standalone plugin
vg12345 May 16, 2024
031da81
Temp: full simulation
vg12345 May 19, 2024
c0faf9e
Temp: full simulation
vg12345 May 19, 2024
7ffef77
Temp: full simulation
vg12345 May 19, 2024
ead0b08
Temp: full simulation
vg12345 May 19, 2024
995d0d2
Temp: full simulation
vg12345 May 19, 2024
0bb2374
Temp: full simulation
vg12345 May 19, 2024
8e5920a
Temp: full simulation
vg12345 May 19, 2024
bc9d5d4
Temp: full simulation
vg12345 May 19, 2024
547d87c
Temp: full simulation
vg12345 May 19, 2024
5854493
Temp: full simulation
vg12345 May 19, 2024
cfa8bb8
Temp: full simulation
vg12345 May 19, 2024
9ecf0aa
Temp: full simulation
vg12345 May 19, 2024
ff1829a
Temp: full simulation
vg12345 May 19, 2024
2904204
3893890:Issue:Exclusion list CI testing for PDR plugin (#211)
vg12345 May 19, 2024
977301d
3897880:PDR black list tests (initial steps)
vg12345 May 15, 2024
ac2a654
Pylint test
vg12345 May 15, 2024
8f7b52d
Fix for requirements file location
vg12345 May 15, 2024
5c24cf2
Added missing empty file
vg12345 May 15, 2024
6c61686
First simple pytest test
vg12345 May 15, 2024
4d2571c
Test file path fix
vg12345 May 15, 2024
ca4c2c6
Minor fix
vg12345 May 15, 2024
6a18ae2
Minor fix
vg12345 May 15, 2024
a8fec04
Import paths
vg12345 May 15, 2024
b43e1fa
Fix
vg12345 May 15, 2024
12611bb
Fix
vg12345 May 15, 2024
e8fd436
Fix 3
vg12345 May 15, 2024
50b0d20
Fix 4
vg12345 May 15, 2024
0cb179e
Fix 5
vg12345 May 15, 2024
c5f7757
Fix 6
vg12345 May 15, 2024
f0ab602
Fix 7
vg12345 May 15, 2024
bb86113
Fix 8
vg12345 May 15, 2024
19aba8f
Test ExcludeList class methods directly
vg12345 May 16, 2024
d76d764
Initial REST API test and generated requirements file
vg12345 May 16, 2024
a133545
Rollback for requirements file
vg12345 May 16, 2024
76b47a1
Disable REST API test
vg12345 May 16, 2024
ce6fd82
Experimental
vg12345 May 16, 2024
de2692a
Rollback experimental
vg12345 May 16, 2024
2bcb80c
Experiment with standalone plugin
vg12345 May 16, 2024
1de470d
Experiment with standalone plugin
vg12345 May 16, 2024
f2fb103
Experiment with standalone plugin
vg12345 May 16, 2024
1713076
Experiment with standalone plugin
vg12345 May 16, 2024
0e888c6
Experiment with standalone plugin
vg12345 May 16, 2024
01da588
Experiment with standalone plugin
vg12345 May 16, 2024
691e627
Temp: full simulation
vg12345 May 19, 2024
d370b69
Temp: full simulation
vg12345 May 19, 2024
a051d08
Temp: full simulation
vg12345 May 19, 2024
b9696c4
Temp: full simulation
vg12345 May 19, 2024
16a958a
Temp: full simulation
vg12345 May 19, 2024
2518e3e
Temp: full simulation
vg12345 May 19, 2024
d8fa0b6
Temp: full simulation
vg12345 May 19, 2024
701ab9c
Temp: full simulation
vg12345 May 19, 2024
c45c37b
Temp: full simulation
vg12345 May 19, 2024
feb7c39
Temp: full simulation
vg12345 May 19, 2024
a2907c5
Temp: full simulation
vg12345 May 19, 2024
9466b18
Temp: full simulation
vg12345 May 19, 2024
cc8ed4e
Temp: full simulation
vg12345 May 19, 2024
98cd1b4
Temp: full simulation
vg12345 May 19, 2024
b0d6f54
Temp: full simulation
vg12345 May 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/pdr_plugin_ci_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: PDR Plugin CI Workflow

on:
push:
paths:
- 'plugins/pdr_deterministic_plugin/**'
jobs:
build:
runs-on: ubuntu-latest

env:
PYTHONPATH: '.:plugins/pdr_deterministic_plugin/ufm_sim_web_service'

steps:
- name: Checkout code
uses: actions/checkout@main

- name: Set up Python
uses: actions/setup-python@main
with:
python-version: 3.9

- name: Install dependencies
run: |
pip install -r plugins/pdr_deterministic_plugin/requirements.txt
pip install pylint
pip install pytest pytest-cov

- name: Run PyLint
run: pylint --rcfile=plugins/pdr_deterministic_plugin/.pylintrc plugins/pdr_deterministic_plugin

- name: Test exclude list with pytest
run: pytest plugins/pdr_deterministic_plugin/tests/exclude_list_tests.py --doctest-modules --junitxml=junit/exclude_list_tests_results.xml --cov=com --cov-report=xml --cov-report=html
17 changes: 17 additions & 0 deletions plugins/pdr_deterministic_plugin/.pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[MASTER]
init-hook="import os, sys; sys.path.append(os.path.join(os.getcwd(), 'plugins', 'pdr_deterministic_plugin', 'src')); sys.path.append(os.path.join(os.getcwd(), 'utils'))"

[MAIN]
max-public-methods=100

[DESIGN]
max-attributes=10

[MESSAGES CONTROL]
disable=missing-module-docstring,missing-function-docstring,fixme

[FORMAT]
max-line-length=140

[BASIC]
min-public-methods=0
11 changes: 11 additions & 0 deletions plugins/pdr_deterministic_plugin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Copyright © 2013-2024 NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
#
# This software product is a proprietary product of Nvidia Corporation and its affiliates
# (the "Company") and all right, title, and interest in and to the software
# product, including all associated intellectual property rights, are and
# shall remain exclusively with the Company.
#
# This software product is governed by the End User License Agreement
# provided with the software product.
#
11 changes: 11 additions & 0 deletions plugins/pdr_deterministic_plugin/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
requests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you create this file manually?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I just looked for dependencies and added them, so the test will finish with successs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will generate it automatically

configparser
flask
flask_restful
twisted
tzlocal<3.0
jsonschema
pandas
numpy
prometheus_client
msgpack
36 changes: 36 additions & 0 deletions plugins/pdr_deterministic_plugin/tests/exclude_list_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# Copyright © 2013-2024 NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
#
# This software product is a proprietary product of Nvidia Corporation and its affiliates
# (the "Company") and all right, title, and interest in and to the software
# product, including all associated intellectual property rights, are and
# shall remain exclusively with the Company.
#
# This software product is governed by the End User License Agreement
# provided with the software product.
#

import os
import tempfile

#import pytest
from constants import PDRConstants as Constants
from exclude_list import ExcludeList
from isolation_algo import create_logger

def test_get_from_empty_exclude_list():
"""
Create exclude list and ensure its empty via its method
"""
print("Test 5")

log_name = os.path.basename(Constants.LOG_FILE)
log_path = os.path.join(tempfile.gettempdir(), log_name)

logger = create_logger(log_path)
exclude_list = ExcludeList(logger)
items = exclude_list.items()
assert not items

if __name__ == '__main__':
test_get_from_empty_exclude_list()
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,26 @@
from utils.utils import Utils


def create_logger(file):
def create_logger(log_file):
"""
create a logger to put all the data of the server action
:param file: name of the file
:return:
"""
format_str = "%(asctime)-15s UFM-PDR_deterministic-plugin-{0} Machine: {1} %(levelname)-7s: %(message)s".format(file,'localhost')
log_name = Constants.LOG_FILE
if not os.path.exists(log_name):
os.makedirs('/'.join(log_name.split('/')[:-1]), exist_ok=True)
logger = logging.getLogger(log_name)
format_str = "%(asctime)-15s UFM-PDR_deterministic-plugin-{0} Machine: {1} %(levelname)-7s: %(message)s".format(log_file,'localhost')
if not os.path.exists(log_file):
os.makedirs('/'.join(log_file.split('/')[:-1]), exist_ok=True)
logger = logging.getLogger(log_file)

logging_level = logging.getLevelName(Constants.log_level) \
if isinstance(Constants.log_level, str) else Constants.log_level

logging.basicConfig(format=format_str,level=logging_level)
rotateHandler = RotatingFileHandler(log_name,maxBytes=Constants.log_file_max_size,
rotate_handler = RotatingFileHandler(log_file,maxBytes=Constants.log_file_max_size,
backupCount=Constants.log_file_backup_count)
rotateHandler.setLevel(Constants.log_level)
rotateHandler.setFormatter(logging.Formatter(format_str))
logger.addHandler(rotateHandler)
rotate_handler.setLevel(Constants.log_level)
rotate_handler.setFormatter(logging.Formatter(format_str))
logger.addHandler(rotate_handler)
return logger


Expand Down