|
63 | 63 |
|
64 | 64 | with_puppet_running_on(master, master_opts, testdir) do
|
65 | 65 | agents.each do |agent|
|
66 |
| - run_agent_on(agent, '--no-daemonize --onetime --verbose') do |result| |
67 |
| - assert_match(/Info: Using environment 'production'/, result.stdout) |
68 |
| - assert_match(/Local environment: 'production' doesn't match server specified environment 'special', restarting agent run with environment 'special'/, result.stdout) |
69 |
| - assert_match(/Notice: special environment/, result.stdout) |
| 66 | + step 'ensure the lastrunfile is absent for the first run' do |
| 67 | + on(agent, puppet('config print lastrunfile')) do |command_result| |
| 68 | + agent.rm_rf(command_result.stdout) |
| 69 | + end |
70 | 70 | end
|
71 | 71 |
|
72 |
| - run_agent_on(agent, '--no-daemonize --onetime --verbose') do |result| |
73 |
| - assert_match(/Info: Using environment 'special'/, result.stdout) |
74 |
| - assert_match(/Notice: special environment/, result.stdout) |
| 72 | + step 'first run: agent makes a node request to get the environment' do |
| 73 | + run_agent_on(agent, '--no-daemonize --onetime --debug') do |result| |
| 74 | + assert_match(/Local environment: 'production' doesn't match server specified node environment 'special', switching agent to 'special'/, result.stdout) |
| 75 | + assert_match(/Debug: HTTP GET .*\/puppet\/v3\/node/, result.stdout) |
| 76 | + assert_match(/Notice: special environment/, result.stdout) |
| 77 | + end |
| 78 | + end |
| 79 | + |
| 80 | + step 'second run: agent uses the environment from lastrunfile' do |
| 81 | + run_agent_on(agent, '--no-daemonize --onetime --debug') do |result| |
| 82 | + assert_match(/Debug: Successfully loaded last environment from the lastrunfile/, result.stdout) |
| 83 | + assert_match(/Notice: special environment/, result.stdout) |
| 84 | + end |
75 | 85 | end
|
76 | 86 | end
|
77 | 87 | end
|
|
0 commit comments