oveits / ProvisioningEngine

Ruby on Rails based ProvisioningEngine Frontend for provisioning of legacy systems via Apache Camel Backend (SOAP/XML+SPML+File import)
3 stars 6 forks source link

rspec test fails, if Site3 is provisioned on ExampleCustomerV8 #8

Closed oveits closed 8 years ago

oveits commented 8 years ago

Tested with OSV V7R1 (CSL8): ExampleCustomerV8 is configured with Site3. In this case, startTests stops with following error:

1) On target solution 'CSL9_V7R1' initObj(Customer) via model initObj( obj: Customer, shall_exist_on_db: false, shall_exist_on_target: true ) should remove the object from the database and provision the object with the right attributes on the target, if it was not yet provisioned
     Failure/Error: expect( @myobj.provision(:read, false) ).not_to match(/>#{@myobj.name}</) unless obj == "User"
       expected "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SOAPResult><Result>Success</Result><GetBGListData><BGName>BG_DC</BGName><BGName>H4K10</BGName><BGName>OSILA12345</BGName><BGName>Virginmedia</BGName><BGName>OrangePoland</BGName><BGName>Eurovia</BGName><BGName>NarendarsCustomer</BGName><BGName>BrucesCustomer</BGName><BGName>StevesCustomer</BGName><BGName>Cust4</BGName><BGName>Cust5</BGName><BGName>Cust6</BGName><BGName>YvesGmbH</BGName><BGName>Netcall</BGName><BGName>HeloCustomer1</BGName><BGName>UIMCustomer</BGName><BGName>PaderbornWorkshop</BGName><BGName>ThomasDalchow</BGName><BGName>TNT_877</BGName><BGName>Australia</BGName><BGName>PolycomVVX</BGName><BGName>Skunk_Perf</BGName><BGName>CCCouncil</BGName><BGName>PinnacleCSL9</BGName><BGName>CircuitTI</BGName><BGName>Fort_A</BGName><BGName>CSL9_OSVV7R1_Cust2</BGName><BGName>OllisTestCustCSL9</BGName><BGName>ErikCSL9Test</BGName><BGName>inContact</BGName><BGName>Customer3</BGName><BGName>ExampleCustomerV8</BGName></GetBGListData></SOAPResult>" not to match />ExampleCustomerV8</
     # ./spec/requests/provisioningobjects_spec.rb:951:in `block (5 levels) in <top (required)>'
oveits commented 8 years ago

Testing with following change:

expect{ @mychildobj = createObjDB(child(obj)) }.to change(Object.const_get(child(obj)), :count).by(1) unless child(obj).nil?

replaced by:

expect{ @mychildobj = createObjDB(child(obj), 0) }.to change(Object.const_get(child(obj)), :count).by(1) unless child(obj).nil? || defaultParams(child(obj), 0).nil?
#abort defaultParams(obj, 1).inspect
        expect{ @mychildobj = createObjDB(child(obj), 1) }.to change(Object.const_get(child(obj)), :count).by(1) unless child(obj).nil? || defaultParams(child(obj), 1).nil? || child(obj) == "Site" # for sites, paramsSet 1 is a duplicate name to paramsSet2 for testing sync. Therefore, it will never be provisioned on the target
        expect{ @mychildobj = createObjDB(child(obj), 2) }.to change(Object.const_get(child(obj)), :count).by(1) unless child(obj).nil? || defaultParams(child(obj), 2).nil?
        expect{ @mychildobj = createObjDB(child(obj), 3) }.to change(Object.const_get(child(obj)), :count).by(1) unless child(obj).nil? || defaultParams(child(obj), 3).nil?

and commented out the abort in the function def defaultParams(obj, i = 0) This seems to do the trick (full test suite in progress now)

Note that I had to exclude Site with paramsSet == 1, since this has the same Site name as paramsSet 0 and has a special purpose for synchronization testing. If createObjDB is applied for Sites with paramsSet == 1 is applied, the number of sites will not be increased because of the duplicate name.