Skip to content

Commit

Permalink
Remove handler interface, mock and related tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Meis <christopher.meis@9elements.com>
  • Loading branch information
ChriMarMe committed Jan 26, 2022
1 parent 9863a39 commit c3ec4e6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 127 deletions.
7 changes: 0 additions & 7 deletions pkg/ipmi/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,3 @@ func (r *realSyscalls) fileSetReadDeadline(f *os.File, t time.Duration) error {
func (r *realSyscalls) connRead(f func(fd uintptr) bool, conn syscall.RawConn) error {
return conn.Read(f)
}

type handler interface {
SendRequest(*request) error
ReceiveResponse(int64, *response, []byte) ([]byte, error)
File() *os.File
Close() error
}
8 changes: 4 additions & 4 deletions pkg/ipmi/ipmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var (

// IPMI represents access to the IPMI interface.
type IPMI struct {
handler
*dev
}

// SendRecv sends the IPMI message, receives the response, and returns the
Expand Down Expand Up @@ -66,7 +66,7 @@ func (i *IPMI) RawSendRecv(msg Msg) ([]byte, error) {

// Send request.
for {
switch err := i.handler.SendRequest(req); {
switch err := i.dev.SendRequest(req); {
case err == syscall.EINTR:
continue
case err != nil:
Expand All @@ -86,7 +86,7 @@ func (i *IPMI) RawSendRecv(msg Msg) ([]byte, error) {
msg: recvMsg,
}

return i.handler.ReceiveResponse(req.msgid, recv, buf)
return i.dev.ReceiveResponse(req.msgid, recv, buf)
}

func (i *IPMI) WatchdogRunning() (bool, error) {
Expand Down Expand Up @@ -352,5 +352,5 @@ func (i *IPMI) RawCmd(param []byte) ([]byte, error) {

// Close closes the file attached to ipmi
func (i *IPMI) Close() error {
return i.handler.Close()
return i.dev.Close()
}
2 changes: 1 addition & 1 deletion pkg/ipmi/ipmi_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ func Open(devnum int) (*IPMI, error) {
return nil, err
}

return &IPMI{handler: newDev(f)}, nil
return &IPMI{dev: newDev(f)}, nil
}
68 changes: 0 additions & 68 deletions pkg/ipmi/ipmi_test.go

This file was deleted.

47 changes: 0 additions & 47 deletions pkg/ipmi/mock.go

This file was deleted.

0 comments on commit c3ec4e6

Please sign in to comment.