aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2023-01-09 12:07:09 +0100
committerFilip Tehlar <ftehlar@cisco.com>2023-01-09 12:14:23 +0100
commitf3ee2b636ad3b12e7484ec6fb13f220699417046 (patch)
tree20a2f6a1a0b42d0306e947b9b19f6861df5dbb92
parentc204c87c186993704927beffa4d5b1cafaf9a193 (diff)
hs-test: fix code style
This will add a new target (fixstyle) to Makefile that runs gofmt tool. Type: style Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: Icba60633f82aa8bbc75749f080e00f0375b55a18
-rwxr-xr-xextras/hs-test/Makefile3
-rw-r--r--extras/hs-test/container.go6
-rwxr-xr-xextras/hs-test/ldp_test.go2
-rwxr-xr-xextras/hs-test/linux_iperf_test.go2
-rw-r--r--extras/hs-test/suite_ns_test.go1
-rw-r--r--extras/hs-test/suite_tap_test.go1
-rw-r--r--extras/hs-test/suite_veth_test.go1
-rwxr-xr-xextras/hs-test/topo.go4
-rwxr-xr-xextras/hs-test/vcl_test.go10
-rw-r--r--extras/hs-test/vppinstance.go8
10 files changed, 19 insertions, 19 deletions
diff --git a/extras/hs-test/Makefile b/extras/hs-test/Makefile
index 90265551c87..c50e681915a 100755
--- a/extras/hs-test/Makefile
+++ b/extras/hs-test/Makefile
@@ -7,4 +7,7 @@ build:
docker:
bash ./script/build.sh
+fixstyle:
+ @gofmt -w .
+
.PHONY: docker
diff --git a/extras/hs-test/container.go b/extras/hs-test/container.go
index 5aa5e4795e8..4ad454848fa 100644
--- a/extras/hs-test/container.go
+++ b/extras/hs-test/container.go
@@ -47,7 +47,7 @@ func NewContainer(yamlInput ContainerConfig) (*Container, error) {
}
if _, ok := yamlInput["volumes"]; ok {
- r:= strings.NewReplacer("$HST_DIR", workDir)
+ r := strings.NewReplacer("$HST_DIR", workDir)
for _, volu := range yamlInput["volumes"].([]interface{}) {
volumeMap := volu.(ContainerConfig)
hostDir := r.Replace(volumeMap["host-dir"].(string))
@@ -55,8 +55,8 @@ func NewContainer(yamlInput ContainerConfig) (*Container, error) {
container.addVolume(hostDir, containerDir)
if isDefaultWorkDir, ok := volumeMap["is-default-work-dir"]; ok &&
- isDefaultWorkDir.(bool) &&
- len(container.workDir) == 0 {
+ isDefaultWorkDir.(bool) &&
+ len(container.workDir) == 0 {
container.workDir = containerDir
}
diff --git a/extras/hs-test/ldp_test.go b/extras/hs-test/ldp_test.go
index 8d81cde56e6..2dfdf8b4440 100755
--- a/extras/hs-test/ldp_test.go
+++ b/extras/hs-test/ldp_test.go
@@ -81,7 +81,7 @@ func (s *VethsSuite) TestLDPreloadIperfVpp() {
var clnRes = make(chan string, 1)
clnEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+clnVcl)
go StartClientApp(clnEnv, clnCh, clnRes)
- s.log(<- clnRes)
+ s.log(<-clnRes)
// wait for client's result
err = <-clnCh
diff --git a/extras/hs-test/linux_iperf_test.go b/extras/hs-test/linux_iperf_test.go
index 38649e5d4f4..833fb2c2c4a 100755
--- a/extras/hs-test/linux_iperf_test.go
+++ b/extras/hs-test/linux_iperf_test.go
@@ -15,7 +15,7 @@ func (s *TapSuite) TestLinuxIperf() {
s.log("server running")
go StartClientApp(nil, clnCh, clnRes)
s.log("client running")
- s.log(<- clnRes)
+ s.log(<-clnRes)
err = <-clnCh
s.assertNil(err)
s.log("Test completed")
diff --git a/extras/hs-test/suite_ns_test.go b/extras/hs-test/suite_ns_test.go
index d45f6cc0132..cf7f0ec98f1 100644
--- a/extras/hs-test/suite_ns_test.go
+++ b/extras/hs-test/suite_ns_test.go
@@ -8,4 +8,3 @@ func (s *NsSuite) SetupSuite() {
s.teardownSuite = setupSuite(&s.Suite, "ns")
s.loadContainerTopology("ns")
}
-
diff --git a/extras/hs-test/suite_tap_test.go b/extras/hs-test/suite_tap_test.go
index ffcd8b72a70..26f5224d148 100644
--- a/extras/hs-test/suite_tap_test.go
+++ b/extras/hs-test/suite_tap_test.go
@@ -12,4 +12,3 @@ func (s *TapSuite) SetupSuite() {
time.Sleep(1 * time.Second)
s.teardownSuite = setupSuite(&s.Suite, "tap")
}
-
diff --git a/extras/hs-test/suite_veth_test.go b/extras/hs-test/suite_veth_test.go
index f41e87df128..5276072eed6 100644
--- a/extras/hs-test/suite_veth_test.go
+++ b/extras/hs-test/suite_veth_test.go
@@ -13,4 +13,3 @@ func (s *VethsSuite) SetupSuite() {
s.teardownSuite = setupSuite(&s.Suite, "2peerVeth")
s.loadContainerTopology("2peerVeth")
}
-
diff --git a/extras/hs-test/topo.go b/extras/hs-test/topo.go
index 1d501e8f2da..cf50dadd42a 100755
--- a/extras/hs-test/topo.go
+++ b/extras/hs-test/topo.go
@@ -13,9 +13,9 @@ type NetDevConfig map[string]interface{}
type ContainerConfig map[string]interface{}
type YamlTopology struct {
- Devices []NetDevConfig `yaml:"devices"`
+ Devices []NetDevConfig `yaml:"devices"`
Containers []ContainerConfig `yaml:"containers"`
- Volumes []string `yaml:"volumes"`
+ Volumes []string `yaml:"volumes"`
}
func AddAddress(device, address, ns string) error {
diff --git a/extras/hs-test/vcl_test.go b/extras/hs-test/vcl_test.go
index 5a5ba06bebc..f4273c87b14 100755
--- a/extras/hs-test/vcl_test.go
+++ b/extras/hs-test/vcl_test.go
@@ -32,12 +32,12 @@ func (s *VethsSuite) testVclEcho(proto string) {
echoSrvContainer := s.getContainerByName("server-application")
// run server app
- _, err = echoSrvContainer.execAction("RunEchoServer "+proto)
+ _, err = echoSrvContainer.execAction("RunEchoServer " + proto)
s.assertNil(err)
echoClnContainer := s.getContainerByName("client-application")
- o, err := echoClnContainer.execAction("RunEchoClient "+proto)
+ o, err := echoClnContainer.execAction("RunEchoClient " + proto)
s.assertNil(err)
s.log(o)
@@ -60,13 +60,13 @@ func (s *VethsSuite) testRetryAttach(proto string) {
s.assertNil(err)
echoSrvContainer := s.getContainerByName("server-application")
- _, err = echoSrvContainer.execAction("RunVclEchoServer "+proto)
+ _, err = echoSrvContainer.execAction("RunVclEchoServer " + proto)
s.assertNil(err)
s.log("This whole test case can take around 3 minutes to run. Please be patient.")
s.log("... Running first echo client test, before disconnect.")
echoClnContainer := s.getContainerByName("client-application")
- _, err = echoClnContainer.execAction("RunVclEchoClient "+proto)
+ _, err = echoClnContainer.execAction("RunVclEchoClient " + proto)
s.assertNil(err)
s.log("... First test ended. Stopping VPP server now.")
@@ -85,7 +85,7 @@ func (s *VethsSuite) testRetryAttach(proto string) {
time.Sleep(30 * time.Second) // Wait a moment for the re-attachment to happen
s.log("... Running second echo client test, after disconnect and re-attachment.")
- _, err = echoClnContainer.execAction("RunVclEchoClient "+proto)
+ _, err = echoClnContainer.execAction("RunVclEchoClient " + proto)
s.assertNil(err)
s.log("Done.")
}
diff --git a/extras/hs-test/vppinstance.go b/extras/hs-test/vppinstance.go
index 6194ce88106..15524b826c2 100644
--- a/extras/hs-test/vppinstance.go
+++ b/extras/hs-test/vppinstance.go
@@ -1,8 +1,8 @@
package main
import (
- "fmt"
"encoding/json"
+ "fmt"
"github.com/edwarnicke/exechelper"
)
@@ -45,13 +45,13 @@ const (
)
type VppInstance struct {
- container *Container
- config VppConfig
+ container *Container
+ config VppConfig
actionFuncName string
}
type VppConfig struct {
- Variant string
+ Variant string
CliSocketFilePath string
}