-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Required-githooks: true Signed-off-by: Wang Shilong <[email protected]>
- Loading branch information
1 parent
d7ac613
commit 177637a
Showing
15 changed files
with
1,759 additions
and
12 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// | ||
// (C) Copyright 2021-2024 Intel Corporation. | ||
// | ||
// SPDX-License-Identifier: BSD-2-Clause-Patent | ||
// | ||
|
||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/daos-stack/daos/src/control/lib/daos" | ||
"github.com/golang/mock/gomock" | ||
|
||
"github.com/daos-stack/daos/src/control/common/test" | ||
) | ||
|
||
func TestDaos_PoolQuery(t *testing.T) { | ||
for name, tc := range map[string]struct { | ||
arg daos.PoolQueryMask | ||
expEnabledCount int | ||
expDisabledCount int | ||
expSuspectCount int | ||
expErr error | ||
}{ | ||
"default Query mask": { | ||
arg: daos.DefaultPoolQueryMask, | ||
expEnabledCount: 0, | ||
expDisabledCount: 2, | ||
expSuspectCount: 0, | ||
}, | ||
"Health Query mask": { | ||
arg: daos.HealthOnlyPoolQueryMask, | ||
expEnabledCount: 0, | ||
expDisabledCount: 2, | ||
expSuspectCount: 3, | ||
}, | ||
"Query All mask": { | ||
arg: daos.PoolQueryMask(^uint64(0)), | ||
expEnabledCount: 1, | ||
expDisabledCount: 2, | ||
expSuspectCount: 3, | ||
}, | ||
"Query nothing": { | ||
arg: daos.PoolQueryMask(uint64(0)), | ||
expEnabledCount: 0, | ||
expDisabledCount: 0, | ||
expSuspectCount: 0, | ||
}, | ||
} { | ||
t.Run(name, func(t *testing.T) { | ||
ctrl := gomock.NewController(t) | ||
defer ctrl.Finish() | ||
|
||
mockDAOS := NewMockDAOSInterface(ctrl) | ||
poolInfo, gotErr := MockQueryPool(mockDAOS, tc.arg) | ||
test.CmpErr(t, tc.expErr, gotErr) | ||
if tc.expErr != nil { | ||
return | ||
} | ||
|
||
test.AssertEqual(t, tc.expEnabledCount, poolInfo.EnabledRanks.Count(), "unexpected enabled count") | ||
test.AssertEqual(t, tc.expDisabledCount, poolInfo.DisabledRanks.Count(), "unexpected disabled count") | ||
test.AssertEqual(t, tc.expSuspectCount, poolInfo.DeadRanks.Count(), "unexpected suspect count") | ||
}) | ||
} | ||
|
||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
src/control/vendor/github.com/golang/mock/CONTRIBUTORS
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.