Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/prometheus: check alertmanager configuration #49756

Merged
merged 3 commits into from Nov 23, 2018
Merged

Conversation

andir
Copy link
Member

@andir andir commented Nov 4, 2018

Motivation for this change

This is the same as #49749 just for alertmanager.

cc @ocharles @fpletz @bjornfor @teh @globin

Still running tests for this. Might even end up adding an alertmanager test.

@andir andir changed the title nixos/prometheus: check alertmanager configuration WIP: nixos/prometheus: check alertmanager configuration Nov 4, 2018
@Mic92
Copy link
Member

Mic92 commented Nov 4, 2018

I gave it a quick look and it seems that the code does not require any resources not available in the sandbox: https://github.com/prometheus/alertmanager/blob/6d0edbe63066b4d0b7c189afb8e6849458455f65/cli/check_config.go

@andir
Copy link
Member Author

andir commented Nov 4, 2018

@GrahamcOfBorg test prometheus

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-linux (full log)

Attempted: tests.prometheus

Partial log (click to expand)

building '/nix/store/x1xgkrnrkh4h8cfjyfk3jnx4ga0qvibb-system-units.drv'...
cannot build derivation '/nix/store/drnijcrqbhzzbh48pirwra4b0dngyvb8-etc.drv': 1 dependencies couldn't be built
building '/nix/store/agfz7s7qm01mbh6pfl0g3vbvaqmjh9nr-users-groups.json.drv'...
cannot build derivation '/nix/store/4xrchh7qfrghvx9rgnwlbl7hhmdbzf7x-nixos-system-one-19.03.git.5c7d715.drv': 5 dependencies couldn't be built
cannot build derivation '/nix/store/zh1phba7q76z4472zzdsc48qzvlw7qhl-closure-info.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/725y6dn0gbb7fizl3q1zr8li00f2pwl6-run-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/gd0rg6brgxwq20z4xhmlrzig5k642yx5-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/xm31rj8kmz05hnrb43gclk4irzg97z6n-nixos-test-driver-prometheus.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/paqg2y1spidiz6r8ry8c3w4vnk7mf3mm-vm-test-run-prometheus.drv': 1 dependencies couldn't be built
error: build of '/nix/store/paqg2y1spidiz6r8ry8c3w4vnk7mf3mm-vm-test-run-prometheus.drv' failed

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: tests.prometheus

Partial log (click to expand)

one: exit status 1
syncing
one: running command: sync
one: exit status 0
test script finished in 14.78s
cleaning up
killing one (pid 631)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/jxlldgwsfjaiw9rjxqipwqpvakzsh6lm-vm-test-run-prometheus

@andir
Copy link
Member Author

andir commented Nov 17, 2018

I updated the PR to contain the test for alertmanager. Since the empty alertmanager is not valid according to amtool I also changed the modules to requie either configuration or configText to be set.

cc @WilliButz

@andir andir changed the title WIP: nixos/prometheus: check alertmanager configuration nixos/prometheus: check alertmanager configuration Nov 17, 2018
This commit adds an assertion that checks that either `configFile` or
`configuration` is configured for alertmanager. The alertmanager config
can not be an empty attributeset. The check executed with `amtool` fails
before the service even has the chance to start. We should probably not
allow a broken alertmanager configuration anyway.

This also introduces a test for alertmanager configuration that piggy
backs on the existing prometheus tests.
@andir
Copy link
Member Author

andir commented Nov 23, 2018

Updated the assertion as @WilliButz proposed.

@GrahamcOfBorg test prometheus

@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: tests.prometheus

Partial log (click to expand)

Cannot nix-instantiate `tests.prometheus' because:
error: while evaluating 'recursiveUpdate' at /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/lib/attrsets.nix:415:26, called from /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/lib/attrsets.nix:148:28:
while evaluating 'recursiveUpdateUntil' at /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/lib/attrsets.nix:384:37, called from /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/lib/attrsets.nix:416:5:
while evaluating 'zipAttrsWith' at /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/lib/attrsets.nix:347:21, called from /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/lib/attrsets.nix:394:8:
while evaluating 'zipAttrsWithNames' at /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/lib/attrsets.nix:332:33, called from /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/lib/attrsets.nix:347:27:
while evaluating the attribute 'prometheus' at /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/nixos/tests/all-tests.nix:172:3:
while evaluating 'handleTest' at /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/nixos/tests/all-tests.nix:17:22, called from /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/nixos/tests/all-tests.nix:172:16:
while evaluating 'discoverTests' at /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/nixos/tests/all-tests.nix:13:19, called from /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/nixos/tests/all-tests.nix:18:5:
access to path '/nix/store/yzdvzjc0ms0c7nlk4zz72lpg8lddmcsv-grahamc-aarch64-community-3' is forbidden in restricted mode

@GrahamcOfBorg
Copy link

No attempt on x86_64-linux (full log)

The following builds were skipped because they don't evaluate on x86_64-linux: tests.prometheus

Partial log (click to expand)

error: while evaluating 'recursiveUpdate' at /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/lib/attrsets.nix:415:26, called from /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/lib/attrsets.nix:148:28:
while evaluating 'recursiveUpdateUntil' at /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/lib/attrsets.nix:384:37, called from /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/lib/attrsets.nix:416:5:
while evaluating 'zipAttrsWith' at /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/lib/attrsets.nix:347:21, called from /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/lib/attrsets.nix:394:8:
while evaluating 'zipAttrsWithNames' at /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/lib/attrsets.nix:332:33, called from /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/lib/attrsets.nix:347:27:
while evaluating anonymous function at /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/lib/lists.nix:113:41, called from /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/lib/attrsets.nix:347:46:
while evaluating the attribute 'prometheus' at /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/nixos/tests/all-tests.nix:172:3:
while evaluating 'handleTest' at /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/nixos/tests/all-tests.nix:17:22, called from /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/nixos/tests/all-tests.nix:172:16:
while evaluating 'discoverTests' at /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/nixos/tests/all-tests.nix:13:19, called from /var/lib/gc-of-borg/nix-root/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/gleber-bastion/nixos/tests/all-tests.nix:18:5:
access to path '/nix/store/6ka3bm4h9hlfbkmbwqgxc5m4ivb96s2h-gleber-bastion' is forbidden in restricted mode

@andir
Copy link
Member Author

andir commented Nov 23, 2018

It seems like ofborg is (still) having issues. I did re-run the tests locally and they passed. Merging this.

@andir andir merged commit b4d9f14 into NixOS:master Nov 23, 2018
@andir andir deleted the prometheus branch November 23, 2018 18:55
@grahamc
Copy link
Member

grahamc commented Nov 23, 2018

Way cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants