-
Notifications
You must be signed in to change notification settings - Fork 770
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
375473f
commit 438afdd
Showing
3 changed files
with
90 additions
and
44 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
44 changes: 44 additions & 0 deletions
44
appveyor/e2e_tests/docker_compose_client_collection_test.py
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,44 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import time | ||
|
||
from grr_api_client import api | ||
|
||
|
||
grrapi = api.InitHttp(api_endpoint="http://localhost:8000", | ||
auth=("admin", "root")) | ||
|
||
search_result = grrapi.SearchClients() | ||
|
||
result = {} | ||
for client in search_result: | ||
client_id = client.client_id | ||
client_last_seen_at = client.data.last_seen_at | ||
result[client_id] = client_last_seen_at | ||
|
||
assert len(result) == 1 | ||
|
||
|
||
flow_args = grrapi.types.CreateFlowArgs("FileFinder") | ||
flow_args.ClearField("paths") | ||
flow_args.paths.append("/client_templates/*") | ||
flow_args.action.action_type = flow_args.action.DOWNLOAD | ||
|
||
hunt_runner_args = grrapi.types.CreateHuntRunnerArgs() | ||
|
||
hunt = grrapi.CreateHunt(flow_name="FileFinder", flow_args=flow_args, | ||
hunt_runner_args=hunt_runner_args) | ||
hunt = hunt.Start() | ||
|
||
# Wait until results are available. | ||
time.sleep(20) | ||
|
||
found_files = set([f.payload.stat_entry.pathspec.path for f in hunt.ListResults()]) | ||
|
||
assert len(found_files) == 4 | ||
assert found_files == { | ||
'/client_templates/windows-installers', | ||
'/client_templates/osx-installers', | ||
'/client_templates/centos-installers', | ||
'/client_templates/ubuntu-installers' | ||
} |
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,15 @@ | ||
#!/bin/bash | ||
# | ||
# Tests the docker-compose setup | ||
|
||
set -ex | ||
|
||
docker-compose up | ||
|
||
docker exec -it grr-admin-ui \ | ||
/bin/bash -c \ | ||
"grr_console \ | ||
-config /configs/grr.server.yaml \ | ||
-command_file e2e_tests/docker_compose_client_collection_test.py" | ||
|
||
|