<commit_before>require 'serverspec'

# Required by serverspec
set :backend, :exec

describe command('cd /var/www/MISP/tests && ./curl_tests.sh `cat $HOME/build/key.txt` | tee /tmp/curl_tests.out') do
## FIXME! is it normal first run get 'HTTP/1.1 500 Internal Server Error', second run: 'HTTP/1.1 100 Continue' + 'HTTP/1.1 302 Found'
##	not like https://travis-ci.org/MISP/MISP/jobs/128166085
  its(:stdout) { should match /548847db-060c-4275-a0c7-15bb950d210b/}
  its(:stdout) { should_not match /HTTP\/1.1 500 Internal Server Error/}
  its(:exit_status) { should eq 0 }
  let(:sudo_options) { '-u _misp -H' }
end

## FIXME! 
##	xenial: fail first run, ok second
##	trusty: fail all the time
##	centos7: fail, ok second
#describe command('cd /var/www/MISP/PyMISP && nosetests --with-coverage --cover-package=pymisp tests/test_offline.py 2>&1 | tee /tmp/nosetests.out') do
#  its(:stdout) { should match /TOTAL/}
#  its(:stdout) { should match /OK/}
#  its(:stdout) { should_not match /FAILED/}
#  its(:exit_status) { should eq 0 }
#  let(:sudo_options) { '-u _misp -H' }
#end

describe command('cd /var/www/MISP/PyMISP && python tests/test.py | tee /tmp/tests.out') do
  its(:exit_status) { should eq 0 }
  let(:sudo_options) { '-u _misp -H' }
end

#describe command('cd /var/www/MISP/PyMISP/examples/events && ./create_massive_dummy_events.py -l 5 -a 30') do
#  its(:stdout) { should_not match /500 Server Error: Internal Server Error/}
#  its(:exit_status) { should eq 0 }
#  let(:sudo_options) { '-u _misp -H' }<commit_msg>serverspec tests: few more<commit_after>require 'serverspec'

# Required by serverspec
set :backend, :exec

describe command('cd /var/www/MISP/tests && ./curl_tests.sh `cat $HOME/build/key.txt` | tee /tmp/curl_tests.out') do
## FIXME! is it normal first run get 'HTTP/1.1 500 Internal Server Error', second run: 'HTTP/1.1 100 Continue' + 'HTTP/1.1 302 Found'
##	not like https://travis-ci.org/MISP/MISP/jobs/128166085
  its(:stdout) { should match /548847db-060c-4275-a0c7-15bb950d210b/}
  its(:stdout) { should_not match /HTTP\/1.1 500 Internal Server Error/}
  its(:stderr) { should match /diff compare.csv 1.csv/}
  its(:stderr) { should_not match /error/}
  its(:exit_status) { should eq 0 }
  let(:sudo_options) { '-u _misp -H' }
end

## FIXME! 
##	xenial: fail first run, ok second
##	trusty: fail all the time
##	centos7: fail, ok second
#describe command('cd /var/www/MISP/PyMISP && nosetests --with-coverage --cover-package=pymisp tests/test_offline.py 2>&1 | tee /tmp/nosetests.out') do
#  its(:stdout) { should match /TOTAL/}
#  its(:stdout) { should match /OK/}
#  its(:stdout) { should_not match /FAILED/}
#  its(:exit_status) { should eq 0 }
#  let(:sudo_options) { '-u _misp -H' }
#end

describe command('cd /var/www/MISP/PyMISP && python tests/test.py | tee /tmp/tests.out') do
  its(:exit_status) { should eq 0 }
  let(:sudo_options) { '-u _misp -H' }
end

#describe command('cd /var/www/MISP/PyMISP/examples/events && ./create_massive_dummy_events.py -l 5 -a 30') do
#  its(:stdout) { should_not match /500 Server Error: Internal Server Error/}
#  its(:exit_status) { should eq 0 }
#  let(:sudo_options) { '-u _misp -H' }
{'fraction_non_alphanumeric': 0.16329753632343652, 'fraction_numerical': 0.041377132027795326, 'mean_word_length': 3.8873456790123457, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '972676', 'n_tokens_mistral': 1319, 'n_tokens_neox': 1196, 'n_words': 317}