diff options
author | Maros Ondrejicka <maros.ondrejicka@pantheon.tech> | 2022-12-01 09:56:37 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2022-12-02 21:35:10 +0000 |
commit | 11a03e972e6752513ab931540f713ce1520696a7 (patch) | |
tree | eca0fca1593103cf5bc9f7fbb63706313de1925a /extras/hs-test/actions.go | |
parent | b01efc557b411e02379c9647eebf7e762efd8473 (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/actions.go')
-rwxr-xr-x | extras/hs-test/actions.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/extras/hs-test/actions.go b/extras/hs-test/actions.go index 9885f87b87d..fe07b5fdb39 100755 --- a/extras/hs-test/actions.go +++ b/extras/hs-test/actions.go @@ -236,20 +236,26 @@ func (a *Actions) Configure2Veths(args []string) *ActionResult { ctx, cancel := newVppContext() defer cancel() + + vppConfig, err := DeserializeVppConfig(args[2]) + if err != nil { + return NewActionResult(err, ActionResultWithDesc("deserializing configuration failed")) + } + con, vppErrCh := vpphelper.StartAndDialContext(ctx, - vpphelper.WithVppConfig(configTemplate+startup.ToString()), + vpphelper.WithVppConfig(vppConfig.getTemplate()+startup.ToString()), vpphelper.WithRootDir(fmt.Sprintf("/tmp/%s", args[1]))) exitOnErrCh(ctx, cancel, vppErrCh) var fn func(context.Context, api.Connection) error - if args[2] == "srv" { + if vppConfig.Variant == "srv" { fn = configure2vethsTopo("vppsrv", "10.10.10.1/24", "1", 1) - } else if args[2] == "srv-with-preset-hw-addr" { + } else if vppConfig.Variant == "srv-with-preset-hw-addr" { fn = configure2vethsTopo("vppsrv", "10.10.10.1/24", "1", 1, "00:00:5e:00:53:01") } else { fn = configure2vethsTopo("vppcln", "10.10.10.2/24", "2", 2) } - err := fn(ctx, con) + err = fn(ctx, con) if err != nil { return NewActionResult(err, ActionResultWithDesc("configuration failed")) } |