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



##########
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)
+       req, err := http.NewRequest("GET", "/ws/v1/enableperiodicstatedump", 
strings.NewReader(""))
+       vars := map[string]string{
+               "period": "3",
+       }
+       req = mux.SetURLVars(req, vars)
+
+       assert.NilError(t, err)
+       resp := &MockResponseWriter{}
+
+       // enable state dump, check file contents
+       enablePeriodicStateDump(resp, req)
+       statusCode := resp.statusCode
+       assert.Check(t, statusCode != http.StatusInternalServerError, "response 
status code")

Review comment:
       It does not stop the execution of the test if it fails. But we can 
switch back to the normal assert.




-- 
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-unsubscr...@yunikorn.apache.org

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


Reply via email to