You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@yunikorn.apache.org by GitBox <gi...@apache.org> on 2022/12/24 07:20:02 UTC

[GitHub] [yunikorn-core] wusamzong opened a new pull request, #489: [YUNIKORN-1487] Add test for NewConfiguredQueue()

wusamzong opened a new pull request, #489:
URL: https://github.com/apache/yunikorn-core/pull/489

   ### What is this PR for?
   I add a test for NewConfiguraedQueue(). 
   The test contains three part:
   1. check simple variable assignment
   2. adding leaf to queue
   3. adding non-leaf to queue
   
   
   ### What type of PR is it?
   * [x] - Task
   
   ### Todos
   * [ ] - Task
   
   ### What is the Jira issue?
   * Open an issue on Jira https://issues.apache.org/jira/browse/YUNIKORN-1487/
   
   ### How should this be tested?
   
   ### Screenshots (if appropriate)
   
   ### Questions:
   * [ ] - The licenses files need update.
   * [ ] - There is breaking changes for older versions.
   * [ ] - It needs documentation.
   


-- 
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: reviews-unsubscribe@yunikorn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [yunikorn-core] wilfred-s commented on a diff in pull request #489: [YUNIKORN-1487] Add test for NewConfiguredQueue()

Posted by GitBox <gi...@apache.org>.
wilfred-s commented on code in PR #489:
URL: https://github.com/apache/yunikorn-core/pull/489#discussion_r1058062419


##########
pkg/scheduler/objects/queue_test.go:
##########
@@ -1545,6 +1545,67 @@ func TestApplyConf(t *testing.T) {
 	assert.Assert(t, root.guaranteedResource == nil)
 }
 
