Skip to content

Commit

Permalink
Merge pull request ovn-kubernetes#4266 from girishmg/us-fix-name
Browse files Browse the repository at this point in the history
control file is not same as sock file
  • Loading branch information
tssurya authored Apr 13, 2024
2 parents 1453b86 + b3fe49b commit a5b114e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions go-controller/pkg/util/ovs.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const (
)

const (
nbdbCtlSock = "ovnnb_db.ctl"
sbdbCtlSock = "ovnsb_db.ctl"
nbdbCtlFileName = "ovnnb_db.ctl"
sbdbCtlFileName = "ovnsb_db.ctl"
OvnNbdbLocation = "/etc/ovn/ovnnb_db.db"
OvnSbdbLocation = "/etc/ovn/ovnsb_db.db"
FloodAction = "FLOOD"
Expand Down Expand Up @@ -486,12 +486,12 @@ func RunOVNNBAppCtlWithTimeout(timeout int, args ...string) (string, string, err
return RunOVNNBAppCtl(cmdArgs...)
}

// RunOVNNBAppCtl runs an 'ovn-appctl -t nbdbCtlSockPath command'.
// RunOVNNBAppCtl runs an 'ovn-appctl -t nbdbCtlFileName command'.
func RunOVNNBAppCtl(args ...string) (string, string, error) {
var cmdArgs []string
cmdArgs = []string{
"-t",
runner.ovnRunDir + nbdbCtlSock,
runner.ovnRunDir + nbdbCtlFileName,
}
cmdArgs = append(cmdArgs, args...)
stdout, stderr, err := runOVNretry(runner.ovnappctlPath, nil, cmdArgs...)
Expand All @@ -505,12 +505,12 @@ func RunOVNSBAppCtlWithTimeout(timeout int, args ...string) (string, string, err
return RunOVNSBAppCtl(cmdArgs...)
}

// RunOVNSBAppCtl runs an 'ovn-appctl -t sbdbCtlSockPath command'.
// RunOVNSBAppCtl runs an 'ovn-appctl -t sbdbCtlFileName command'.
func RunOVNSBAppCtl(args ...string) (string, string, error) {
var cmdArgs []string
cmdArgs = []string{
"-t",
runner.ovnRunDir + sbdbCtlSock,
runner.ovnRunDir + sbdbCtlFileName,
}
cmdArgs = append(cmdArgs, args...)
stdout, stderr, err := runOVNretry(runner.ovnappctlPath, nil, cmdArgs...)
Expand Down
16 changes: 8 additions & 8 deletions go-controller/pkg/util/ovs_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1452,13 +1452,13 @@ func TestRunOVNNBAppCtl(t *testing.T) {
onRetArgsKexecIface *ovntest.TestifyMockHelper
}{
{
desc: "negative: run `ovn-appctl -t nbdbCtlSockPath` command",
expectedErr: fmt.Errorf("failed to execute ovn-appctl -t nbdbCtlSockPath command"),
onRetArgsExecUtilsIface: &ovntest.TestifyMockHelper{OnCallMethodName: "RunCmd", OnCallMethodArgType: []string{"*mocks.Cmd", "string", "[]string", "string", "string"}, RetArgList: []interface{}{nil, nil, fmt.Errorf("failed to execute ovn-appctl -t nbdbCtlSockPath command")}},
desc: "negative: run `ovn-appctl -t nbdbCtlFileName` command",
expectedErr: fmt.Errorf("failed to execute ovn-appctl -t nbdbCtlFileName command"),
onRetArgsExecUtilsIface: &ovntest.TestifyMockHelper{OnCallMethodName: "RunCmd", OnCallMethodArgType: []string{"*mocks.Cmd", "string", "[]string", "string", "string"}, RetArgList: []interface{}{nil, nil, fmt.Errorf("failed to execute ovn-appctl -t nbdbCtlFileName command")}},
onRetArgsKexecIface: &ovntest.TestifyMockHelper{OnCallMethodName: "Command", OnCallMethodArgType: []string{"string", "string", "string"}, RetArgList: []interface{}{mockCmd}},
},
{
desc: "positive: run `ovn-appctl -t nbdbCtlSockPath` command",
desc: "positive: run `ovn-appctl -t nbdbCtlFileName` command",
expectedErr: nil,
onRetArgsExecUtilsIface: &ovntest.TestifyMockHelper{OnCallMethodName: "RunCmd", OnCallMethodArgType: []string{"*mocks.Cmd", "string", "[]string", "string", "string"}, RetArgList: []interface{}{bytes.NewBuffer([]byte("testblah")), bytes.NewBuffer([]byte("")), nil}},
onRetArgsKexecIface: &ovntest.TestifyMockHelper{OnCallMethodName: "Command", OnCallMethodArgType: []string{"string", "string", "string"}, RetArgList: []interface{}{mockCmd}},
Expand Down Expand Up @@ -1495,13 +1495,13 @@ func TestRunOVNSBAppCtl(t *testing.T) {
onRetArgsKexecIface *ovntest.TestifyMockHelper
}{
{
desc: "negative: run `ovn-appctl -t sbdbCtlSockPath` command",
expectedErr: fmt.Errorf("failed to execute ovn-appctl -t sbdbCtlSockPath command"),
onRetArgsExecUtilsIface: &ovntest.TestifyMockHelper{OnCallMethodName: "RunCmd", OnCallMethodArgType: []string{"*mocks.Cmd", "string", "[]string", "string", "string"}, RetArgList: []interface{}{nil, nil, fmt.Errorf("failed to execute ovn-appctl -t sbdbCtlSockPath command")}},
desc: "negative: run `ovn-appctl -t sbdbCtlFileName` command",
expectedErr: fmt.Errorf("failed to execute ovn-appctl -t sbdbCtlFileName command"),
onRetArgsExecUtilsIface: &ovntest.TestifyMockHelper{OnCallMethodName: "RunCmd", OnCallMethodArgType: []string{"*mocks.Cmd", "string", "[]string", "string", "string"}, RetArgList: []interface{}{nil, nil, fmt.Errorf("failed to execute ovn-appctl -t sbdbCtlFileName command")}},
onRetArgsKexecIface: &ovntest.TestifyMockHelper{OnCallMethodName: "Command", OnCallMethodArgType: []string{"string", "string", "string"}, RetArgList: []interface{}{mockCmd}},
},
{
desc: "positive: run `ovn-appctl -t sbdbCtlSockPath` command",
desc: "positive: run `ovn-appctl -t sbdbCtlFileName` command",
expectedErr: nil,
onRetArgsExecUtilsIface: &ovntest.TestifyMockHelper{OnCallMethodName: "RunCmd", OnCallMethodArgType: []string{"*mocks.Cmd", "string", "[]string", "string", "string"}, RetArgList: []interface{}{bytes.NewBuffer([]byte("testblah")), bytes.NewBuffer([]byte("")), nil}},
onRetArgsKexecIface: &ovntest.TestifyMockHelper{OnCallMethodName: "Command", OnCallMethodArgType: []string{"string", "string", "string"}, RetArgList: []interface{}{mockCmd}},
Expand Down

0 comments on commit a5b114e

Please sign in to comment.