test(refactor): cleanup/simplify testcases (#1124)

Signed-off-by: Nicol Draghici <idraghic@cisco.com>
This commit is contained in:
Nicol
2023-01-20 20:01:52 +02:00
committed by GitHub
parent 70a60b4660
commit f0d947809b
9 changed files with 144 additions and 392 deletions
+3 -16
View File
@@ -1,7 +1,6 @@
package common_test
import (
"context"
"crypto/x509"
"os"
"path"
@@ -85,8 +84,9 @@ func TestCommon(t *testing.T) {
So(err, ShouldBeNil)
ctlr.Config.Storage.RootDirectory = tempDir
go startServer(ctlr)
defer stopServer(ctlr)
cm := test.NewControllerManager(ctlr)
cm.StartServer()
defer cm.StopServer()
test.WaitTillServerReady(baseURL)
var resultPtr interface{}
@@ -97,16 +97,3 @@ func TestCommon(t *testing.T) {
So(err, ShouldNotBeNil)
})
}
func startServer(c *api.Controller) {
// this blocks
ctx := context.Background()
if err := c.Run(ctx); err != nil {
return
}
}
func stopServer(c *api.Controller) {
ctx := context.Background()
_ = c.Server.Shutdown(ctx)
}