Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Christopher Meis <christopher.meis@9elements.com>
- Loading branch information
Showing
10 changed files
with
107 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2019-2021 the u-root Authors. All rights reserved | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package ipmi | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
"time" | ||
|
||
"golang.org/x/sys/unix" | ||
) | ||
|
||
type mock struct { | ||
unixSyscall func(uintptr, uintptr, uintptr, uintptr) (uintptr, uintptr, unix.Errno) | ||
|
||
// fileSyscallConn gives the option to overwrite the actual function call with a dummy function when writing tests. | ||
fileSyscallConn func(f *os.File) (syscall.RawConn, error) | ||
|
||
// fileSetReadDeadline gives the option to overwrite the actual function call with a dummy function when writing tests. | ||
fileSetReadDeadline func(f *os.File, t time.Duration) error | ||
|
||
// connRead gives the option to overwrite the actual function call with a dummy function when writing tests. | ||
connRead func(f func(fd uintptr) bool, conn syscall.RawConn) error | ||
} | ||
|
||
func (m *mock) SendRequest(req *request) error { | ||
return nil | ||
} | ||
|
||
func (m *mock) ReceiveResponse(msgID int64, resp *response, buf []byte) ([]byte, error) { | ||
return buf, nil | ||
} | ||
|
||
func (m *mock) GetFile() *os.File { | ||
return nil | ||
} | ||
|
||
func GetMockIPMI() *IPMI { | ||
return &IPMI{Handler: &mock{ | ||
unixSyscall: nil, | ||
fileSyscallConn: nil, | ||
fileSetReadDeadline: nil, | ||
connRead: nil, | ||
}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters