summaryrefslogtreecommitdiffstats
path: root/extras/hs-test/proxy_test.go
diff options
context:
space:
mode:
authorAdrian Villin <avillin@cisco.com>2024-03-14 11:42:55 -0400
committerAdrian Villin <avillin@cisco.com>2024-04-19 14:52:05 +0000
commitcee15aa940a0229e21049c18df66c7dc80ad9096 (patch)
tree7cca4828c44fa2e059e728f2171f158bf3621447 /extras/hs-test/proxy_test.go
parent3a05db6264a4b2edf1fc7e6c35ee3b688baa463a (diff)
hs-test: transition to ginkgo test framework
Type: test Change-Id: Ia38bf5549d20b22876f6082085b69a52a03d0142 Signed-off-by: Adrian Villin <avillin@cisco.com> Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'extras/hs-test/proxy_test.go')
-rw-r--r--extras/hs-test/proxy_test.go26
1 files changed, 17 insertions, 9 deletions
diff --git a/extras/hs-test/proxy_test.go b/extras/hs-test/proxy_test.go
index c2f9b6f2825..ac5f94c8535 100644
--- a/extras/hs-test/proxy_test.go
+++ b/extras/hs-test/proxy_test.go
@@ -5,8 +5,13 @@ import (
"os"
"github.com/edwarnicke/exechelper"
+ . "github.com/onsi/ginkgo/v2"
)
+func init() {
+ registerNsTests(VppProxyHttpTcpTest, VppProxyHttpTlsTest, EnvoyProxyHttpTcpTest)
+}
+
func testProxyHttpTcp(s *NsSuite, proto string) error {
var outputFile string = "test" + s.pid + ".data"
var srcFilePid string = "httpTestFile" + s.pid
@@ -19,12 +24,15 @@ func testProxyHttpTcp(s *NsSuite, proto string) error {
// create test file
err := exechelper.Run(fmt.Sprintf("ip netns exec %s truncate -s %s %s", serverNetns, fileSize, srcFilePid))
- s.assertNil(err, "failed to run truncate command: " + fmt.Sprint(err))
+ s.assertNil(err, "failed to run truncate command: "+fmt.Sprint(err))
defer func() { os.Remove(srcFilePid) }()
s.log("test file created...")
- go s.startHttpServer(serverRunning, stopServer, ":666", serverNetns)
+ go func() {
+ defer GinkgoRecover()
+ s.startHttpServer(serverRunning, stopServer, ":666", serverNetns)
+ }()
// TODO better error handling and recovery
<-serverRunning
@@ -64,21 +72,21 @@ func configureVppProxy(s *NsSuite, proto string) {
clientVeth.ip4AddressString(),
serverVeth.peer.ip4AddressString(),
)
- s.log("proxy configured...", output)
+ s.log("proxy configured: " + output)
}
-func (s *NsSuite) TestVppProxyHttpTcp() {
+func VppProxyHttpTcpTest(s *NsSuite) {
proto := "tcp"
configureVppProxy(s, proto)
err := testProxyHttpTcp(s, proto)
- s.assertNil(err, err)
+ s.assertNil(err, fmt.Sprint(err))
}
-func (s *NsSuite) TestVppProxyHttpTls() {
+func VppProxyHttpTlsTest(s *NsSuite) {
proto := "tls"
configureVppProxy(s, proto)
err := testProxyHttpTcp(s, proto)
- s.assertNil(err, err)
+ s.assertNil(err, fmt.Sprint(err))
}
func configureEnvoyProxy(s *NsSuite) {
@@ -100,8 +108,8 @@ func configureEnvoyProxy(s *NsSuite) {
s.assertNil(envoyContainer.start())
}
-func (s *NsSuite) TestEnvoyProxyHttpTcp() {
+func EnvoyProxyHttpTcpTest(s *NsSuite) {
configureEnvoyProxy(s)
err := testProxyHttpTcp(s, "tcp")
- s.assertNil(err, err)
+ s.assertNil(err, fmt.Sprint(err))
}