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 2021/11/12 12:29:09 UTC

[GitHub] [incubator-yunikorn-core] pbacsko commented on a change in pull request #336: [YUNIKORN-940] Periodic & on-demand state dump in Yunikorn

pbacsko commented on a change in pull request #336:
URL: https://github.com/apache/incubator-yunikorn-core/pull/336#discussion_r748246338



##########
File path: pkg/webservice/handlers_test.go
##########
@@ -1279,3 +1282,159 @@ func TestGetNodesUtilization(t *testing.T) {
 	assert.NilError(t, err)
 	assert.Equal(t, len(nodesDao), 0)
 }
+
+func TestGetFullStateDump(t *testing.T) {
+	schedulerContext = prepareSchedulerContext(t)
+
+	imHistory = history.NewInternalMetricsHistory(5)
+	req, err := http.NewRequest("GET", "/ws/v1/getfullstatedump", strings.NewReader(""))
+	req = mux.SetURLVars(req, make(map[string]string))
+	assert.NilError(t, err)
+	resp := &MockResponseWriter{}
+
+	getFullStateDump(resp, req)
+	receivedBytes := resp.outputBytes
+	statusCode := resp.statusCode
+	assert.Assert(t, len(receivedBytes) > 0, "json response is empty")
+	assert.Check(t, statusCode != http.StatusInternalServerError, "response status code")
+	var aggregated AggregatedStateInfo
+	if err := json.Unmarshal(receivedBytes, &aggregated); err != nil {
+		t.Fatal(err)
+	}
+	verifyStateDumpJSON(t, &aggregated)
+}
+
+func TestEnableDisablePeriodicStateDump(t *testing.T) {
+	schedulerContext = prepareSchedulerContext(t)
+	defer deleteStateDumpFile()
+	defer terminateGoroutine()
+
+	imHistory = history.NewInternalMetricsHistory(5)

Review comment:
       Yes, we do. There is a part which turns to `imHistory`, so it has to be initialized.




-- 
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