summaryrefslogtreecommitdiffstats
path: root/extras/hs-test/README.rst
diff options
context:
space:
mode:
authorMaros Ondrejicka <maros.ondrejicka@pantheon.tech>2022-12-01 09:56:37 +0100
committerFlorin Coras <florin.coras@gmail.com>2022-12-02 21:35:10 +0000
commit11a03e972e6752513ab931540f713ce1520696a7 (patch)
treeeca0fca1593103cf5bc9f7fbb63706313de1925a /extras/hs-test/README.rst
parentb01efc557b411e02379c9647eebf7e762efd8473 (diff)
hs-test: add test suite features
Test suite now supports assertions which on fail stop test case run, also it allows to create docker containers which are going to be stopped automatically after the test run is finished. Type: improvement Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech> Change-Id: I2834709b1efd17b8182d36cc0404b986b4ed595d Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'extras/hs-test/README.rst')
-rwxr-xr-xextras/hs-test/README.rst19
1 files changed, 4 insertions, 15 deletions
diff --git a/extras/hs-test/README.rst b/extras/hs-test/README.rst
index dfaae44eeff..7a99621c8dc 100755
--- a/extras/hs-test/README.rst
+++ b/extras/hs-test/README.rst
@@ -45,10 +45,11 @@ For adding a new suite, please see `Modifying the framework`_ below.
#. Implement test behaviour inside the test method. This typically includes the following:
#. Start docker container(s) as needed. Function ``dockerRun(instance, args string)``
- from ``utils.go`` serves this purpose. Alternatively use suite struct's ``NewContainer(name string)`` method
+ from ``utils.go`` serves this purpose. Alternatively use suite struct's ``NewContainer(name string)`` method to create
+ an object representing a container and start it with ``run()`` method
#. Execute *hs-test* action(s) inside any of the running containers.
Function ``hstExec`` from ``utils.go`` does this by using ``docker exec`` command to run ``hs-test`` executable.
- For starting an VPP instance inside a container, the ``Vpp`` struct can be used as a forward-looking alternative
+ For starting an VPP instance inside a container, the ``VppInstance`` struct can be used as a forward-looking alternative
#. Run arbitrary commands inside the containers with ``dockerExec(cmd string, instance string)``
#. Run other external tool with one of the preexisting functions in the ``utils.go`` file.
For example, use ``wget`` with ``startWget(..)`` function
@@ -124,14 +125,13 @@ Modifying the framework
#. Adding a new suite takes place in ``framework_test.go``
-#. Make a ``struct`` with at least ``HstSuite`` struct and a ``teardownSuite`` function as its members.
+#. Make a ``struct`` with at least ``HstSuite`` struct as its member.
HstSuite provides functionality that can be shared for all suites, like starting containers
::
type MySuite struct {
HstSuite
- teardownSuite func()
}
#. Implement SetupSuite method which testify runs before running the tests.
@@ -147,17 +147,6 @@ Modifying the framework
s.teardownSuite = setupSuite(&s.Suite, "myTopology")
}
-#. Implement TearDownSuite method which testify runs after the tests, to clean-up.
- It's good idea to add at least the suite's own ``teardownSuite()``
- and HstSuite upper suite's ``stopContainers()`` methods
-
- ::
-
- func (s *MySuite) TearDownSuite() {
- s.teardownSuite()
- s.StopContainers()
- }
-
#. In order for ``go test`` to run this suite, we need to create a normal test function and pass our suite to ``suite.Run``
::