From 11a03e972e6752513ab931540f713ce1520696a7 Mon Sep 17 00:00:00 2001 From: Maros Ondrejicka Date: Thu, 1 Dec 2022 09:56:37 +0100 Subject: 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 Change-Id: I2834709b1efd17b8182d36cc0404b986b4ed595d Signed-off-by: Filip Tehlar --- extras/hs-test/actions.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'extras/hs-test/actions.go') 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")) } -- cgit 1.2.3-korg