CiscoTestAutomation / genieparser

sub-component of Genie that parse the device output into structured datastructure
Apache License 2.0
251 stars 388 forks source link

"make test" fails on fresh development machine installation #650

Closed ChristopherJHart closed 2 years ago

ChristopherJHart commented 2 years ago

The make test command fails when executed on a fresh Ubuntu 20.04 development environment.

I have a fork of genieparser here that is up-to-date with this upstream genieparser repository. After cloning this fork to an Ubuntu 20.04 host, I followed the below steps (which are interpreted from the "Development" section of this repository's README.md file:


Building and installing genie.libs.parser development distributable: develop

Found existing installation: genie.libs.parser 22.3 Uninstalling genie.libs.parser-22.3: Successfully uninstalled genie.libs.parser-22.3 Requirement already satisfied: xmltodict in ./venv/lib/python3.8/site-packages (0.12.0) Requirement already satisfied: requests in ./venv/lib/python3.8/site-packages (2.27.1) Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.8/site-packages (from requests) (2021.10.8) Requirement already satisfied: charset-normalizer~=2.0.0; python_version >= "3" in ./venv/lib/python3.8/site-packages (from requests) (2.0.12) Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./venv/lib/python3.8/site-packages (from requests) (1.26.9) Requirement already satisfied: idna<4,>=2.5; python_version >= "3" in ./venv/lib/python3.8/site-packages (from requests) (3.3) running develop running egg_info writing src/genie.libs.parser.egg-info/PKG-INFO writing dependency_links to src/genie.libs.parser.egg-info/dependency_links.txt writing namespace_packages to src/genie.libs.parser.egg-info/namespace_packages.txt writing requirements to src/genie.libs.parser.egg-info/requires.txt writing top-level names to src/genie.libs.parser.egg-info/top_level.txt reading manifest file 'src/genie.libs.parser.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching '.json' warning: no files found matching '.html' under directory 'src' warning: no previously-included files matching '.dll' found anywhere in distribution warning: no previously-included files matching '.pyc' found anywhere in distribution warning: no previously-included files matching '.pyo' found anywhere in distribution warning: no previously-included files matching '.so' found anywhere in distribution writing manifest file 'src/genie.libs.parser.egg-info/SOURCES.txt' running build_ext Installing /home/christopher/GitHub/genieparser/venv/lib/python3.8/site-packages/genie.libs.parser-nspkg.pth Creating /home/christopher/GitHub/genieparser/venv/lib/python3.8/site-packages/genie.libs.parser.egg-link (link to src) Adding genie.libs.parser 22.3 to easy-install.pth file

Installed /home/christopher/GitHub/genieparser/src

Completed building and installing: develop

Done.

* As part of my fork, I plan on adding some unit tests. First, I want to run the existing suite of unit tests to ensure they all pass. Therefore, I run the `make test` command, which fails.

(venv) christopher@ubuntu-playground:~/GitHub/genieparser$ make test Looking in indexes: https://pyats-pypi.cisco.com/simple WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7facc0ae2b20>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/cisco-distutils/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7facc0ae2ee0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/cisco-distutils/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7facc0ae2340>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/cisco-distutils/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7facc0ae2490>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/cisco-distutils/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7facc0ae2820>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/cisco-distutils/ ERROR: Could not find a version that satisfies the requirement cisco-distutils (from versions: none) ERROR: No matching distribution found for cisco-distutils


Unittests runs /bin/sh: 4: runAll: not found make: *** [Makefile:133: test] Error 127 (venv) christopher@ubuntu-playground:~/GitHub/genieparser$

"pyats-pypi.cisco.com/simple" doesn't seem to be a valid external host. DNS resolution for this fails.

(venv) christopher@ubuntu-playground:~/GitHub/genieparser$ ping pyats-pypi.cisco.com ping: pyats-pypi.cisco.com: Temporary failure in name resolution (venv) christopher@ubuntu-playground:~/GitHub/genieparser$ dig pyats-pypi.cisco.com

; <<>> DiG 9.16.1-Ubuntu <<>> pyats-pypi.cisco.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 37585 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 65494 ;; QUESTION SECTION: ;pyats-pypi.cisco.com. IN A

;; Query time: 87 msec ;; SERVER: 127.0.0.53#53(127.0.0.53) ;; WHEN: Thu Apr 07 10:48:41 EDT 2022 ;; MSG SIZE rcvd: 49


Is executing `make test` a valid way to run all existing unit tests for this repository? If not, what is the correct command to run?
ChristopherJHart commented 2 years ago

@tahigash reached out and confirmed that make test is not intended to be used to run unit tests. To run unit tests for parsers, reference the relevant section of the pyATS Development Guide for more details.

In summary, to execute folder-based tests:

  1. Run make json
  2. cd into the tests directory from the root of the project
  3. Execute python folder_parsing_job.py