Skip to content

Commit

Permalink
Confirm scraping queue lengths works
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartnelson3 committed May 2, 2018
1 parent ec84bdc commit 02cce57
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions main_test.go
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"flag"
"io/ioutil"
"math"
"net/http"
"net/http/httptest"
"os"
Expand Down Expand Up @@ -51,11 +52,22 @@ func TestParsing(t *testing.T) {
if len(info.SuperGroups) == 0 {
t.Fatalf("%v: no supergroups in output", name)
}

topLevelQueue := parseFloat(info.TopLevelRequestsInQueue)
if topLevelQueue == 0 {
t.Fatalf("%v: no queuing requests parsed from output", name)
}

for _, sg := range info.SuperGroups {
if want, got := "/src/app/my_app", sg.Group.Options.AppRoot; want != got {
t.Fatalf("%s: incorrect app_root: wanted %s, got %s", name, want, got)
}

queue := parseFloat(sg.RequestsInQueue)
if queue == math.NaN() {
t.Fatalf("%v: failed to parse requests in queue", name)
}

if len(sg.Group.Processes) == 0 {
t.Fatalf("%v: no processes in output", name)
}
Expand Down
4 changes: 2 additions & 2 deletions testdata/passenger_xml_output.xml
Expand Up @@ -5,12 +5,12 @@
<process_count>48</process_count>
<max>48</max>
<capacity_used>48</capacity_used>
<get_wait_list_size>0</get_wait_list_size>
<get_wait_list_size>3</get_wait_list_size>
<supergroups>
<supergroup>
<name>/srv/app/my_app &#40;production&#41;</name>
<state>READY</state>
<get_wait_list_size>0</get_wait_list_size>
<get_wait_list_size>5</get_wait_list_size>
<capacity_used>48</capacity_used>
<group default="true">
<name>/srv/app/my_app &#40;production&#41;</name>
Expand Down

0 comments on commit 02cce57

Please sign in to comment.