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
This commit is contained in:
Filip Tehlar
2023-01-09 12:07:09 +01:00
parent c204c87c18
commit f3ee2b636a
10 changed files with 19 additions and 19 deletions

@ -7,4 +7,7 @@ build:
docker:
bash ./script/build.sh
fixstyle:
@gofmt -w .
.PHONY: docker

@ -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
}

@ -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

@ -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")

@ -8,4 +8,3 @@ func (s *NsSuite) SetupSuite() {
s.teardownSuite = setupSuite(&s.Suite, "ns")
s.loadContainerTopology("ns")
}

@ -12,4 +12,3 @@ func (s *TapSuite) SetupSuite() {
time.Sleep(1 * time.Second)
s.teardownSuite = setupSuite(&s.Suite, "tap")
}

@ -13,4 +13,3 @@ func (s *VethsSuite) SetupSuite() {
s.teardownSuite = setupSuite(&s.Suite, "2peerVeth")
s.loadContainerTopology("2peerVeth")
}

@ -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 {

@ -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.")
}

@ -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
}