+func TestNewConfiguredQueue(t *testing.T) {
+	// check variable assignment
+	properties := getProperties()
+	resourceConf := getResourceConf()
+	parentConfig := configs.QueueConfig{
+		Name:            "PARENT_QUEUE",
+		Parent:          true,
+		MaxApplications: uint64(32),
+		ChildTemplate: configs.ChildTemplate{
+			Properties: properties,
+			Resources: configs.Resources{
+				Max:        resourceConf,
+				Guaranteed: resourceConf,
+			},
+		},
+	}
+	parent, err := NewConfiguredQueue(parentConfig, nil)
+	assert.NilError(t, err, "failed to create queue: %v", err)
+	assert.Equal(t, parent.Name, "parent_queue")
+	assert.Equal(t, parent.QueuePath, "parent_queue")
+	assert.Equal(t, parent.isManaged, true)
+	assert.Equal(t, parent.maxRunningApps, uint64(32))
+	assert.Assert(t, reflect.DeepEqual(properties, parent.template.GetProperties()))
+	// turn resouce config into resource struct
+	resourceStruct, err := resources.NewResourceFromConf(resourceConf)
+	assert.NilError(t, err, "failed to create new resource from config: %v", err)

Review Comment:
   move with the line that creates the resource conf (1551) for clarity



##########
pkg/scheduler/objects/queue_test.go:
##########
@@ -1545,6 +1545,67 @@ func TestApplyConf(t *testing.T) {
 	assert.Assert(t, root.guaranteedResource == nil)
 }
 
+func TestNewConfiguredQueue(t *testing.T) {
+	// check variable assignment
+	properties := getProperties()
+	resourceConf := getResourceConf()
+	parentConfig := configs.QueueConfig{
+		Name:            "PARENT_QUEUE",
+		Parent:          true,
+		MaxApplications: uint64(32),
+		ChildTemplate: configs.ChildTemplate{
+			Properties: properties,
+			Resources: configs.Resources{
+				Max:        resourceConf,
+				Guaranteed: resourceConf,
+			},
+		},
+	}
+	parent, err := NewConfiguredQueue(parentConfig, nil)
+	assert.NilError(t, err, "failed to create queue: %v", err)
+	assert.Equal(t, parent.Name, "parent_queue")
+	assert.Equal(t, parent.QueuePath, "parent_queue")
+	assert.Equal(t, parent.isManaged, true)
+	assert.Equal(t, parent.maxRunningApps, uint64(32))
+	assert.Assert(t, reflect.DeepEqual(properties, parent.template.GetProperties()))
+	// turn resouce config into resource struct
+	resourceStruct, err := resources.NewResourceFromConf(resourceConf)
+	assert.NilError(t, err, "failed to create new resource from config: %v", err)
+	assert.Assert(t, reflect.DeepEqual(resourceStruct, parent.template.GetMaxResource()))
+	assert.Assert(t, reflect.DeepEqual(resourceStruct, parent.template.GetGuaranteedResource()))
+
+	// case 0: leaf can use template
+	leafConfig := configs.QueueConfig{
+		Name:       "leaf_queue",
+		Parent:     false,
+		Properties: getProperties(),
+		Resources: configs.Resources{
+			Max:        getResourceConf(),
+			Guaranteed: getResourceConf(),
+		},
+	}
+	childLeaf, err := NewConfiguredQueue(leafConfig, parent)
+	assert.NilError(t, err, "failed to create queue: %v", err)
+	assert.Equal(t, childLeaf.QueuePath, "parent_queue.leaf_queue")
+	assert.Assert(t, childLeaf.template == nil)
+	assert.Assert(t, reflect.DeepEqual(childLeaf.properties, parent.template.GetProperties()))
+	assert.Assert(t, reflect.DeepEqual(childLeaf.maxResource, parent.template.GetMaxResource()))
+	assert.Assert(t, reflect.DeepEqual(childLeaf.guaranteedResource, parent.template.GetGuaranteedResource()))

Review Comment:
   use `resources.Equals()` for the check. If by coincidence we get a zero value for a quantity the config and the set value will not be the same as we ignore zero max and guaranteed. It is safer in the long run as it tests expected behaviour.



-- 
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: reviews-unsubscribe@yunikorn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [yunikorn-core] wilfred-s closed pull request #489: [YUNIKORN-1487] Add test for NewConfiguredQueue()

Posted by GitBox <gi...@apache.org>.
wilfred-s closed pull request #489: [YUNIKORN-1487] Add test for NewConfiguredQueue()
URL: https://github.com/apache/yunikorn-core/pull/489


-- 
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: reviews-unsubscribe@yunikorn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [yunikorn-core] codecov[bot] commented on pull request #489: [YUNIKORN-1487] Add test for NewConfiguredQueue()

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #489:
URL: https://github.com/apache/yunikorn-core/pull/489#issuecomment-1364478261

   # [Codecov](https://codecov.io/gh/apache/yunikorn-core/pull/489?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#489](https://codecov.io/gh/apache/yunikorn-core/pull/489?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (760a5a1) into [master](https://codecov.io/gh/apache/yunikorn-core/commit/234c8b12fba74e71a4010cd455e80f6e11ec8ad1?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (234c8b1) will **increase** coverage by `0.56%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #489      +/-   ##
   ==========================================
   + Coverage   72.51%   73.07%   +0.56%     
   ==========================================
     Files          67       69       +2     
     Lines       10110    10371     +261     
   ==========================================
   + Hits         7331     7579     +248     
   - Misses       2533     2544      +11     
   - Partials      246      248       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/yunikorn-core/pull/489?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [pkg/webservice/state\_dump.go](https://codecov.io/gh/apache/yunikorn-core/pull/489/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3dlYnNlcnZpY2Uvc3RhdGVfZHVtcC5nbw==) | `70.00% <0.00%> (-9.48%)` | :arrow_down: |
   | [pkg/common/utils.go](https://codecov.io/gh/apache/yunikorn-core/pull/489/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbW1vbi91dGlscy5nbw==) | `86.66% <0.00%> (-6.94%)` | :arrow_down: |
   | [pkg/scheduler/objects/sorters.go](https://codecov.io/gh/apache/yunikorn-core/pull/489/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3NjaGVkdWxlci9vYmplY3RzL3NvcnRlcnMuZ28=) | `97.00% <0.00%> (-3.00%)` | :arrow_down: |
   | [pkg/common/configs/configvalidator.go](https://codecov.io/gh/apache/yunikorn-core/pull/489/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbW1vbi9jb25maWdzL2NvbmZpZ3ZhbGlkYXRvci5nbw==) | `84.69% <0.00%> (-1.93%)` | :arrow_down: |
   | [pkg/scheduler/health\_checker.go](https://codecov.io/gh/apache/yunikorn-core/pull/489/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3NjaGVkdWxlci9oZWFsdGhfY2hlY2tlci5nbw==) | `84.49% <0.00%> (-0.71%)` | :arrow_down: |
   | [pkg/scheduler/partition.go](https://codecov.io/gh/apache/yunikorn-core/pull/489/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3NjaGVkdWxlci9wYXJ0aXRpb24uZ28=) | `76.93% <0.00%> (-0.23%)` | :arrow_down: |
   | [pkg/webservice/handlers.go](https://codecov.io/gh/apache/yunikorn-core/pull/489/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3dlYnNlcnZpY2UvaGFuZGxlcnMuZ28=) | `77.37% <0.00%> (-0.11%)` | :arrow_down: |
   | [pkg/common/configs/configs.go](https://codecov.io/gh/apache/yunikorn-core/pull/489/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbW1vbi9jb25maWdzL2NvbmZpZ3MuZ28=) | `83.67% <0.00%> (ø)` | |
   | [pkg/scheduler/policies/priority\_policy.go](https://codecov.io/gh/apache/yunikorn-core/pull/489/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3NjaGVkdWxlci9wb2xpY2llcy9wcmlvcml0eV9wb2xpY3kuZ28=) | `100.00% <0.00%> (ø)` | |
   | [pkg/scheduler/policies/preemption\_policy.go](https://codecov.io/gh/apache/yunikorn-core/pull/489/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3NjaGVkdWxlci9wb2xpY2llcy9wcmVlbXB0aW9uX3BvbGljeS5nbw==) | `100.00% <0.00%> (ø)` | |
   | ... and [4 more](https://codecov.io/gh/apache/yunikorn-core/pull/489/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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: reviews-unsubscribe@yunikorn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org