hs-test: fix code style 80/37880/1
authorFilip Tehlar <ftehlar@cisco.com>
Mon, 9 Jan 2023 11:07:09 +0000 (12:07 +0100)
committerFilip Tehlar <ftehlar@cisco.com>
Mon, 9 Jan 2023 11:14:23 +0000 (12:14 +0100)
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

extras/hs-test/Makefile
extras/hs-test/container.go
extras/hs-test/ldp_test.go
extras/hs-test/linux_iperf_test.go
extras/hs-test/suite_ns_test.go
extras/hs-test/suite_tap_test.go
extras/hs-test/suite_veth_test.go
extras/hs-test/topo.go
extras/hs-test/vcl_test.go
extras/hs-test/vppinstance.go

index 9026555..c50e681 100755 (executable)
@@ -7,4 +7,7 @@ build:
 docker:
        bash ./script/build.sh
 
+fixstyle:
+       @gofmt -w .
+
 .PHONY: docker
index 5aa5e47..4ad4548 100644 (file)
@@ -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
                        }
 
index 8d81cde..2dfdf8b 100755 (executable)
@@ -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
index 38649e5..833fb2c 100755 (executable)
@@ -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")
index d45f6cc..cf7f0ec 100644 (file)
@@ -8,4 +8,3 @@ func (s *NsSuite) SetupSuite() {
        s.teardownSuite = setupSuite(&s.Suite, "ns")
        s.loadContainerTopology("ns")
 }
-
index ffcd8b7..26f5224 100644 (file)
@@ -12,4 +12,3 @@ func (s *TapSuite) SetupSuite() {
        time.Sleep(1 * time.Second)
        s.teardownSuite = setupSuite(&s.Suite, "tap")
 }
-
index f41e87d..5276072 100644 (file)
@@ -13,4 +13,3 @@ func (s *VethsSuite) SetupSuite() {
        s.teardownSuite = setupSuite(&s.Suite, "2peerVeth")
        s.loadContainerTopology("2peerVeth")
 }
-
index 1d501e8..cf50dad 100755 (executable)
@@ -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 {
index 5a5ba06..f4273c8 100755 (executable)
@@ -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.")
 }
index 6194ce8..15524b8 100644 (file)
@@ -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
 }