tests: vagrant refactoring (#2328)

This commit is contained in:
mmetc 2023-07-04 12:26:32 +02:00 committed by GitHub
parent 17cd792826
commit 73f71a0aa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 354 additions and 378 deletions

View file

@ -11,13 +11,13 @@ include mk/gmsl
# MacOS: brew install re2
# To build without re2, run "make BUILD_RE2_WASM=1"
# The WASM version works just as well but might have performance issues, XXX: clarify
# so it is not recommended for production use.
# The WASM version is slower and introduces a short delay when starting a process
# (including cscli) so it is not recommended for production use.
BUILD_RE2_WASM ?= 0
# To build static binaries, run "make BUILD_STATIC=1".
# On some platforms, this requires
# additional packages (e.g. glibc-static and libstdc++-static on fedora, centos..).
# On some platforms, this requires additional packages
# (e.g. glibc-static and libstdc++-static on fedora, centos.. which are on the powertools/crb repository).
# If the static build fails at the link stage, it might be because the static library is not provided
# for your distribution (look for libre2.a). See the Dockerfile for an example of how to build it.
BUILD_STATIC ?= 0
@ -77,8 +77,6 @@ LD_OPTS_VARS += -X '$(GO_MODULE_NAME)/pkg/cwversion.System=docker'
endif
GO_TAGS := netgo,osusergo,sqlite_omit_load_extension
# this will be used by Go in the make target
export PKG_CONFIG_PATH:=/usr/local/lib/pkgconfig:$(PKG_CONFIG_PATH)
ifeq ($(call bool,$(BUILD_RE2_WASM)),0)
ifeq ($(PKG_CONFIG),)
@ -115,6 +113,7 @@ endif
.PHONY: build
build: pre-build goversion crowdsec cscli plugins
# Sanity checks and build information
.PHONY: pre-build
pre-build:
$(info Building $(BUILD_VERSION) ($(BUILD_TAG)) $(BUILD_TYPE) for $(GOOS)/$(GOARCH))
@ -166,6 +165,7 @@ testclean: bats-clean
@$(RM) pkg/cwhub/install $(WIN_IGNORE_ERR)
@$(RM) pkg/types/example.txt $(WIN_IGNORE_ERR)
# for the tests with localstack
export AWS_ENDPOINT_FORCE=http://localhost:4566
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
@ -173,15 +173,18 @@ export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
testenv:
@echo 'NOTE: You need Docker, docker-compose and run "make localstack" in a separate shell ("make localstack-stop" to terminate it)'
# run the tests with localstack
.PHONY: test
test: testenv goversion
$(GOTEST) $(LD_OPTS) ./...
# run the tests with localstack and coverage
.PHONY: go-acc
go-acc: testenv goversion
go-acc ./... -o coverage.out --ignore database,notifications,protobufs,cwversion,cstest,models -- $(LD_OPTS) | \
sed 's/ *coverage:.*of statements in.*//'
# mock AWS services
.PHONY: localstack
localstack:
docker-compose -f test/localstack/docker-compose.yml up
@ -193,6 +196,7 @@ localstack-stop:
# list of plugins that contain go.mod
PLUGIN_VENDOR = $(foreach plugin,$(PLUGINS),$(shell if [ -f $(PLUGINS_DIR)/$(plugin)/go.mod ]; then echo $(PLUGINS_DIR)/$(plugin); fi))
# build vendor.tgz to be distributed with the release
.PHONY: vendor
vendor:
$(foreach plugin_dir,$(PLUGIN_VENDOR), \
@ -203,6 +207,7 @@ vendor:
$(GOCMD) mod vendor
tar -czf vendor.tgz vendor $(foreach plugin_dir,$(PLUGIN_VENDOR),$(plugin_dir)/vendor)
# remove vendor directories and vendor.tgz
.PHONY: vendor-remove
vendor-remove:
$(foreach plugin_dir,$(PLUGIN_VENDOR), \
@ -239,13 +244,16 @@ else
@if (Test-Path -Path $(RELDIR)) { echo "$(RELDIR) already exists, abort" ; exit 1 ; }
endif
# build a release tarball
.PHONY: release
release: check_release build package
# build the windows installer
.PHONY: windows_installer
windows_installer: build
@.\make_installer.ps1 -version $(BUILD_VERSION)
# build the chocolatey package
.PHONY: chocolatey
chocolatey: windows_installer
@.\make_chocolatey.ps1 -version $(BUILD_VERSION)

View file

@ -14,3 +14,5 @@
- zsh-autosuggestions
- zsh-syntax-highlighting
- zsh-theme-powerlevel9k
when:
- ansible_facts.os_family == "Debian"

View file

@ -10,7 +10,6 @@
- crowdsecurity.testing.go
- crowdsecurity.testing.machine_id
- crowdsecurity.testing.epel
- crowdsecurity.testing.powertools
- crowdsecurity.testing.git
- crowdsecurity.testing.gcc
- crowdsecurity.testing.gnu_make

View file

@ -9,12 +9,12 @@ roles:
# these should be included as dependencies of crowdsecurity.testing, but sometime are not
- src: geerlingguy.repo-epel
- src: gantsign.golang
- src: robertdebock.powertools
collections:
- name: ansible.posix
- name: https://github.com/crowdsecurity/ansible-collection-crowdsecurity.testing.git
type: git
version: v0.0.3
version: v0.0.4
# - name: crowdsecurity.testing
# source: ../../../crowdsecurity.testing

View file

@ -1,6 +1,18 @@
# vim: set ft=yaml.ansible:
---
- name: "Set make_cmd = make (!bsd)"
ansible.builtin.set_fact:
make_cmd: make
when:
- ansible_facts.system not in ['FreeBSD', 'OpenBSD']
- name: "Set make_cmd = gmake (bsd)"
ansible.builtin.set_fact:
make_cmd: gmake
when:
- ansible_facts.system in ['FreeBSD', 'OpenBSD']
- name: "Build crowdsec from sources, prepare test environment and fixture"
become: false
block:

View file

@ -2,7 +2,10 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/alma8'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provision "shell", inline: <<-SHELL
sudo dnf -y install dnf-plugins-core kitty-terminfo
sudo dnf config-manager --set-enabled powertools
SHELL
end
common = '../common'

View file

@ -1,5 +0,0 @@
#!/bin/sh
unset IFS
set -euf
sudo dnf -y install kitty-terminfo

View file

@ -2,7 +2,10 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/alma9'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provision "shell", inline: <<-SHELL
sudo dnf -y install kitty-terminfo
sudo dnf config-manager --set-enabled crb
SHELL
end
common = '../common'

View file

@ -1,5 +0,0 @@
#!/bin/sh
unset IFS
set -euf
sudo dnf -y install kitty-terminfo

View file

@ -2,6 +2,8 @@
Vagrant.configure('2') do |config|
config.vm.box = 'centos/7'
config.vm.provision "shell", inline: <<-SHELL
SHELL
end
common = '../common'

View file

@ -2,7 +2,10 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/centos8s'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provision "shell", inline: <<-SHELL
sudo dnf -y install dnf-plugins-core kitty-terminfo
sudo dnf config-manager --set-enabled powertools
SHELL
end
common = '../common'

View file

@ -1,6 +0,0 @@
#!/bin/sh
unset IFS
set -euf
sudo dnf -y install dnf-plugins-core
dnf config-manager --set-enabled powertools

View file

@ -2,7 +2,10 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/centos9s'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provision "shell", inline: <<-SHELL
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --set-enabled crb
SHELL
end
common = '../common'

View file

@ -1,6 +0,0 @@
#!/bin/sh
unset IFS
set -euf
sudo dnf -y install dnf-plugins-core
dnf config-manager --set-enabled crb

View file

@ -1,46 +1,75 @@
# vim: set ft=ruby:
# frozen_string_literal: true
def find_ansible_cfg
path = Pathname.new(Dir.pwd)
until path.root?
ansible_cfg = path + 'ansible.cfg'
return path if ansible_cfg.exist?
path = path.parent
end
nil # return nil if not found
end
Vagrant.configure('2') do |config|
config.vm.define 'crowdsec'
if ARGV.any? { |arg| arg == 'up' || arg == 'provision' }
unless ENV['DB_BACKEND']
$stderr.puts "\e[31mThe DB_BACKEND environment variable is not defined. Please set up the environment and try again.\e[0m"
exit 1
end
end
config.vm.provision 'shell', path: 'bootstrap' if File.exists?('bootstrap')
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 1536
end
config.vm.synced_folder '.', '/vagrant', disabled: true
path = find_ansible_cfg
if !path
puts "ansible.cfg not found"
end
config.vm.provision 'ansible' do |ansible|
# ansible.verbose = 'vvvv'
ansible.config_file = '../../ansible.cfg'
ansible.playbook = '../../run_all.yml'
ansible.config_file = (path + 'ansible.cfg').to_s
ansible.playbook = (path + 'run_all.yml').to_s
ansible.compatibility_mode = "2.0"
end
# same as above, to run the steps separately
# config.vm.provision 'ansible' do |provdep|
# provdep.config_file = '../../ansible.cfg'
# provdep.playbook = '../../provision_dependencies.yml'
# config.vm.provision 'ansible' do |ansible|
# ansible.config_file = (path + 'ansible.cfg').to_s
# ansible.playbook = (path + 'provision_dependencies.yml').to_s
# ansible.compatibility_mode = "2.0"
# end
# config.vm.provision 'ansible' do |provtest|
# provtest.config_file = '../../ansible.cfg'
# provtest.playbook = '../../provision_test_suite.yml'
# config.vm.provision 'ansible' do |ansible|
# ansible.config_file = (path + 'ansible.cfg').to_s
# ansible.playbook = (path + 'provision_test_suite.yml').to_s
# ansible.compatibility_mode = "2.0"
# end
# config.vm.provision 'ansible' do |preptest|
# preptest.config_file = '../../ansible.cfg'
# preptest.playbook = '../../install_binary_package.yml'
# config.vm.provision 'ansible' do |ansible|
# ansible.config_file = (path + 'ansible.cfg').to_s
# ansible.playbook = (path + 'install_binary_package.yml').to_s
# ansible.compatibility_mode = "2.0"
# end
# config.vm.provision 'ansible' do |preptest|
# preptest.config_file = '../../ansible.cfg'
# preptest.playbook = '../../prepare_tests.yml'
# config.vm.provision 'ansible' do |ansible|
# ansible.config_file = (path + 'ansible.cfg').to_s
# ansible.playbook = (path + 'prepare_tests.yml').to_s
# ansible.compatibility_mode = "2.0"
# end
# config.vm.provision 'ansible' do |runtests|
# runtests.config_file = '../../ansible.cfg'
# runtests.playbook = '../../run_tests.yml'
# config.vm.provision 'ansible' do |ansible|
# ansible.config_file = (path + 'ansible.cfg').to_s
# ansible.playbook = (path + 'run_tests.yml').to_s
# ansible.compatibility_mode = "2.0"
# end
end

View file

@ -2,6 +2,8 @@
Vagrant.configure('2') do |config|
config.vm.box = 'debian/buster64'
config.vm.provision "shell", inline: <<-SHELL
SHELL
end
common = '../common'

View file

@ -2,6 +2,8 @@
Vagrant.configure('2') do |config|
config.vm.box = 'debian/bullseye64'
config.vm.provision "shell", inline: <<-SHELL
SHELL
end
common = '../common'

View file

@ -2,6 +2,9 @@
Vagrant.configure('2') do |config|
config.vm.box = 'debian/bookworm64'
config.vm.provision "shell", inline: <<-SHELL
# sudo apt install -y kitty-terminfo
SHELL
end
common = '../common'

View file

@ -2,6 +2,9 @@
Vagrant.configure('2') do |config|
config.vm.box = 'debian/stretch64'
config.vm.provision "shell", inline: <<-SHELL
sudo sed -i s/httpredir.debian.org/archive.debian.org/g /etc/apt/sources.list
SHELL
end
common = '../common'

View file

@ -2,6 +2,8 @@
Vagrant.configure('2') do |config|
config.vm.box = 'debian/testing64'
config.vm.provision "shell", inline: <<-SHELL
SHELL
end
common = '../common'

View file

@ -2,19 +2,10 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/hardenedbsd13'
config.vm.define 'crowdsec'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 1536
config.vm.provision "shell", inline: <<-SHELL
sudo pkg install python3
SHELL
end
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.provision 'ansible' do |ansible|
ansible.config_file = '../../../ansible.cfg'
ansible.playbook = '../../../run_all.yml'
end
end
common = '../../common'
load common if File.exist?(common)

View file

@ -1,5 +0,0 @@
#!/bin/sh
unset IFS
set -euf
sudo pkg install python3

View file

@ -0,0 +1,14 @@
# frozen_string_literal: true
Vagrant.configure('2') do |config|
config.vm.box = 'generic/openbsd6'
# config.vm.box_version = '4.2.16'
config.vm.provision "shell", inline: <<-SHELL
sudo pkg_add python py3-pip gcc openssl-1.0.2up3 gtar-1.34
# sudo pkg_add -u
# sudo pkg_add kitty
SHELL
end
common = '../../common'
load common if File.exist?(common)

View file

@ -0,0 +1,9 @@
#!/bin/sh
die() {
echo "$@" >&2
exit 1
}
[ "${PACKAGE_TESTING}" = "true" ] && die "no package available for this distribution"
exit 0

View file

@ -2,19 +2,13 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/openbsd7'
config.vm.define 'crowdsec'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 1536
# config.vm.box_version = '4.2.16'
config.vm.provision "shell", inline: <<-SHELL
sudo pkg_add python-3.9.16 py3-pip gcc-11.2.0p3 openssl-3.0.8 gtar-1.34
# sudo pkg_add -u
# sudo pkg_add kitty
SHELL
end
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.provision 'ansible' do |ansible|
ansible.config_file = '../../../ansible.cfg'
ansible.playbook = '../../../run_all.yml'
end
end
common = '../../common'
load common if File.exist?(common)

View file

@ -1,6 +0,0 @@
#!/bin/sh
unset IFS
set -euf
sudo pkg_add -u
sudo pkg_add python-3.9.13 py3-pip gcc-11.2.0p2 openssl-3.0.3p0 gtar-1.34 truncate-5.2.1

View file

@ -3,6 +3,8 @@
Vagrant.configure('2') do |config|
# config.vm.box = "fedora/33-cloud-base"
config.vm.box = 'generic/fedora33'
config.vm.provision "shell", inline: <<-SHELL
SHELL
end
common = '../common'

View file

@ -3,6 +3,8 @@
Vagrant.configure('2') do |config|
# config.vm.box = "fedora/34-cloud-base"
config.vm.box = 'generic/fedora34'
config.vm.provision "shell", inline: <<-SHELL
SHELL
end
common = '../common'

View file

@ -3,6 +3,8 @@
Vagrant.configure('2') do |config|
# config.vm.box = 'fedora/35-cloud-base'
config.vm.box = 'generic/fedora35'
config.vm.provision "shell", inline: <<-SHELL
SHELL
end
common = '../common'

View file

@ -3,6 +3,8 @@
Vagrant.configure('2') do |config|
# config.vm.box = "fedora/36-cloud-base"
config.vm.box = 'generic/fedora36'
config.vm.provision "shell", inline: <<-SHELL
SHELL
end
common = '../common'

View file

@ -2,7 +2,9 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/fedora37'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provision "shell", inline: <<-SHELL
sudo dnf -y install kitty-terminfo
SHELL
end
common = '../common'

View file

@ -1,5 +0,0 @@
#!/bin/sh
unset IFS
set -euf
sudo dnf -y install kitty-terminfo

View file

@ -2,6 +2,8 @@
Vagrant.configure('2') do |config|
config.vm.box = "fedora/38-cloud-base"
config.vm.provision "shell", inline: <<-SHELL
SHELL
end
common = '../common'

View file

@ -2,7 +2,9 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/freebsd12'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provision "shell", inline: <<-SHELL
pkg install -y gtar
SHELL
end
common = '../common'

View file

@ -1,6 +0,0 @@
#!/bin/sh
set -eu
pkg install -y gtar

View file

@ -2,7 +2,9 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/freebsd13'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provision "shell", inline: <<-SHELL
pkg install -y gtar
SHELL
end
common = '../common'

View file

@ -1,6 +0,0 @@
#!/bin/sh
set -eu
pkg install -y gtar

View file

@ -2,6 +2,9 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/oracle7'
config.vm.provision "shell", inline: <<-SHELL
sudo yum-config-manager --enable ol7_optional_latest
SHELL
end
common = '../common'

View file

@ -2,6 +2,9 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/oracle8'
config.vm.provision "shell", inline: <<-SHELL
sudo dnf config-manager --set-enabled ol8_codeready_builder
SHELL
end
common = '../common'

View file

@ -2,6 +2,9 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/oracle9'
config.vm.provision "shell", inline: <<-SHELL
sudo dnf config-manager --set-enabled ol9_codeready_builder
SHELL
end
common = '../common'

View file

@ -2,6 +2,10 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/rocky8'
config.vm.provision "shell", inline: <<-SHELL
sudo dnf config-manager --set-enabled powertools
sudo dnf -y install kitty-terminfo
SHELL
end
common = '../common'

View file

@ -2,6 +2,10 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/rocky9'
config.vm.provision "shell", inline: <<-SHELL
sudo dnf config-manager --set-enabled crb
sudo dnf -y install kitty-terminfo
SHELL
end
common = '../common'

View file

@ -2,6 +2,8 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/ubuntu1604'
config.vm.provision "shell", inline: <<-SHELL
SHELL
end
common = '../common'

View file

@ -3,6 +3,8 @@
Vagrant.configure('2') do |config|
# the official boxes only supports virtualbox
config.vm.box = 'generic/ubuntu1804'
config.vm.provision "shell", inline: <<-SHELL
SHELL
end
common = '../common'

View file

@ -2,6 +2,9 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/ubuntu2004'
config.vm.provision "shell", inline: <<-SHELL
sudo apt install -y kitty-terminfo
SHELL
end
common = '../common'

View file

@ -1,5 +0,0 @@
#!/bin/sh
unset IFS
set -euf
sudo apt install -y kitty-terminfo

View file

@ -2,6 +2,8 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/ubuntu2204'
config.vm.provision "shell", inline: <<-SHELL
SHELL
end
common = '../common'

View file

@ -0,0 +1,10 @@
# frozen_string_literal: true
Vagrant.configure('2') do |config|
config.vm.box = 'generic/ubuntu2210'
config.vm.provision "shell", inline: <<-SHELL
SHELL
end
common = '../common'
load common if File.exist?(common)

View file

@ -0,0 +1,10 @@
# frozen_string_literal: true
Vagrant.configure('2') do |config|
config.vm.box = 'bento/ubuntu-23.04'
config.vm.provision "shell", inline: <<-SHELL
SHELL
end
common = '../common'
load common if File.exist?(common)

View file

@ -1,38 +1,13 @@
# frozen_string_literal: true
Vagrant.configure('2') do |config|
config.vm.box = 'centos/stream8'
config.vm.define 'wizard'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 4
libvirt.memory = 4096
config.vm.box = 'generic/centos8s'
config.vm.provision "shell", inline: <<-SHELL
sudo dnf -y install dnf-plugins-core kitty-terminfo
dnf config-manager --set-enabled powertools
# sudo dnf -y update
SHELL
end
config.vm.synced_folder '.', '/vagrant', disabled: true
# install the dependencies for functional tests
config.vm.provision 'ansible' do |provdep|
provdep.config_file = '../../../ansible.cfg'
provdep.playbook = '../../../provision_dependencies.yml'
end
config.vm.provision 'ansible' do |provtest|
provtest.config_file = '../../../ansible.cfg'
provtest.playbook = '../../../provision_test_suite.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../prepare_tests.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../run_wizard_tests.yml'
end
end
common = '../common'
load common if File.exists?(common)

View file

@ -1,5 +0,0 @@
#!/bin/sh
unset IFS
set -euf
sudo dnf -y update

View file

@ -0,0 +1,67 @@
# vim: set ft=ruby:
# frozen_string_literal: true
def find_ansible_cfg
path = Pathname.new(Dir.pwd)
until path.root?
ansible_cfg = path + 'ansible.cfg'
return path if ansible_cfg.exist?
path = path.parent
end
nil # return nil if not found
end
Vagrant.configure('2') do |config|
config.vm.define 'wizard'
if ARGV.any? { |arg| arg == 'up' || arg == 'provision' }
unless ENV['DB_BACKEND']
$stderr.puts "\e[31mThe DB_BACKEND environment variable is not defined. Please set up the environment and try again.\e[0m"
exit 1
end
end
config.vm.provision 'shell', path: 'bootstrap' if File.exists?('bootstrap')
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 4
libvirt.memory = 4096
end
path = find_ansible_cfg
if !path
puts "ansible.cfg not found"
end
config.vm.provision 'ansible' do |ansible|
ansible.config_file = (path + 'ansible.cfg').to_s
ansible.playbook = (path + 'provision_dependencies.yml').to_s
ansible.compatibility_mode = "2.0"
end
config.vm.provision 'ansible' do |ansible|
ansible.config_file = (path + 'ansible.cfg').to_s
ansible.playbook = (path + 'provision_test_suite.yml').to_s
ansible.compatibility_mode = "2.0"
end
config.vm.provision 'ansible' do |ansible|
ansible.config_file = (path + 'ansible.cfg').to_s
ansible.playbook = (path + 'prepare_tests.yml').to_s
ansible.compatibility_mode = "2.0"
end
config.vm.provision 'ansible' do |ansible|
ansible.config_file = (path + 'ansible.cfg').to_s
ansible.playbook = (path + 'debug_tools.yml').to_s
ansible.compatibility_mode = "2.0"
end
config.vm.provision 'ansible' do |ansible|
ansible.config_file = (path + 'ansible.cfg').to_s
ansible.playbook = (path + 'run_wizard_tests.yml').to_s
ansible.compatibility_mode = "2.0"
end
end

View file

@ -0,0 +1,12 @@
# frozen_string_literal: true
Vagrant.configure('2') do |config|
config.vm.box = 'debian/buster64'
config.vm.provision "shell", inline: <<-SHELL
sudo apt update
sudo apt install -y aptitude kitty-terminfo
SHELL
end
common = '../common'
load common if File.exists?(common)

View file

@ -0,0 +1,12 @@
# frozen_string_literal: true
Vagrant.configure('2') do |config|
config.vm.box = 'debian/bullseye64'
config.vm.provision "shell", inline: <<-SHELL
sudo apt update
sudo apt install -y aptitude kitty-terminfo
SHELL
end
common = '../common'
load common if File.exists?(common)

View file

@ -0,0 +1,12 @@
# frozen_string_literal: true
Vagrant.configure('2') do |config|
config.vm.box = 'debian/bookworm64'
config.vm.provision "shell", inline: <<-SHELL
sudo apt update
sudo apt install -y aptitude kitty-terminfo
SHELL
end
common = '../common'
load common if File.exists?(common)

View file

@ -1,43 +0,0 @@
# frozen_string_literal: true
Vagrant.configure('2') do |config|
config.vm.box = 'debian/bullseye64'
config.vm.define 'wizard'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 4
libvirt.memory = 4096
end
config.vm.synced_folder '.', '/vagrant', disabled: true
# install the dependencies for functional tests
config.vm.provision 'ansible' do |provdep|
provdep.config_file = '../../../ansible.cfg'
provdep.playbook = '../../../provision_dependencies.yml'
end
config.vm.provision 'ansible' do |provtest|
provtest.config_file = '../../../ansible.cfg'
provtest.playbook = '../../../provision_test_suite.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../prepare_tests.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../debug_tools.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../run_wizard_tests.yml'
end
end

View file

@ -1,5 +0,0 @@
#!/bin/sh
unset IFS
set -euf
sudo apt install -y aptitude

View file

@ -1,43 +0,0 @@
# frozen_string_literal: true
Vagrant.configure('2') do |config|
config.vm.box = 'debian/buster64'
config.vm.define 'wizard'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 4
libvirt.memory = 4096
end
config.vm.synced_folder '.', '/vagrant', disabled: true
# install the dependencies for functional tests
config.vm.provision 'ansible' do |provdep|
provdep.config_file = '../../../ansible.cfg'
provdep.playbook = '../../../provision_dependencies.yml'
end
config.vm.provision 'ansible' do |provtest|
provtest.config_file = '../../../ansible.cfg'
provtest.playbook = '../../../provision_test_suite.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../prepare_tests.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../debug_tools.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../run_wizard_tests.yml'
end
end

View file

@ -1,5 +0,0 @@
#!/bin/sh
unset IFS
set -euf
sudo apt install -y aptitude

View file

@ -2,37 +2,10 @@
Vagrant.configure('2') do |config|
config.vm.box = 'fedora/36-cloud-base'
config.vm.define 'wizard'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 4
libvirt.memory = 4096
config.vm.provision "shell", inline: <<-SHELL
# sudo dnf -y update
SHELL
end
config.vm.synced_folder '.', '/vagrant', disabled: true
# install the dependencies for functional tests
config.vm.provision 'ansible' do |provdep|
provdep.config_file = '../../../ansible.cfg'
provdep.playbook = '../../../provision_dependencies.yml'
end
config.vm.provision 'ansible' do |provtest|
provtest.config_file = '../../../ansible.cfg'
provtest.playbook = '../../../provision_test_suite.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../prepare_tests.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../run_wizard_tests.yml'
end
end
common = '../common'
load common if File.exists?(common)

View file

@ -1,5 +0,0 @@
#!/bin/sh
unset IFS
set -euf
sudo dnf -y update

View file

@ -2,42 +2,10 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/ubuntu2204'
config.vm.define 'wizard'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 4
libvirt.memory = 4096
config.vm.provision "shell", inline: <<-SHELL
sudo apt install -y aptitude kitty-terminfo
SHELL
end
config.vm.synced_folder '.', '/vagrant', disabled: true
# install the dependencies for functional tests
config.vm.provision 'ansible' do |provdep|
provdep.config_file = '../../../ansible.cfg'
provdep.playbook = '../../../provision_dependencies.yml'
end
config.vm.provision 'ansible' do |provtest|
provtest.config_file = '../../../ansible.cfg'
provtest.playbook = '../../../provision_test_suite.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../prepare_tests.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../debug_tools.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../run_wizard_tests.yml'
end
end
common = '../common'
load common if File.exists?(common)

View file

@ -1,5 +0,0 @@
#!/bin/sh
unset IFS
set -euf
sudo apt install -y aptitude

View file

@ -2,42 +2,10 @@
Vagrant.configure('2') do |config|
config.vm.box = 'generic/ubuntu2210'
config.vm.define 'wizard'
config.vm.provision 'shell', path: 'bootstrap'
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 4
libvirt.memory = 4096
config.vm.provision "shell", inline: <<-SHELL
sudo apt install -y aptitude kitty-terminfo
SHELL
end
config.vm.synced_folder '.', '/vagrant', disabled: true
# install the dependencies for functional tests
config.vm.provision 'ansible' do |provdep|
provdep.config_file = '../../../ansible.cfg'
provdep.playbook = '../../../provision_dependencies.yml'
end
config.vm.provision 'ansible' do |provtest|
provtest.config_file = '../../../ansible.cfg'
provtest.playbook = '../../../provision_test_suite.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../prepare_tests.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../debug_tools.yml'
end
config.vm.provision 'ansible' do |preptest|
preptest.config_file = '../../../ansible.cfg'
preptest.playbook = '../../../run_wizard_tests.yml'
end
end
common = '../common'
load common if File.exists?(common)

View file

@ -37,8 +37,13 @@ setup() {
run -0 sudo gpg --yes --dearmor -o /usr/share/keyrings/openresty.gpg < <(output)
run -0 sudo tee <<< "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openresty.gpg] http://openresty.org/package/ubuntu $(lsb_release -sc) main" /etc/apt/sources.list.d/openresty.list
else
release="$(lsb_release -sc)"
# Debian 12 package is not available as of 2023-07-3
if [[ "$release" == "bookworm" ]]; then
release="bullseye"
fi
run -0 sudo apt-key add - < <(output)
run -0 sudo tee <<< "deb http://openresty.org/package/debian $(lsb_release -sc) openresty" /etc/apt/sources.list.d/openresty.list
run -0 sudo tee <<< "deb http://openresty.org/package/debian $release openresty" /etc/apt/sources.list.d/openresty.list
fi
run -0 deb-update
run -0 deb-install openresty

View file

@ -34,10 +34,14 @@ setup() {
run -0 rpm-install redhat-lsb-core
if [[ "$(lsb_release -is)" == "Fedora" ]]; then
run -0 sudo curl -1sSLf "https://openresty.org/package/fedora/openresty.repo" -o "/etc/yum.repos.d/openresty.repo"
elif [[ "$(lsb_release -is)" == "CentOS" ]]; then
elif [[ "$(lsb_release -is)" == CentOS* ]]; then # must match CentOSStream
run -0 sudo curl -1sSLf "https://openresty.org/package/centos/openresty.repo" -o "/etc/yum.repos.d/openresty.repo"
fi
run -0 sudo dnf check-update
run sudo dnf check-update
# 0 = up to date, 100 = updates available
if [[ "$status" -ne 0 ]] && [[ "$status" -ne 100 ]]; then
fail "dnf check-update failed with status $status"
fi
run -0 rpm-install openresty
run -0 sudo systemctl enable openresty.service
}

View file

@ -182,7 +182,7 @@ teardown() {
@test "cscli - empty LAPI credentials file" {
LOCAL_API_CREDENTIALS=$(config_get '.api.client.credentials_path')
truncate -s 0 "${LOCAL_API_CREDENTIALS}"
: > "${LOCAL_API_CREDENTIALS}"
rune -1 cscli lapi status
assert_stderr --partial "no credentials or URL found in api client configuration '${LOCAL_API_CREDENTIALS}'"