chia7712 commented on code in PR #915:
URL: https://github.com/apache/yunikorn-core/pull/915#discussion_r1674709388
##########
pkg/common/security/usergroup_test_resolver.go:
##########
@@ -41,15 +41,17 @@ func GetUserGroupCacheTest() *UserGroupCache {
// test function only
func lookup(userName string) (*user.User, error) {
// 1st test user: all OK
- if userName == "testuser1" {
+ const Testuser1 = "testuser1"
Review Comment:
Maybe we can move those constants to the beginning? for example:
```go
const (
Testuser1 = "testuser1"
Testuser2 = "testuser2"
)
```
##########
pkg/scheduler/placement/fixed_rule_test.go:
##########
@@ -62,7 +62,7 @@ func TestFixedRule(t *testing.T) {
func TestFixedRulePlace(t *testing.T) {
// Create the structure for the test
- data := `
+ const data = `
Review Comment:
we should move this to `testrule_test.go` as other occurrences are using the
method `testrule_test#initQueueStructure`
##########
pkg/scheduler/placement/filter_test.go:
##########
@@ -321,12 +321,13 @@ func TestAllowUser(t *testing.T) {
Groups: nil,
}
// test deny user list
+ const testUser1 = "user1"
Review Comment:
ditto
##########
pkg/scheduler/placement/placement_test.go:
##########
@@ -193,7 +193,8 @@ func TestManagerBuildRule(t *testing.T) {
t.Errorf("test rule build should not have failed and created 2
top level rule, err: %v, rules: %v", err, ruleObjs)
} else {
parent := ruleObjs[0].getParent()
- if parent == nil || parent.getName() != "test" {
+ const Test = "test"
+ if parent == nil || parent.getName() != Test {
Review Comment:
ditto
##########
pkg/webservice/handlers_test.go:
##########
@@ -666,19 +666,19 @@ func TestGetNodesUtilJSON(t *testing.T) {
partition := setup(t, configDefault, 1)
// create test application
- appID := "app1"
+ const appID = "app1"
Review Comment:
ditto
##########
pkg/scheduler/objects/allocation_ask_test.go:
##########
@@ -117,6 +117,7 @@ func TestPreemptCheckTime(t *testing.T) {
}
func TestPlaceHolder(t *testing.T) {
+ const testGroupName = "testgroup"
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]