-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add packaging tests for Heartbeat (#46)
* Add packaging tests for Heartbeat * Smoke tests using a simple HTTP monitor.
- Loading branch information
1 parent
245cb8d
commit 0022c19
Showing
15 changed files
with
149 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
- name: Ensure empty output directory | ||
file: path={{workdir}}/output state=absent | ||
|
||
- name: Minimal configuration file | ||
template: src={{beat_name}}.yml dest={{beat_cfg}} | ||
when: ansible_os_family in ["Debian", "RedHat"] | ||
|
||
- name: Start Heartbeat (linux) | ||
service: name={{beat_name}} state=restarted | ||
when: ansible_os_family in ["Debian", "RedHat"] | ||
|
||
- name: Start Heartbeat (darwin) | ||
shell: chdir={{installdir}} ./{{beat_name}} -E output.elasticsearch.enabled=false -E output.file.path={{workdir}}/output | ||
when: ansible_os_family == "Darwin" | ||
async: 45 | ||
poll: 0 # run in bg | ||
|
||
- name: Wait for the output file to be created, should contain HTTP pinging | ||
wait_for: > | ||
path={{workdir}}/output/{{beat_name}} timeout=30 | ||
search_regex='"scheme":"http"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
heartbeat.monitors: | ||
- type: http | ||
schedule: '@every 1s' | ||
urls: ["http://localhost:12345"] | ||
|
||
output: | ||
file: | ||
path: {{workdir}}/output | ||
filename: heartbeat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Param($line, $file) | ||
|
||
$line >> $file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
heartbeat.monitors: | ||
- type: http | ||
schedule: '@every 1s' | ||
urls: ["http://localhost:12345"] | ||
|
||
output: | ||
file: | ||
path: "c:/users/vagrant/output" | ||
filename: heartbeat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Param($file, $regexp, $replace) | ||
|
||
$content = Get-Content -path $file | Out-String | ||
$content -Replace $regexp, $replace | Out-File $file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Param($script) | ||
|
||
#$dir = Split-Path $script | ||
#$filename = Split-Path -leaf $script | ||
|
||
#Push-Location $dir | ||
invoke-expression -Command $script | ||
#Pop-Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Param($duration) | ||
|
||
Start-Sleep -s $duration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
- name: Ensure empty output directory | ||
win_file: path={{workdir}}\\output state=absent | ||
|
||
- name: Replace configuration file (windows) | ||
win_copy: src={{beat_name}}.yml dest={{installdir}} | ||
|
||
- name: Install service | ||
script: run_script.ps1 -script {{installdir}}\\install-service-{{beat_name}}.ps1 | ||
|
||
- name: Delete logs directory | ||
win_file: path=c:\logs state=absent | ||
|
||
- name: Start heartbeat | ||
win_service: name={{beat_name}} state=started | ||
|
||
- name: Sleep a little | ||
script: sleep.ps1 -duration 10 | ||
|
||
- name: Stat output file | ||
win_stat: path={{workdir}}\output\{{beat_name}} | ||
register: output_stat | ||
|
||
- debug: var=output_stat | ||
|
||
- name: Check output file | ||
assert: | ||
that: | ||
- "output_stat.stat.exists" | ||
- "output_stat.stat.size > 250" | ||
|
||
- name: Stop heartbeat | ||
win_service: name={{beat_name}} state=stopped | ||
|
||
- name: Uninstall service | ||
script: run_script.ps1 -script {{installdir}}\\uninstall-service-{{beat_name}}.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
url_base: http://staging.elastic.co/5.0.0-rc1-9db751df/downloads/beats | ||
version: 5.0.0-rc1 | ||
url_base: https://staging.elastic.co/5.2.0-9bd7a99c/downloads/beats | ||
version: 5.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters