continuousphp / aws-codedeploy-agent

Cookbook to install AWS Codedeploy Agent
8 stars 15 forks source link

spec checking for process returns true by finding the grep as opposed to the CodeDeploy process. #10

Closed tomharvey closed 7 years ago

tomharvey commented 8 years ago

When CodeDeploy is not running: ps -ax | grep "codedeploy-agent: InstanceAgent" will return:

 7443 pts/0    S+     0:00 grep codedeploy-agent: InstanceAgent

When CodeDeploy is running: ps -ax | grep "codedeploy-agent: InstanceAgent" will return:

 7679 pts/0    Sl     0:00 codedeploy-agent: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller of master 7675
 7756 pts/0    S+     0:00 grep --color=auto codedeploy-agent: InstanceAgent

And in either case the test at https://github.com/continuousphp/aws-codedeploy-agent/blob/master/test/integration/aws-codedeploy-agent/serverspec/default_spec.rb#L10 will assert true.

A better test would be one which filters out the grep process and only returns the CodeDeploy process if running:

ps -ax | grep "codedeploy-agent: InstanceAgent" | grep -v grep

tomharvey commented 8 years ago

this will only pass when running in AWS or with appropriate on-premis config setup off of AWS.

May be best to remove the test altogether or setup some on-premise config...

Pierozi commented 7 years ago

Our test is executing with kitchen-ec2 in order to reproduce the same environment. Thanks for this fix.