Documentation ¶
Overview ¶
(C) Copyright 2019 Intel Corporation.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.
(C) Copyright 2019 Intel Corporation.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.
Index ¶
- Constants
- func All(ss []string, f func(string) bool) bool
- func Any(ss []string, f func(string) bool) bool
- func AppendFile(path string) (*os.File, error)
- func AssertEqual(t *testing.T, a interface{}, b interface{}, message string)
- func AssertFalse(t *testing.T, b bool, message string)
- func AssertStringsEqual(t *testing.T, a []string, b []string, message string)
- func AssertTrue(t *testing.T, b bool, message string)
- func CmpErr(t *testing.T, want, got error)
- func CmpErrBool(want, got error) bool
- func CreateTestDir(t *testing.T) (string, func())
- func DefaultCmpOpts() []cmp.Option
- func ExpectError(t *testing.T, actualErr error, expectedMessage string, desc interface{})
- func Filter(ss []string, f func(string) bool) (nss []string)
- func FindBinary(binName string) (string, error)
- func GetAbsInstallPath(relPath string) (string, error)
- func GetConsent(log logging.Logger) bool
- func GetFilePaths(dir string, ext string) ([]string, error)
- func Include(ss []string, target string) bool
- func Index(ss []string, target string) int
- func IsAlphabetic(s string) bool
- func LoadTestFiles(inFile string, outFile string) (inputs [][]string, outputs [][]string, err error)
- func Map(ss []string, f func(string) string) (nss []string)
- func MemberResultsToPB(results SystemMemberResults) []*ctlpb.SystemStopResp_Result
- func MembersToPB(members SystemMembers) []*ctlpb.SystemMember
- func MockCheckMountOk(path string) error
- func Pluralise(s string, n int) string
- func PrintStructs(name string, i interface{})
- func Run(cmd string) error
- func ScrubEnvironment(blacklist []string)
- func ScrubEnvironmentExcept(whitelist []string)
- func ScrubProxyVariables()
- func ShowBufferOnFailure(t *testing.T, buf fmt.Stringer)
- func SplitFile(path string) (sections [][]string, err error)
- func StructsToString(i interface{}) (lines string, err error)
- func SyncDir(path string) (err error)
- func TruncFile(path string) (*os.File, error)
- func WriteFileAtomic(path string, data []byte, perm os.FileMode) error
- func WriteSlice(path string, slice []string) (err error)
- func WriteString(path string, s string) error
- type Membership
- type SystemMember
- type SystemMemberResult
- type SystemMemberResults
- type SystemMembers
Constants ¶
const DisableProxyScrubEnv = "DAOS_DISABLE_PROXY_SCRUB"
const UtilLogDepth = 4
UtilLogDepth signifies stack depth, set calldepth on calls to logger so log message context refers to caller not callee.
Variables ¶
This section is empty.
Functions ¶
func AppendFile ¶
AppendFile appends to existing or creates new file with default options
func AssertEqual ¶
AssertEqual asserts b is equal to a
Whilst suitable in most situations, reflect.DeepEqual() may not be suitable for nontrivial struct element comparisons, go-cmp should then be used but will introduce a third party dep.
func AssertFalse ¶
AssertFalse asserts b is false
func AssertStringsEqual ¶
AssertStringsEqual sorts string slices before comparing.
func AssertTrue ¶
AssertTrue asserts b is true
func CmpErr ¶
CmpErr compares two errors for equality or at least close similarity in their messages.
func CmpErrBool ¶ added in v0.8.0
CmpErrBool compares two errors and returns a boolean value indicating equality or at least close similarity between their messages.
func CreateTestDir ¶
CreateTestDir creates a temporary test directory. It returns the path to the directory and a cleanup function.
func DefaultCmpOpts ¶
DefaultCmpOpts gets default go-cmp comparison options for tests.
func ExpectError ¶
ExpectError asserts error contains expected message
func FindBinary ¶
FindBinary attempts to locate the named binary by checking $PATH first. If the binary is not found in $PATH, then it looks in the directory containing the binary for the running process.
func GetAbsInstallPath ¶
GetAbsInstallPath retrieves absolute path of files in daos install dir
func GetFilePaths ¶
GetFilePaths return full file paths in given directory with matching file extensions
func IsAlphabetic ¶
IsAlphabetic checks of a string just contains alphabetic characters.
func LoadTestFiles ¶
func LoadTestFiles(inFile string, outFile string) ( inputs [][]string, outputs [][]string, err error)
LoadTestFiles reads inputs and outputs from file and do basic sanity checks. Both files contain entries of multiple lines separated by blank line. Return inputs and outputs, both of which are slices of string slices.
func MemberResultsToPB ¶
func MemberResultsToPB(results SystemMemberResults) []*ctlpb.SystemStopResp_Result
MemberResultsToPB converts SystemMemberResults to equivalent protobuf format.
func MembersToPB ¶
func MembersToPB(members SystemMembers) []*ctlpb.SystemMember
MembersToPB converts internal member structs to protobuf equivalents.
func MockCheckMountOk ¶
MockCheckMountOk mocks CheckMount and always returns nil error.
func PrintStructs ¶
func PrintStructs(name string, i interface{})
PrintStructs dumps friendly YAML representation of structs to stdout proceeded with "name" identifier.
func ScrubEnvironment ¶
func ScrubEnvironment(blacklist []string)
ScrubEnvironment modifies the environment variables set for this process and any children which inherit its environment by unsetting any variables supplied in the blacklist.
func ScrubEnvironmentExcept ¶
func ScrubEnvironmentExcept(whitelist []string)
ScrubEnvironmentExcept modifies the environment variables set for this process and any children which inherit its environment by unsetting any variables that are not supplied in the whitelist.
func ScrubProxyVariables ¶
func ScrubProxyVariables()
ScrubProxyVariables removes proxy variables from the process environment.
func ShowBufferOnFailure ¶
ShowBufferOnFailure displays captured output on test failure. Should be run via defer in the test function.
func SplitFile ¶
SplitFile separates file content into contiguous sections separated by a blank line.
func StructsToString ¶
StructsToString returns yaml representation (as a list of strings) of any interface but avoids fields/lines prefixed with xxx_ such as added by protobuf boilerplate.
func SyncDir ¶
SyncDir flushes all prior modifications to a directory. This is required if one modifies a directory (e.g., by creating a new file in it) and needs to wait for this modification to become persistent.
func WriteFileAtomic ¶
WriteFileAtomic mimics ioutil.WriteFile, but it makes sure the file is either successfully written persistently or untouched.
func WriteSlice ¶
WriteSlice writes string slice to specified file, overwriting and creating if non-existent.
func WriteString ¶
WriteString writes string to specified file, wrapper around WriteSlice.
Types ¶
type Membership ¶
Membership tracks details of system members.
func NewMembership ¶
func NewMembership(log logging.Logger) *Membership
func (*Membership) Add ¶
func (m *Membership) Add(member SystemMember) (int, error)
Add adds member to membership.
func (*Membership) GetMember ¶
func (m *Membership) GetMember(uuid string) (*SystemMember, error)
GetMember retrieves member from membership based on UUID.
func (*Membership) GetMembers ¶
func (m *Membership) GetMembers() SystemMembers
GetMembers returns internal member structs as a sequence.
func (*Membership) Remove ¶
func (m *Membership) Remove(uuid string)
Remove removes member from membership, idenpotent.
Avoid taking a RW lock where possible.
type SystemMember ¶
SystemMember refers to a data-plane instance that is a member of this DAOS system running on host with the control-plane listening at "Addr".
func (SystemMember) String ¶
func (sm SystemMember) String() string
type SystemMemberResult ¶
SystemMemberResult refers to the result of an action on a SystemMember identified by string representation "address/uuid/rank".
func (SystemMemberResult) String ¶
func (smr SystemMemberResult) String() string
type SystemMemberResults ¶
type SystemMemberResults []*SystemMemberResult
func MemberResultsFromPB ¶
func MemberResultsFromPB(log logging.Logger, pbResults []*ctlpb.SystemStopResp_Result) SystemMemberResults
MemberResultsFromPB converts results from member actions (protobuf format) to SystemMemberResults.
func (SystemMemberResults) String ¶
func (smrs SystemMemberResults) String() string
type SystemMembers ¶
type SystemMembers []*SystemMember
func MembersFromPB ¶
func MembersFromPB(log logging.Logger, pbMembers []*ctlpb.SystemMember) SystemMembers
MembersFromPB converts to member slice from protobuf format.
Don't populate member Addr field if it can't be resolved.
func (SystemMembers) String ¶
func (sms SystemMembers) String() string