github.com/crowdsecurity/crowdsec@v1.6.1/test/bats-detect/proxmox-deb.bats (about)

     1  #!/usr/bin/env bats
     2  # vim: ft=bats:list:ts=8:sts=4:sw=4:et:ai:si:
     3  
     4  set -u
     5  
     6  setup_file() {
     7      load "../lib/setup_file.sh"
     8      load "${BATS_TEST_DIRNAME}/lib/setup_file_detect.sh"
     9  }
    10  
    11  teardown_file() {
    12      load "../lib/teardown_file.sh"
    13      deb-remove proxmox-ve
    14  }
    15  
    16  setup() {
    17      if ! command -v dpkg >/dev/null; then
    18          skip 'not a debian-like system'
    19      fi
    20      load "../lib/setup.sh"
    21      load "../lib/bats-file/load.bash"
    22      ./instance-data load
    23  
    24      . /etc/os-release
    25      case "$VERSION_CODENAME" in
    26          bullseye | buster | jessie | squeeze | stretch | wheezy)
    27          skip "the installation does not work"
    28          ;;
    29      *)
    30          skip "unsupported distribution"
    31          ;;
    32      esac
    33      export VERSION_CODENAME
    34  }
    35  
    36  #----------
    37  
    38  @test "proxmox: detect unit (fail)" {
    39      run -0 cscli setup detect
    40      run -0 jq -r '.setup | .[].detected_service' <(output)
    41      refute_line 'proxmox-systemd'
    42  }
    43  
    44  @test "proxmox: install" {
    45      run -0 deb-install debian-keyring debian-archive-keyring apt-transport-https
    46      run -0 sudo curl -1sSLf http://download.proxmox.com/debian/proxmox-ve-release-6.x.gpg -o /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg
    47      run -0 sudo tee <<<"deb http://download.proxmox.com/debian/pve ${VERSION_CODENAME} pve-no-subscription" /etc/apt/sources.list.d/proxmox.list >/dev/null
    48      run -0 deb-update
    49      run -0 deb-install proxmox-ve
    50      run -0 sudo systemctl enable proxmox.service
    51  }
    52  
    53  @test "proxmox: detect unit (succeed)" {
    54      run -0 cscli setup detect
    55      run -0 jq -r '.setup | .[].detected_service' <(output)
    56      assert_line 'proxmox-systemd'
    57  }
    58  
    59  @test "proxmox: install detected collection" {
    60      run -0 cscli setup detect
    61      run -0 cscli setup install-hub <(output)
    62  }