crowdsec/scripts/func_tests/tests_post-install_3machines.sh
Thibault "bui" Koechlin f1b0414c89
Unified functional tests (#696)
* remove dead / not needed code & scripts

* don't rely on /dev/urandom in wizard

* unified functional tests
2021-03-18 13:59:41 +01:00

23 lines
1,022 B
Bash
Executable file

#! /usr/bin/env bash
# -*- coding: utf-8 -*-
source tests_base.sh
## machines
${CSCLI} machines list -ojson | ${JQ} '. | length == 1' || fail "expected exactly one machine"
# add a new machine
${CSCLI} machines add -a -f ./test_machine.yaml CiTestMachine -ojson || fail "expected exactly one machine"
${CSCLI} machines list -ojson | ${JQ} '. | length == 2' || fail "expected exactly one machine"
${CSCLI} machines delete CiTestMachine -ojson || fail "expected exactly one machine"
${CSCLI} machines list -ojson | ${JQ} '. | length == 1' || fail "expected exactly one machine"
#try register/validate
${CSCLI} lapi register --machine CiTestMachineRegister -f new_machine.yaml
#the newly added machine isn't validated yet
${CSCLI} machines list -ojson | ${JQ} '.[1].isValidated == null' || fail "machine shouldn't be validated"
${CSCLI} machines validate CiTestMachineRegister || fail "failed to validate machine"
${CSCLI} machines list -ojson | ${JQ} '.[1].isValidated == true' || fail "machine should be validated"