Bug 232182 - sysutils/py-pyznap: Add tests to the port
Summary: sysutils/py-pyznap: Add tests to the port
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Steve Wills
URL:
Keywords:
Depends on: 236154
Blocks:
  Show dependency treegraph
 
Reported: 2018-10-11 17:04 UTC by Mateusz Piotrowski
Modified: 2019-09-20 12:30 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (driesm)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mateusz Piotrowski freebsd_committer freebsd_triage 2018-10-11 17:04:42 UTC
Hi,

pyznap has a test suite. It would be nice to add it to the port's Makefile.

I've found out that it requires at least the following things to be added to the Makefile:

> TEST_DEPENDS=   ${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR} \
>                 ${PYTHON_PKGNAMEPREFIX}pytest-runner>0:devel/py-pytest-runner@${PY_FLAVOR} \
>                 faketime:devel/libfaketime
> 
> do-test:
>         @cd ${WRKSRC} && ${PYTHON_CMD} ${PYDISTUTILS_SETUP} test

There is a problem, however. The tests seem to be broken when I ran them in poudriere. I've opened a bug report in the upstream bug tracker.[1] 

If you could find some time to address those issues as a maintainer then the FreeBSD port of pyznap should be rock-solid! :)

Cheers!

[1]: https://github.com/yboetz/pyznap/issues/14
Comment 1 Dries Michiels freebsd_committer freebsd_triage 2018-10-11 17:28:44 UTC
Thanks! Will look into this when pyznap maintainer has responded!
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2018-10-15 10:14:48 UTC
These changes are a candidate for implicit/blanket approval for framework/infrastructure compliance/changes

Reporter is committer, assign accordingly
Comment 3 Dries Michiels freebsd_committer freebsd_triage 2018-10-26 20:20:41 UTC
https://github.com/Duffyx/py-pyznap

I tried to add tests, it succeeds the normal snapshot tests and so on as you can see in the test.log in the github repo.

Altough when going to ssh tests its a mess... 
I don't think we can handle this correctly.

pre-test:
   ${RM} *_ssh.py

something like this LOL. 

The problem is that the tests of the program assumes that the local host is already set-up for ssh priv/public key authentication. This is not something we can guarentee for a poudriere build let alone a local "make test".
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2018-10-28 09:08:34 UTC
(In reply to Dries Michiels from comment #3)

That's fine. Either rm or skip tests that you know cant/dont pass, or we cant support passing at the moment. Just include a #comment above that block that explains the issue, so that future people know, and can remember/try to fix them.

The correct and permanent solution for tests to SKIP not fail if any required features (python package, uid = root, etc) or environment attributes (some binary at path, whatever) arent available.
Comment 5 Dries Michiels freebsd_committer freebsd_triage 2018-10-29 16:46:01 UTC
I did some further research and its like Mateusz said; in a Poudriere enviroment the other tests fail too. ZFS isn't available in a Poudriere jail.
When I execute "poudriere testport -i -o sysutils/py-pyznap -j head -p head" and then try to exectute a ZFS command in interactive mode it sais this every time:

root@head-head:~ # zfs
internal error: failed to initialize ZFS library

root@head-default:~ # zpool
internal error: failed to initialize ZFS library


Should I create a PR for the above issue?

When the ZFS/zpool command isn't available in a Poudriere jail, tests that use the ZFS/ZPOOL command will have a hard time passing.  The tests do pass when not in a Poudriere jail, simply on the host with root privileges. Then all the standard ZFS tests pass.
 
Are there any examples in the ports tree where tests are skipped based on env variables? I would like to check if executed from poudriere jail or host if thats possible?
Comment 6 Mateusz Piotrowski freebsd_committer freebsd_triage 2018-11-01 12:26:50 UTC
(In reply to Dries Michiels from comment #5)

I don't know any existing ports which need to delete certain tests in the pre-test phase.

I'll ask people on IRC what they think about tests that does not work in poudriere.

I'd try to commit the minimal set of tests which work everywhere for the time being.
Comment 7 Walter Schwarzenfeld freebsd_triage 2019-08-27 00:59:47 UTC
Any news here?
Comment 8 Mateusz Piotrowski freebsd_committer freebsd_triage 2019-09-20 12:24:37 UTC
Some bits for tests were committed in r494703. I'll close this PR for now. We can revisit it in the future if there is an interest.
Comment 9 Kubilay Kocak freebsd_committer freebsd_triage 2019-09-20 12:30:38 UTC
Assign to committer that resolved (ports r494703)