On Mon 25 Feb 2008 at 05:52PM, [EMAIL PROTECTED] wrote:
> 634 Rewrite CLI tests in python

Folks, this putback creates a framework for functional testing of the CLI
portion of IPS.

There are several pieces here:

        - New tests, and conversion of the existing tests.
        - New unittest subclasses:

          unittest
             |
             +--> testutils.pkg5TestCase
                    |
                    +--> testutils.SingleDepotTestCase

          Ultimately, we need to have a TwoDepotTestCase class as well.

        - Test cases are self-contained: Unlike in cli-complete.ksh,
          which built up some state from one test to another, you'll
          get a fresh canvas to work from in each test method.

        - Better diagnostics when things fail.  When a test case fails,
          you will see something like the output below (to take an example
          from the gate at present).  This includes: Test case
          description, traceback, expected exit code, command line
          run for the failing command, and any output, and a debug
          buffer with a full log of the failing test case.  If the
          depot traced back, you'll get that, too.

CALL TO ACTION:

        - YOU MUST RUN THE TEST SUITE.  Don't putback without running it.

        - When you fix a bug, please design a test case for the bugfix.

        - Write more tests!  This is a great way to get involved in
          the project.

        - Improve the test harness: There are a number of features we
          could add: timeouts, "waived bugs", "expected bugs", etc.
          Also an easy way to get involved.

I'm sure the harness isn't perfect, but it's pretty easy to hack on,
so don't hesitate to build it out a little more as needed.

        -dp

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
xanadu # python cli-complete.py 
NOTE: Adding 
/net/snowdog/aux/dp/ips-fixes/gate/src/tests/../../proto/root_i386/usr/lib/python2.4/vendor-packages
 to head of PYTHONPATH
NOTE: Adding '.' to head of PYTHONPATH
DEBUG: Set TEST_DEBUG=1 for verbose output
......E..E............
======================================================================
ERROR: Send package [EMAIL PROTECTED], containing a directory and a file,
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./cli/t_pkg_install_basics.py", line 96, in test_basics_2
    self.pkg("search -r /lib/libc.so.1")
  File "./cli/testutils.py", line 245, in pkg
    debug=self.get_debugbuf())
UnexpectedExitCodeException: 
  Expected exit status: 0.  Got: 1.  Output Follows:
,---------------------------------------------------------------------
| $ pkg search -r /lib/libc.so.1
| <no output>
`---------------------------------------------------------------------
  Debug Buffer Follows:
,---------------------------------------------------------------------
| setup: cli.t_pkg_install_basics.TestPkgInstallBasics.test_basics_2
| setup: depot data in /tmp/ips.test.17843/depot
| setup: depot logging to 
/tmp/ips.test.17843/depot_logdir/cli.t_pkg_install_basics.TestPkgInstallBasics.test_basics_2
| $ pkgsend -s http://localhost:12000 open [EMAIL PROTECTED],5.11-0
| export PKG_TRANS_ID=1203990158_pkg%3A%2Ffoo%401.0%2C5.11-0%3A20080225T174238Z
| $ pkgsend -s http://localhost:12000 close
| PUBLISHED
| pkg:/[EMAIL PROTECTED],5.11-0:20080225T174238Z
| $ pkgsend -s http://localhost:12000 open [EMAIL PROTECTED],5.11-0
| export PKG_TRANS_ID=1203990159_pkg%3A%2Ffoo%401.1%2C5.11-0%3A20080225T174239Z
| $ pkgsend -s http://localhost:12000 add dir mode=0755 owner=root group=bin 
path=/lib
| $ pkgsend -s http://localhost:12000 add file /lib/libc.so.1 mode=0555 
owner=root group=bin path=/lib/libc.so.1
| $ pkgsend -s http://localhost:12000 close
| PUBLISHED
| pkg:/[EMAIL PROTECTED],5.11-0:20080225T174239Z
| image_destroy
| $ pkg image-create -F -a test=http://localhost:12000 /tmp/ips.test.17843/image
| $ pkg status -a
| FMRI                                               STATE      UFIX
| pkg://test/[EMAIL PROTECTED]                               known      u---
| pkg://test/[EMAIL PROTECTED]                               known      ----
| $ pkg install foo
| Download: foo ...  Done
| Install Phase ...  Done
| $ pkg verify
| $ pkg status
| FMRI                                               STATE      UFIX
| pkg://test/[EMAIL PROTECTED]                               installed  ----
| $ pkg search /lib/libc.so.1
| path pkg:/[EMAIL PROTECTED],5.11-0:20080225T174239Z
| $ pkg search -r /lib/libc.so.1
| [returned 1]
| 
`---------------------------------------------------------------------

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

-- 
Daniel Price - Solaris Kernel Engineering - [EMAIL PROTECTED] - blogs.sun.com/dp
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to