rapid7 / recog

Pattern recognition for hosts, services, and content
Other
662 stars 195 forks source link

Restore and enhance fingerprint self test spec #444

Closed mkienow-r7 closed 2 years ago

mkienow-r7 commented 2 years ago

Description

Restores spec/lib/fingerprint_self_test_spec.rb that was previously removed during the repo split. The fingerprint self tests are more detailed than the checks performed by recog_verify, and should always be run to test fingerprint updates. The test file and spec/spec_helper.rb were modified so that the test could also run from within the recog-ruby repo.

Diff against last version before the repo split

--- a/spec/lib/fingerprint_self_test_spec.rb.fac7d6d6688330b155fd35f80eacc920ec9db75e
+++ b/spec/lib/fingerprint_self_test_spec.rb
@@ -3,8 +3,8 @@ require 'regexp_parser'
 require 'nokogiri'

 describe Recog::DB do
-  let(:schema) { Nokogiri::XML::Schema(open(File.expand_path(File.join(%w(xml fingerprints.xsd))))) }
-  Dir[File.expand_path File.join('xml', '*.xml')].each do |xml_file_name|
+  let(:schema) { Nokogiri::XML::Schema(open(File.join(FINGERPRINT_DIR, 'fingerprints.xsd'))) }
+  Dir[File.join(FINGERPRINT_DIR, '*.xml')].each do |xml_file_name|

     describe "##{File.basename(xml_file_name)}" do

@@ -172,4 +172,4 @@ describe Recog::DB do

     end
   end
-end
\ No newline at end of file
+end

Motivation and Context

To ensure that fingerprint quality is maintained.

How Has This Been Tested?

Types of changes

Checklist: