Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
bashokba committed Jan 22, 2021
1 parent 77d8957 commit 94e7fa7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions pkg/hostagent/opflex.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ func writeFault(faultfile string, ep *opflexFault) (bool, error) {
}

func (agent *HostAgent) createFaultOnAgent(description string, faultCode int) {
if agent.config.OpFlexFaultDir == "" {
agent.log.Error("OpFlex Fault directory not set")
return
}
if agent.config.OpFlexFaultDir == "" {
agent.log.Error("OpFlex Fault directory not set")
return
}
Uuid := uuid.New().String()
faultFilePath := filepath.Join(agent.config.OpFlexFaultDir, description+".fs")
faultFileExists := fileExists(faultFilePath)
if faultFileExists {
agent.log.Debug("Fault file exist at: ", faultFilePath)
agent.log.Debug("Fault file exist at: ", faultFilePath)
return
}
desc := strings.Replace(description, "_", " ", -1)
Expand All @@ -74,7 +74,7 @@ func (agent *HostAgent) createFaultOnAgent(description string, faultCode int) {
if err != nil {
agent.log.Warn("Unable to write fault file: ", err.Error())
} else if wrote {
agent.log.Debug("Created fault file at the location: ", faultFilePath)
agent.log.Debug("Created fault files at the location: ", faultFilePath)
}
return
}
Expand Down Expand Up @@ -337,8 +337,8 @@ func (agent *HostAgent) updateOpflexConfig() {
err := removeAllFiles(agent.config.OpFlexFaultDir)
if err != nil {
agent.log.Error("Not able to clear faults files on agent: ", err.Error())
}
agent.log.Debug("Cleared existig Faults files at the location ",agent.config.OpFlexFaultDir)
}
agent.log.Debug("Cleared existig Faults files at the location ", agent.config.OpFlexFaultDir)
}

newNodeConfig := agent.discoverHostConfig()
Expand Down
20 changes: 10 additions & 10 deletions pkg/hostagent/opflex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ func TestDiscoverHostConfigInvalidVlan(t *testing.T) {
}

func TestDiscoverHostConfigMTUMismtach(t *testing.T) {
tempdir, err := ioutil.TempDir("", "hostagent_test_")
if err != nil {
panic(err)
}
defer os.RemoveAll(tempdir)
agent := testAgent()
//assigning user defined MTU to be greater than the uplink MTU
agent.config.InterfaceMtu = 2000
config := agent.discoverHostConfig()
assert.Nil(t, config, "Host config is not nil")
tempdir, err := ioutil.TempDir("", "hostagent_test_")
if err != nil {
panic(err)
}
defer os.RemoveAll(tempdir)
agent := testAgent()
//assigning user defined MTU to be greater than the uplink MTU
agent.config.InterfaceMtu = 2000
config := agent.discoverHostConfig()
assert.Nil(t, config, "Host config is not nil")
}

0 comments on commit 94e7fa7

Please sign in to comment.