Skip to content

Commit

Permalink
Set test secret
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaMahany committed Jan 17, 2024
1 parent 01d242d commit f823b90
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ jobs:
- name: build
run: NIXPKGS_ALLOW_UNFREE=1 nix build --impure

- name: set up test secret
run: |
mv ./tests/test-secret ./tests/test-secret.bak
echo -n "${{ secrets.NABALU_ENROLL_SECRET }}" | tee ./tests/test-secret
- name: check flake (runs tests)
run: NIXPKGS_ALLOW_UNFREE=1 nix flake check --impure --log-format internal-json
timeout-minutes: 15
Expand Down Expand Up @@ -54,3 +59,7 @@ jobs:

- name: osqueryd version
run: ./result/bin/osqueryd --version

- name: cleanup
if: always()
run: mv ./tests/test-secret.bak ./tests/test-secret
14 changes: 6 additions & 8 deletions tests/kolide-launcher.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,15 @@ pkgs.nixosTest {
''
machine.start()
# TODO: currently launcher will shut itself down if its secret file doesn't exist,
# so we don't get all the way through setup and launcher doesn't stay running.
# In the future, we'll want to validate setup and that the service is running.
with subtest("kolide-launcher service starts"):
machine.wait_for_unit("kolide-launcher.service")
machine.sleep(10)
with subtest("set up secret file"):
machine.systemctl("stop kolide-launcher.service")
machine.copy_from_host("${./test-secret}", "/etc/kolide-k2/secret")
machine.systemctl("start kolide-launcher.service")
with subtest("launcher set up correctly"):
with subtest("launcher service runs and is set up correctly"):
machine.wait_for_unit("kolide-launcher.service")
machine.wait_for_file("/var/kolide-k2/k2device.kolide.com/debug.json")
machine.sleep(20)
with subtest("get a screenshot"):
machine.wait_for_unit("display-manager.service")
Expand Down
1 change: 1 addition & 0 deletions tests/test-secret
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test-secret

0 comments on commit f823b90

Please sign in to comment.