---
"Test cat thread_pool output":

  - do:
      cat.thread_pool: {}

  - match:
      $body: |
               /  #node_name     name     active     queue     rejected
               ^  (\S+       \s+ \S+  \s+ \d+    \s+ \d+   \s+ \d+      \n)+  $/

  - do:
      cat.thread_pool:
          v: true

  - match:
        $body: |
                 /^   node_name \s+ name \s+ active \s+ queue \s+ rejected \n
                     (\S+       \s+ \S+  \s+ \d+    \s+ \d+   \s+ \d+      \n)+  $/

  - do:
      cat.thread_pool:
          h: pid,id,h,i,po

  - match:
      $body: |
               /  #pid       id          host       ip                          port
                  (\d+  \s+  \S+    \s+  \S+   \s+  (\d{1,3}\.){3}\d{1,3}  \s+  (\d+|-)  \n)+  $/

  - do:
      cat.thread_pool:
          thread_pool_patterns: bulk,management,flush,index,generic,force_merge
          h: id,name,active
          v: true

  - match:
      $body: |
               /^  id \s+ name        \s+ active \n
                  (\S+\s+ bulk        \s+ \d+    \n
                   \S+\s+ flush       \s+ \d+    \n
                   \S+\s+ force_merge \s+ \d+    \n
                   \S+\s+ generic     \s+ \d+    \n
                   \S+\s+ index       \s+ \d+    \n
                   \S+\s+ management  \s+ \d+    \n)+  $/

  - do:
      cat.thread_pool:
          thread_pool_patterns: bulk
          h: id,name,type,active,size,queue,queue_size,rejected,largest,completed,min,max,keep_alive
          v: true

  - match:
      $body: |
               /^  id  \s+ name \s+ type  \s+ active \s+ size \s+ queue \s+ queue_size \s+ rejected \s+ largest \s+ completed \s+ min \s+ max \s+ keep_alive \n
                  (\S+ \s+ bulk \s+ fixed \s+ \d+    \s+ \d+  \s+ \d+   \s+ (-1|\d+)   \s+ \d+      \s+ \d+     \s+ \d+       \s+ \d* \s+ \d* \s+ \S*        \n)+  $/

  - do:
      cat.thread_pool:
          thread_pool_patterns: fetch*
          h: id,name,type,active,size,queue,queue_size,rejected,largest,completed,min,max,keep_alive
          v: true

  - match:
      $body: |
               /^  id  \s+ name                \s+ type    \s+ active \s+ size \s+ queue \s+ queue_size \s+ rejected \s+ largest \s+ completed \s+ min \s+ max \s+ keep_alive \n
                  (\S+ \s+ fetch_shard_started \s+ scaling \s+ \d+    \s+ \d+  \s+ \d+   \s+ (-1|\d+)   \s+ \d+      \s+ \d+     \s+ \d+       \s+ \d* \s+ \d* \s+ \S*        \n
                   \S+ \s+ fetch_shard_store   \s+ scaling \s+ \d+    \s+ \d+  \s+ \d+   \s+ (-1|\d+)   \s+ \d+      \s+ \d+     \s+ \d+       \s+ \d* \s+ \d* \s+ \S*        \n)+  $/

  - do:
      cat.thread_pool:
          thread_pool_patterns: bulk,index,search
          size: ""

  - match:
      $body: |
               /  #node_name     name       active     queue     rejected
               ^  (\S+       \s+ bulk   \s+ \d+    \s+ \d+   \s+ \d+      \n
                   \S+       \s+ index  \s+ \d+    \s+ \d+   \s+ \d+      \n
                   \S+       \s+ search \s+ \d+    \s+ \d+   \s+ \d+      \n)+  $/
