106. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/2/2017 1:40:07 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

106.1 Files compared

# Location File Last Modified
1 chef-repo.zip\chef-repo\project_cookbooks\mocks\files\default\node-mocks\nodeMockServices-1.3.0.52.zip\node_modules\bunyan\test cli.test.js Tue Apr 2 01:16:54 2013 UTC
2 chef-repo.zip\chef-repo\project_cookbooks\mocks\files\default\node-mocks\nodeMockServices-1.3.0.52.zip\node_modules\bunyan\test cli.test.js Mon Oct 2 15:48:14 2017 UTC

106.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 4 754
Changed 3 6
Inserted 0 0
Removed 0 0

106.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

106.4 Active regular expressions

No regular expressions were active.

106.5 Comparison detail

  1   /*
  2    * Copyrig ht (c) 201 2 Trent Mi ck. All ri ghts reser ved.
  3    *
  4    * Test th e `bunyan`  CLI.
  5    */
  6  
  7   var path =  require(' path');
  8   var exec =  require(' child_proc ess').exec ;
  9   var _ = re quire('uti l').format ;
  10   var debug  = console. warn;
  11  
  12   // node-ta p API
  13   if (requir e.cache[__ dirname +  '/tap4node unit.js'])
  14           de lete requi re.cache[_ _dirname +  '/tap4nod eunit.js'] ;
  15   var tap4no deunit = r equire('./ tap4nodeun it.js');
  16   var after  = tap4node unit.after ;
  17   var before  = tap4nod eunit.befo re;
  18   var test =  tap4nodeu nit.test;
  19  
  20  
  21  
  22   var BUNYAN  = path.re solve(__di rname, '.. /bin/bunya n');
  23  
  24   //child =  exec('cat  *.js bad_f ile | wc - l',
  25   //  functi on (error,  stdout, s tderr) {
  26   //    cons ole.log('s tdout: ' +  stdout);
  27   //    cons ole.log('s tderr: ' +  stderr);
  28   //    if ( error !==  null) {
  29   //      co nsole.log( 'exec erro r: ' + err or);
  30   //    }
  31   //});
  32  
  33   test('--ve rsion', fu nction (t)  {
  34       var ve rsion = re quire('../ package.js on').versi on;
  35       exec(B UNYAN + '  --version' , function  (err, std out, stder r) {
  36           t. ifError(er r)
  37           t. equal(stdo ut, 'bunya n ' + vers ion + '\n' );
  38           t. end();
  39       });
  40   });
  41  
  42   test('--he lp', funct ion (t) {
  43       exec(B UNYAN + '  --help', f unction (e rr, stdout , stderr)  {
  44           t. ifError(er r)
  45           t. ok(stdout. indexOf('G eneral opt ions:') != = -1);
  46           t. end();
  47       });
  48   });
  49  
  50   test('-h',  function  (t) {
  51       exec(B UNYAN + '  -h', funct ion (err,  stdout, st derr) {
  52           t. ifError(er r)
  53           t. ok(stdout. indexOf('G eneral opt ions:') != = -1);
  54           t. end();
  55       });
  56   });
  57  
  58   test('--bo gus', func tion (t) {
  59       exec(B UNYAN + '  --bogus',  function ( err, stdou t, stderr)  {
  60           t. ok(err, 's hould erro r out')
  61           t. equal(err. code, 1, ' ... with e xit code 1 ')
  62           t. end();
  63       });
  64   });
  65  
  66   test('simp le.log', f unction (t ) {
  67       exec(_ ('%s %s/co rpus/simpl e.log', BU NYAN, __di rname),
  68                 functio n (err, st dout, stde rr) {
  69           t. ifError(er r)
  70           t. equal(stdo ut,
  71                '[2012-0 2-08T22:56 :52.856Z]   INFO: mys ervice/123  on exampl e.com: '
  72                + 'My me ssage\n');
  73           t. end();
  74       });
  75   });
  76   test('cat  simple.log ', functio n (t) {
  77       exec(_ ('cat %s/c orpus/simp le.log | % s', __dirn ame, BUNYA N),
  78           fu nction (er r, stdout,  stderr) {
  79                t.ifErro r(err)
  80                t.equal( stdout,
  81                    /* J SSTYLED */
  82                    '[20 12-02-08T2 2:56:52.85 6Z]  INFO:  myservice /123 on ex ample.com:  My messag e\n');
  83                t.end();
  84           }
  85       );
  86   });
  87   test('simp le.log wit h color',  function ( t) {
  88       exec(_ ('%s --col or %s/corp us/simple. log', BUNY AN, __dirn ame),
  89           fu nction (er r, stdout,  stderr) {
  90           t. ifError(er r)
  91           t. equal(stdo ut,
  92                /* JSSTY LED */
  93                '[2012-0 2-08T22:56 :52.856Z]  \u001b[36m  INFO\u001 b[39m: mys ervice/123  on exampl e.com: \u0 01b[36mMy  message\u0 01b[39m\n\ u001b[0m') ;
  94           t. end();
  95       });
  96   });
  97  
  98   test('extr afield.log ', functio n (t) {
  99       exec(_ ('%s %s/co rpus/extra field.log' , BUNYAN,  __dirname) ,
  100                 functio n (err, st dout, stde rr) {
  101           t. ifError(er r)
  102           t. equal(stdo ut,
  103                '[2012-0 2-08T22:56 :52.856Z]   INFO: mys ervice/123  on exampl e.com: '
  104                + 'My me ssage (ext ra=field)\ n');
  105           t. end();
  106       });
  107   });
  108   test('extr afield.log  with colo r', functi on (t) {
  109       exec(_ ('%s --col or %s/corp us/extrafi eld.log',  BUNYAN, __ dirname),
  110                 functio n (err, st dout, stde rr) {
  111           t. ifError(er r)
  112           t. equal(stdo ut,
  113                '[2012-0 2-08T22:56 :52.856Z]  \u001b[36m  INFO\u001 b[39m: '
  114                + 'myser vice/123 '
  115                + 'on ex ample.com:  \u001b[36 mMy messag e\u001b[39 m'
  116                + '\u001 b[90m (ext ra=field)\ u001b[39m\ n\u001b[0m ');
  117           t. end();
  118       });
  119   });
  120  
  121   test('bogu s.log', fu nction (t)  {
  122       exec(_ ('%s %s/co rpus/bogus .log', BUN YAN, __dir name),
  123                 functio n (err, st dout, stde rr) {
  124           t. ifError(er r)
  125           t. equal(stdo ut, 'not a  JSON line \n{"hi": " there"}\n' );
  126           t. end();
  127       });
  128   });
  129  
  130   test('bogu s.log -j',  function  (t) {
  131       exec(_ ('%s -j %s /corpus/bo gus.log',  BUNYAN, __ dirname),
  132                 functio n (err, st dout, stde rr) {
  133           t. ifError(er r)
  134           t. equal(stdo ut, 'not a  JSON line \n{"hi": " there"}\n' );
  135           t. end();
  136       });
  137   });
  138  
  139   test('all. log', func tion (t) {
  140       exec(_ ('%s %s/co rpus/all.l og', BUNYA N, __dirna me),
  141                 functio n (err, st dout, stde rr) {
  142           //  Just make  sure don' t blow up  on this.
  143           t. ifError(er r)
  144           t. end();
  145       });
  146   });
  147  
  148   test('simp le.log doe snotexist1 .log doesn otexist2.l og', funct ion (t) {
  149       exec(_ ('%s %s/co rpus/simpl e.log does notexist1. log doesno texist2.lo g',
  150                     BUN YAN, __dir name),
  151           fu nction (er r, stdout,  stderr) {
  152                t.ok(err )
  153                t.equal( err.code,  2)
  154                t.equal( stdout,
  155                    /* J SSTYLED */
  156                    '[20 12-02-08T2 2:56:52.85 6Z]  INFO:  myservice /123 on ex ample.com:  My messag e\n');
  157                // Note:  node v0.6 .10:
  158                //   ENO ENT, no su ch file or  directory  'asdf.log '
  159                // but n ode v0.6.1 4:
  160                //   ENO ENT, open  'asdf.log'
  161                // Somew hat annoyi ng change.
  162                t.equal( stderr,
  163                    'bun yan: ENOEN T, open \' doesnotexi st1.log\'\ nbunyan: E NOENT, '
  164                    + 'o pen \'does notexist2. log\'\n');
  165                t.end();
  166           }
  167       );
  168   });
  169  
  170   test('mult iple logs' , function  (t) {
  171       var cm d = _('%s  %s/corpus/ log1.log % s/corpus/l og2.log',
  172           BU NYAN, __di rname, __d irname);
  173       exec(c md, functi on (err, s tdout, std err) {
  174           t. ifError(er r);
  175           t. equal(stdo ut, [
  176                /* BEGIN  JSSTYLED  */
  177                '[2012-0 5-08T16:57 :55.586Z]   INFO: age nt1/73267  on headnod e: message \n',
  178                '[2012-0 5-08T16:58 :55.586Z]   INFO: age nt2/73267  on headnod e: message \n',
  179                '[2012-0 5-08T17:01 :49.339Z]   INFO: age nt2/73267  on headnod e: message \n',
  180                '[2012-0 5-08T17:02 :47.404Z]   INFO: age nt2/73267  on headnod e: message \n',
  181                '[2012-0 5-08T17:02 :49.339Z]   INFO: age nt1/73267  on headnod e: message \n',
  182                '[2012-0 5-08T17:02 :49.404Z]   INFO: age nt1/73267  on headnod e: message \n',
  183                '[2012-0 5-08T17:02 :49.404Z]   INFO: age nt1/73267  on headnod e: message \n',
  184                '[2012-0 5-08T17:02 :57.404Z]   INFO: age nt2/73267  on headnod e: message \n',
  185                '[2012-0 5-08T17:08 :01.105Z]   INFO: age nt2/76156  on headnod e: message \n',
  186                /* END J SSTYLED */
  187           ]. join(''));
  188           t. end();
  189       });
  190   });
  191  
  192   test('mult iple logs,  bunyan fo rmat', fun ction (t)  {
  193       var cm d = _('%s  -o bunyan  %s/corpus/ log1.log % s/corpus/l og2.log',
  194           BU NYAN, __di rname, __d irname);
  195       exec(c md, functi on (err, s tdout, std err) {
  196           t. ifError(er r);
  197           t. equal(stdo ut, [
  198                /* BEGIN  JSSTYLED  */
  199                '{"name" :"agent1", "pid":7326 7,"hostnam e":"headno de","level ":30,"msg" :"message" ,"time":"2 012-05-08T 16:57:55.5 86Z","v":0 }',
  200                '{"name" :"agent2", "pid":7326 7,"hostnam e":"headno de","level ":30,"msg" :"message" ,"time":"2 012-05-08T 16:58:55.5 86Z","v":0 }',
  201                '{"name" :"agent2", "pid":7326 7,"hostnam e":"headno de","level ":30,"msg" :"message" ,"time":"2 012-05-08T 17:01:49.3 39Z","v":0 }',
  202                '{"name" :"agent2", "pid":7326 7,"hostnam e":"headno de","level ":30,"msg" :"message" ,"time":"2 012-05-08T 17:02:47.4 04Z","v":0 }',
  203                '{"name" :"agent1", "pid":7326 7,"hostnam e":"headno de","level ":30,"msg" :"message" ,"time":"2 012-05-08T 17:02:49.3 39Z","v":0 }',
  204                '{"name" :"agent1", "pid":7326 7,"hostnam e":"headno de","level ":30,"msg" :"message" ,"time":"2 012-05-08T 17:02:49.4 04Z","v":0 }',
  205                '{"name" :"agent1", "pid":7326 7,"hostnam e":"headno de","level ":30,"msg" :"message" ,"time":"2 012-05-08T 17:02:49.4 04Z","v":0 }',
  206                '{"name" :"agent2", "pid":7326 7,"hostnam e":"headno de","level ":30,"msg" :"message" ,"time":"2 012-05-08T 17:02:57.4 04Z","v":0 }',
  207                '{"name" :"agent2", "pid":7615 6,"hostnam e":"headno de","level ":30,"msg" :"message" ,"time":"2 012-05-08T 17:08:01.1 05Z","v":0 }',
  208                ''
  209                /* END J SSTYLED */
  210           ]. join('\n') );
  211           t. end();
  212       });
  213   });
  214  
  215   test('log1 .log.gz',  function ( t) {
  216       exec(_ ('%s %s/co rpus/log1. log.gz', B UNYAN, __d irname),
  217                 functio n (err, st dout, stde rr) {
  218           t. ifError(er r);
  219           t. equal(stdo ut, [
  220                /* BEGIN  JSSTYLED  */
  221                '[2012-0 5-08T16:57 :55.586Z]   INFO: age nt1/73267  on headnod e: message \n',
  222                '[2012-0 5-08T17:02 :49.339Z]   INFO: age nt1/73267  on headnod e: message \n',
  223                '[2012-0 5-08T17:02 :49.404Z]   INFO: age nt1/73267  on headnod e: message \n',
  224                '[2012-0 5-08T17:02 :49.404Z]   INFO: age nt1/73267  on headnod e: message \n',
  225                /* END J SSTYLED */
  226           ]. join(''));
  227           t. end();
  228       });
  229   });
  230  
  231   test('mixe d text and  gzip logs ', functio n (t) {
  232       var cm d = _('%s  %s/corpus/ log1.log.g z %s/corpu s/log2.log ',
  233           BU NYAN, __di rname, __d irname);
  234       exec(c md, functi on (err, s tdout, std err) {
  235           t. ifError(er r);
  236           t. equal(stdo ut, [
  237                /* BEGIN  JSSTYLED  */
  238                '[2012-0 5-08T16:57 :55.586Z]   INFO: age nt1/73267  on headnod e: message \n',
  239                '[2012-0 5-08T16:58 :55.586Z]   INFO: age nt2/73267  on headnod e: message \n',
  240                '[2012-0 5-08T17:01 :49.339Z]   INFO: age nt2/73267  on headnod e: message \n',
  241                '[2012-0 5-08T17:02 :47.404Z]   INFO: age nt2/73267  on headnod e: message \n',
  242                '[2012-0 5-08T17:02 :49.339Z]   INFO: age nt1/73267  on headnod e: message \n',
  243                '[2012-0 5-08T17:02 :49.404Z]   INFO: age nt1/73267  on headnod e: message \n',
  244                '[2012-0 5-08T17:02 :49.404Z]   INFO: age nt1/73267  on headnod e: message \n',
  245                '[2012-0 5-08T17:02 :57.404Z]   INFO: age nt2/73267  on headnod e: message \n',
  246                '[2012-0 5-08T17:08 :01.105Z]   INFO: age nt2/76156  on headnod e: message \n',
  247                /* END J SSTYLED */
  248           ]. join(''));
  249           t. end();
  250       });
  251   });
  252  
  253   test('--le vel 40', f unction (t ) {
  254       expect  = [
  255           /*  BEGIN JSS TYLED */
  256           '#  levels\n' ,
  257           '[ 2012-02-08 T22:56:53. 856Z]  WAR N: myservi ce/123 on  example.co m: My mess age\n',
  258           '[ 2012-02-08 T22:56:54. 856Z] ERRO R: myservi ce/123 on  example.co m: My mess age\n',
  259           '[ 2012-02-08 T22:56:55. 856Z] LVL5 5: myservi ce/123 on  example.co m: My mess age\n',
  260           '[ 2012-02-08 T22:56:56. 856Z] FATA L: myservi ce/123 on  example.co m: My mess age\n',
  261           '\ n',
  262           '#  extra fie lds\n',
  263           '\ n',
  264           '#  bogus\n',
  265           'n ot a JSON  line\n',
  266           '{ "hi": "the re"}\n'
  267           /*  END JSSTY LED */
  268       ].join ('');
  269       exec(_ ('%s -l 40  %s/corpus /all.log',  BUNYAN, _ _dirname),
  270                 functio n (err, st dout, stde rr) {
  271           t. ifError(er r);
  272           t. equal(stdo ut, expect );
  273           ex ec(_('%s - -level 40  %s/corpus/ all.log',  BUNYAN, __ dirname),
  274                     fun ction (err , stdout,  stderr) {
  275                t.ifErro r(err);
  276                t.equal( stdout, ex pect);
  277                t.end();
  278           }) ;
  279       });
  280   });
  281  
  282   test('--co ndition "l evel === 1 0 && pid = == 123"',  function ( t) {
  283       var ex pect = [
  284           '#  levels\n' ,
  285           /*  JSSTYLED  */
  286           '[ 2012-02-08 T22:56:50. 856Z] TRAC E: myservi ce/123 on  example.co m: My mess age\n',
  287           '\ n',
  288           '#  extra fie lds\n',
  289           '\ n',
  290           '#  bogus\n',
  291           'n ot a JSON  line\n',
  292           '{ "hi": "the re"}\n'
  293       ].join ('');
  294       var cm d = _('%s  -c "level  === 10 &&  pid === 12 3" %s/corp us/all.log ',
  295           BU NYAN, __di rname);
  296       exec(c md, functi on (err, s tdout, std err) {
  297           t. ifError(er r);
  298           t. equal(stdo ut, expect );
  299           va r cmd = _(
  300                '%s --co ndition "l evel === 1 0 && pid = == 123" %s /corpus/al l.log',
  301                BUNYAN,  __dirname) ;
  302           ex ec(cmd, fu nction (er r, stdout,  stderr) {
  303                t.ifErro r(err);
  304                t.equal( stdout, ex pect);
  305                t.end();
  306           }) ;
  307       });
  308   });
  309  
  310   // multipl e
  311   // not sur e if this  is a bug o r a featur e.  let's  call it a  feature!
  312   test('mult iple --con ditions',  function ( t) {
  313       var ex pect = [
  314           '#  levels\n' ,
  315           /*  JSSTYLED  */
  316           '[ 2012-02-08 T22:56:53. 856Z]  WAR N: myservi ce/1 on ex ample.com:  My messag e\n',
  317           '\ n',
  318           '#  extra fie lds\n',
  319           '\ n',
  320           '#  bogus\n',
  321           'n ot a JSON  line\n',
  322           '{ "hi": "the re"}\n'
  323       ].join ('');
  324       exec(_ ('%s %s/co rpus/all.l og ' +
  325                     '-c  "if (leve l === 40)  pid = 1; t rue" ' +
  326                     '-c  "pid ===  1"', BUNYA N, __dirna me),
  327                 functio n (err, st dout, stde rr) {
  328           t. ifError(er r);
  329           t. equal(stdo ut, expect );
  330           t. end();
  331       });
  332   });
  333  
  334   // https:/ /github.co m/trentm/n ode-bunyan /issues/30
  335   //
  336   // One of  the record s in corpu s/withreq. log has a  'req'
  337   // field w ith no 'he aders'. Di tto for th e 'res' fi eld.
  338   test('robu st req han dling', fu nction (t)  {
  339       var ex pect = [
  340           /*  BEGIN JSS TYLED */
  341           '[ 2012-08-08 T10:25:47. 636Z] DEBU G: amon-ma ster/12859  on 9724a1 90-27b6-4f d8-830b-a5 74f839c67d : headAgen tProbes re spond (req _id=cce79d 15-ffc2-48 7c-a4e4-e9 40bdaac31e , route=He adAgentPro bes, conte ntMD5=11Fx OYiYfpMxmA Nj4kGJzg== )',
  342             '[2012-08- 08T10:25:4 7.637Z]    INFO: amon -master/12 859 on 972 4a190-27b6 -4fd8-830b -a574f839c 67d: HeadA gentProbes  handled:  200 (req_i d=cce79d15 -ffc2-487c -a4e4-e940 bdaac31e,  audit=true , remoteAd dress= IP , remotePo rt= PORT , latency= 3, secure= false, _au dit=true,  req.versio n=*)',
  343           '     HEAD /a gentprobes ?agent=ccf 92af9-0b24 -46b6-ab60 -65095fdd3 037 HTTP/1 .1',
  344           '     accept:  applicati on/json',
  345           '     content -type: app lication/j son',
  346                 host:  IP           ',
  347           '     connect ion: keep- alive',
  348           '     --',
  349           '     HTTP/1. 1 200 OK',
  350           '     content -md5: 11Fx OYiYfpMxmA Nj4kGJzg== ',
  351           '     access- control-al low-origin : *',
  352           '     access- control-al low-header s: Accept,  Accept-Ve rsion, Con tent-Lengt h, Content -MD5, Cont ent-Type,  Date, X-Ap i-Version' ,
  353           '     access- control-al low-method s: HEAD',
  354           '     access- control-ex pose-heade rs: X-Api- Version, X -Request-I d, X-Respo nse-Time',
  355           '     connect ion: Keep- Alive',
  356           '     date: W ed, 08 Aug  2012 10:2 5:47 GMT',
  357           '     server:  Amon Mast er/1.0.0',
  358           '     x-reque st-id: cce 79d15-ffc2 -487c-a4e4 -e940bdaac 31e',
  359           '     x-respo nse-time:  3',
  360           '     --',
  361           '     route:  {',
  362           '       "name ": "HeadAg entProbes" ,',
  363           '       "vers ion": fals e',
  364           '     }',
  365             '[2012-08- 08T10:25:4 7.637Z]    INFO: amon -master/12 859 on 972 4a190-27b6 -4fd8-830b -a574f839c 67d: HeadA gentProbes  handled:  200 (req_i d=cce79d15 -ffc2-487c -a4e4-e940 bdaac31e,  audit=true , remoteAd dress= IP          , remotePo rt= PORT        , latency= 3, secure= false, _au dit=true,  req.versio n=*)',
  366           '     HEAD /a gentprobes ?agent=ccf 92af9-0b24 -46b6-ab60 -65095fdd3 037 HTTP/1 .1',
  367           '     --',
  368           '     route:  {',
  369           '       "name ": "HeadAg entProbes" ,',
  370           '       "vers ion": fals e',
  371           '     }'
  372           /*  END JSSTY LED */
  373       ].join ('\n') + ' \n';
  374       exec(_ ('%s %s/co rpus/withr eq.log', B UNYAN, __d irname),
  375                 functio n (err, st dout, stde rr) {
  376           t. ifError(er r);
  377           t. equal(stdo ut, expect );
  378           t. end();
  379       });
  380   });