Jira (PUP-10302) Puppet rspec tests from 'agent_spec.rb' clean up

2020-03-05 Thread Mihai Buzgau (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Mihai Buzgau updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-10302  
 
 
  Puppet rspec tests from 'agent_spec.rb' clean up   
 

  
 
 
 
 

 
Change By: 
 Mihai Buzgau  
 
 
Sprint: 
 PR - Triage  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.347071.1582191101000.5685.1583425620037%40Atlassian.JIRA.


Jira (PUP-10302) Puppet rspec tests from 'agent_spec.rb' clean up

2020-02-20 Thread Luchian Nemes (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Luchian Nemes updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-10302  
 
 
  Puppet rspec tests from 'agent_spec.rb' clean up   
 

  
 
 
 
 

 
Change By: 
 Luchian Nemes  
 
 
Environment: 
 *Puppet Agent version:* 6.13.0  
 
 
Acceptance Criteria: 
 # Add the following test in 'pidlock_spec.rb':{code:ruby}it "should pass after repairing the faulty tests from 'agent_spec.rb'" do  @lock.lock  pid = @lock.lock_pid  comm = `ps -p #{pid} -o comm`  args = `ps -p #{pid} -o args`expect(comm).not_to match(/puppet agent: applying configuration/)  expect(args).not_to match(/puppet agent: applying configuration/)  expect(comm).to match(/spec\/unit\/util\/pidlock_spec.rb/)  expect(args).to match(/ruby/)end{code} # Then run: >> bundle exec rspec spec/unit/agent_spec.rb spec/unit/util/pidlock_spec.rb or >> bundle exec rake parallel:spec # If correction done correctly, it should pass.This should be obtained by either mocking the 'run_in_fork' method from 'agent.rb' in the tests or finding a solution for rspec to act as expected.  
 
 
Priority: 
 Normal Low  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)  
 
 

 
  

Jira (PUP-10302) Puppet rspec tests from 'agent_spec.rb' clean up

2020-02-20 Thread Luchian Nemes (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Luchian Nemes created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-10302  
 
 
  Puppet rspec tests from 'agent_spec.rb' clean up   
 

  
 
 
 
 

 
Issue Type: 
  Improvement  
 
 
Assignee: 
 Unassigned  
 
 
Created: 
 2020/02/20 1:31 AM  
 
 
Priority: 
  Normal  
 
 
Reporter: 
 Luchian Nemes  
 

  
 
 
 
 

 
 One of the newly introduced tests in 'pidlock_spec.rb' was being influenced by other tests from 'agent_spec.rb' (if they were run before it). This order dependency issue was solved by making sure that all the tests in 'pidlock_spec.rb' are fully mocked (since before there were expectations based on real executions of a command). As this situation can occur again in the future so these problematic tests from 'agent_spec.rb' need to be checked and revamped accordingly: 
 
should exit with 1 if an exception is raised 
should exit child process if child exit 
should run the agent in a forked process 
should return the block exit code as the child exit code 
 The story behind is mostly about a fork mechanism, which is covered by the mentioned tests. This ends up making changes to the rspec's process argument instead of doing the intended action of creating a child process and do said modification to it (not the parent process). The method referred to can be seen in 'agent.rb' as follows:  
 
 
 
 
 def run_in_fork(forking = true)  
 
 
   return yield unless forking or