tests: vagrant refactoring (#2328)
This commit is contained in:
parent
17cd792826
commit
73f71a0aa3
20
Makefile
20
Makefile
|
@ -11,13 +11,13 @@ include mk/gmsl
|
||||||
# MacOS: brew install re2
|
# MacOS: brew install re2
|
||||||
|
|
||||||
# To build without re2, run "make BUILD_RE2_WASM=1"
|
# To build without re2, run "make BUILD_RE2_WASM=1"
|
||||||
# The WASM version works just as well but might have performance issues, XXX: clarify
|
# The WASM version is slower and introduces a short delay when starting a process
|
||||||
# so it is not recommended for production use.
|
# (including cscli) so it is not recommended for production use.
|
||||||
BUILD_RE2_WASM ?= 0
|
BUILD_RE2_WASM ?= 0
|
||||||
|
|
||||||
# To build static binaries, run "make BUILD_STATIC=1".
|
# To build static binaries, run "make BUILD_STATIC=1".
|
||||||
# On some platforms, this requires
|
# On some platforms, this requires additional packages
|
||||||
# additional packages (e.g. glibc-static and libstdc++-static on fedora, centos..).
|
# (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
|
# 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.
|
# for your distribution (look for libre2.a). See the Dockerfile for an example of how to build it.
|
||||||
BUILD_STATIC ?= 0
|
BUILD_STATIC ?= 0
|
||||||
|
@ -77,8 +77,6 @@ LD_OPTS_VARS += -X '$(GO_MODULE_NAME)/pkg/cwversion.System=docker'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
GO_TAGS := netgo,osusergo,sqlite_omit_load_extension
|
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 ($(call bool,$(BUILD_RE2_WASM)),0)
|
||||||
ifeq ($(PKG_CONFIG),)
|
ifeq ($(PKG_CONFIG),)
|
||||||
|
@ -115,6 +113,7 @@ endif
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: pre-build goversion crowdsec cscli plugins
|
build: pre-build goversion crowdsec cscli plugins
|
||||||
|
|
||||||
|
# Sanity checks and build information
|
||||||
.PHONY: pre-build
|
.PHONY: pre-build
|
||||||
pre-build:
|
pre-build:
|
||||||
$(info Building $(BUILD_VERSION) ($(BUILD_TAG)) $(BUILD_TYPE) for $(GOOS)/$(GOARCH))
|
$(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/cwhub/install $(WIN_IGNORE_ERR)
|
||||||
@$(RM) pkg/types/example.txt $(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_ENDPOINT_FORCE=http://localhost:4566
|
||||||
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
|
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
|
||||||
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
||||||
|
@ -173,15 +173,18 @@ export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
||||||
testenv:
|
testenv:
|
||||||
@echo 'NOTE: You need Docker, docker-compose and run "make localstack" in a separate shell ("make localstack-stop" to terminate it)'
|
@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
|
.PHONY: test
|
||||||
test: testenv goversion
|
test: testenv goversion
|
||||||
$(GOTEST) $(LD_OPTS) ./...
|
$(GOTEST) $(LD_OPTS) ./...
|
||||||
|
|
||||||
|
# run the tests with localstack and coverage
|
||||||
.PHONY: go-acc
|
.PHONY: go-acc
|
||||||
go-acc: testenv goversion
|
go-acc: testenv goversion
|
||||||
go-acc ./... -o coverage.out --ignore database,notifications,protobufs,cwversion,cstest,models -- $(LD_OPTS) | \
|
go-acc ./... -o coverage.out --ignore database,notifications,protobufs,cwversion,cstest,models -- $(LD_OPTS) | \
|
||||||
sed 's/ *coverage:.*of statements in.*//'
|
sed 's/ *coverage:.*of statements in.*//'
|
||||||
|
|
||||||
|
# mock AWS services
|
||||||
.PHONY: localstack
|
.PHONY: localstack
|
||||||
localstack:
|
localstack:
|
||||||
docker-compose -f test/localstack/docker-compose.yml up
|
docker-compose -f test/localstack/docker-compose.yml up
|
||||||
|
@ -193,6 +196,7 @@ localstack-stop:
|
||||||
# list of plugins that contain go.mod
|
# 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))
|
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
|
.PHONY: vendor
|
||||||
vendor:
|
vendor:
|
||||||
$(foreach plugin_dir,$(PLUGIN_VENDOR), \
|
$(foreach plugin_dir,$(PLUGIN_VENDOR), \
|
||||||
|
@ -203,6 +207,7 @@ vendor:
|
||||||
$(GOCMD) mod vendor
|
$(GOCMD) mod vendor
|
||||||
tar -czf vendor.tgz vendor $(foreach plugin_dir,$(PLUGIN_VENDOR),$(plugin_dir)/vendor)
|
tar -czf vendor.tgz vendor $(foreach plugin_dir,$(PLUGIN_VENDOR),$(plugin_dir)/vendor)
|
||||||
|
|
||||||
|
# remove vendor directories and vendor.tgz
|
||||||
.PHONY: vendor-remove
|
.PHONY: vendor-remove
|
||||||
vendor-remove:
|
vendor-remove:
|
||||||
$(foreach plugin_dir,$(PLUGIN_VENDOR), \
|
$(foreach plugin_dir,$(PLUGIN_VENDOR), \
|
||||||
|
@ -239,13 +244,16 @@ else
|
||||||
@if (Test-Path -Path $(RELDIR)) { echo "$(RELDIR) already exists, abort" ; exit 1 ; }
|
@if (Test-Path -Path $(RELDIR)) { echo "$(RELDIR) already exists, abort" ; exit 1 ; }
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# build a release tarball
|
||||||
.PHONY: release
|
.PHONY: release
|
||||||
release: check_release build package
|
release: check_release build package
|
||||||
|
|
||||||
|
# build the windows installer
|
||||||
.PHONY: windows_installer
|
.PHONY: windows_installer
|
||||||
windows_installer: build
|
windows_installer: build
|
||||||
@.\make_installer.ps1 -version $(BUILD_VERSION)
|
@.\make_installer.ps1 -version $(BUILD_VERSION)
|
||||||
|
|
||||||
|
# build the chocolatey package
|
||||||
.PHONY: chocolatey
|
.PHONY: chocolatey
|
||||||
chocolatey: windows_installer
|
chocolatey: windows_installer
|
||||||
@.\make_chocolatey.ps1 -version $(BUILD_VERSION)
|
@.\make_chocolatey.ps1 -version $(BUILD_VERSION)
|
||||||
|
|
|
@ -14,3 +14,5 @@
|
||||||
- zsh-autosuggestions
|
- zsh-autosuggestions
|
||||||
- zsh-syntax-highlighting
|
- zsh-syntax-highlighting
|
||||||
- zsh-theme-powerlevel9k
|
- zsh-theme-powerlevel9k
|
||||||
|
when:
|
||||||
|
- ansible_facts.os_family == "Debian"
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
- crowdsecurity.testing.go
|
- crowdsecurity.testing.go
|
||||||
- crowdsecurity.testing.machine_id
|
- crowdsecurity.testing.machine_id
|
||||||
- crowdsecurity.testing.epel
|
- crowdsecurity.testing.epel
|
||||||
- crowdsecurity.testing.powertools
|
|
||||||
- crowdsecurity.testing.git
|
- crowdsecurity.testing.git
|
||||||
- crowdsecurity.testing.gcc
|
- crowdsecurity.testing.gcc
|
||||||
- crowdsecurity.testing.gnu_make
|
- crowdsecurity.testing.gnu_make
|
||||||
|
|
|
@ -9,12 +9,12 @@ roles:
|
||||||
# these should be included as dependencies of crowdsecurity.testing, but sometime are not
|
# these should be included as dependencies of crowdsecurity.testing, but sometime are not
|
||||||
- src: geerlingguy.repo-epel
|
- src: geerlingguy.repo-epel
|
||||||
- src: gantsign.golang
|
- src: gantsign.golang
|
||||||
- src: robertdebock.powertools
|
|
||||||
|
|
||||||
collections:
|
collections:
|
||||||
|
- name: ansible.posix
|
||||||
- name: https://github.com/crowdsecurity/ansible-collection-crowdsecurity.testing.git
|
- name: https://github.com/crowdsecurity/ansible-collection-crowdsecurity.testing.git
|
||||||
type: git
|
type: git
|
||||||
version: v0.0.3
|
version: v0.0.4
|
||||||
|
|
||||||
# - name: crowdsecurity.testing
|
# - name: crowdsecurity.testing
|
||||||
# source: ../../../crowdsecurity.testing
|
# source: ../../../crowdsecurity.testing
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
# vim: set ft=yaml.ansible:
|
# 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"
|
- name: "Build crowdsec from sources, prepare test environment and fixture"
|
||||||
become: false
|
become: false
|
||||||
block:
|
block:
|
||||||
|
|
5
test/ansible/vagrant/alma-8/Vagrantfile
vendored
5
test/ansible/vagrant/alma-8/Vagrantfile
vendored
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/alma8'
|
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
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
unset IFS
|
|
||||||
set -euf
|
|
||||||
|
|
||||||
sudo dnf -y install kitty-terminfo
|
|
5
test/ansible/vagrant/alma-9/Vagrantfile
vendored
5
test/ansible/vagrant/alma-9/Vagrantfile
vendored
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/alma9'
|
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
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
unset IFS
|
|
||||||
set -euf
|
|
||||||
|
|
||||||
sudo dnf -y install kitty-terminfo
|
|
2
test/ansible/vagrant/centos-7/Vagrantfile
vendored
2
test/ansible/vagrant/centos-7/Vagrantfile
vendored
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'centos/7'
|
config.vm.box = 'centos/7'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
5
test/ansible/vagrant/centos-8/Vagrantfile
vendored
5
test/ansible/vagrant/centos-8/Vagrantfile
vendored
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/centos8s'
|
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
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
unset IFS
|
|
||||||
set -euf
|
|
||||||
|
|
||||||
sudo dnf -y install dnf-plugins-core
|
|
||||||
dnf config-manager --set-enabled powertools
|
|
5
test/ansible/vagrant/centos-9/Vagrantfile
vendored
5
test/ansible/vagrant/centos-9/Vagrantfile
vendored
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/centos9s'
|
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
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
unset IFS
|
|
||||||
set -euf
|
|
||||||
|
|
||||||
sudo dnf -y install dnf-plugins-core
|
|
||||||
dnf config-manager --set-enabled crb
|
|
|
@ -1,46 +1,75 @@
|
||||||
# vim: set ft=ruby:
|
# vim: set ft=ruby:
|
||||||
# frozen_string_literal: true
|
# 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|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.define 'crowdsec'
|
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|
|
config.vm.provider :libvirt do |libvirt|
|
||||||
libvirt.cpus = 1
|
libvirt.cpus = 1
|
||||||
libvirt.memory = 1536
|
libvirt.memory = 1536
|
||||||
end
|
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|
|
config.vm.provision 'ansible' do |ansible|
|
||||||
# ansible.verbose = 'vvvv'
|
# ansible.verbose = 'vvvv'
|
||||||
ansible.config_file = '../../ansible.cfg'
|
ansible.config_file = (path + 'ansible.cfg').to_s
|
||||||
ansible.playbook = '../../run_all.yml'
|
ansible.playbook = (path + 'run_all.yml').to_s
|
||||||
|
ansible.compatibility_mode = "2.0"
|
||||||
end
|
end
|
||||||
|
|
||||||
# same as above, to run the steps separately
|
# same as above, to run the steps separately
|
||||||
|
|
||||||
# config.vm.provision 'ansible' do |provdep|
|
# config.vm.provision 'ansible' do |ansible|
|
||||||
# provdep.config_file = '../../ansible.cfg'
|
# ansible.config_file = (path + 'ansible.cfg').to_s
|
||||||
# provdep.playbook = '../../provision_dependencies.yml'
|
# ansible.playbook = (path + 'provision_dependencies.yml').to_s
|
||||||
|
# ansible.compatibility_mode = "2.0"
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# config.vm.provision 'ansible' do |provtest|
|
# config.vm.provision 'ansible' do |ansible|
|
||||||
# provtest.config_file = '../../ansible.cfg'
|
# ansible.config_file = (path + 'ansible.cfg').to_s
|
||||||
# provtest.playbook = '../../provision_test_suite.yml'
|
# ansible.playbook = (path + 'provision_test_suite.yml').to_s
|
||||||
|
# ansible.compatibility_mode = "2.0"
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# config.vm.provision 'ansible' do |preptest|
|
# config.vm.provision 'ansible' do |ansible|
|
||||||
# preptest.config_file = '../../ansible.cfg'
|
# ansible.config_file = (path + 'ansible.cfg').to_s
|
||||||
# preptest.playbook = '../../install_binary_package.yml'
|
# ansible.playbook = (path + 'install_binary_package.yml').to_s
|
||||||
|
# ansible.compatibility_mode = "2.0"
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# config.vm.provision 'ansible' do |preptest|
|
# config.vm.provision 'ansible' do |ansible|
|
||||||
# preptest.config_file = '../../ansible.cfg'
|
# ansible.config_file = (path + 'ansible.cfg').to_s
|
||||||
# preptest.playbook = '../../prepare_tests.yml'
|
# ansible.playbook = (path + 'prepare_tests.yml').to_s
|
||||||
|
# ansible.compatibility_mode = "2.0"
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# config.vm.provision 'ansible' do |runtests|
|
# config.vm.provision 'ansible' do |ansible|
|
||||||
# runtests.config_file = '../../ansible.cfg'
|
# ansible.config_file = (path + 'ansible.cfg').to_s
|
||||||
# runtests.playbook = '../../run_tests.yml'
|
# ansible.playbook = (path + 'run_tests.yml').to_s
|
||||||
|
# ansible.compatibility_mode = "2.0"
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'debian/buster64'
|
config.vm.box = 'debian/buster64'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'debian/bullseye64'
|
config.vm.box = 'debian/bullseye64'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'debian/bookworm64'
|
config.vm.box = 'debian/bookworm64'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
# sudo apt install -y kitty-terminfo
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'debian/stretch64'
|
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
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'debian/testing64'
|
config.vm.box = 'debian/testing64'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -2,19 +2,10 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/hardenedbsd13'
|
config.vm.box = 'generic/hardenedbsd13'
|
||||||
config.vm.define 'crowdsec'
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
sudo pkg install python3
|
||||||
config.vm.provision 'shell', path: 'bootstrap'
|
SHELL
|
||||||
|
|
||||||
config.vm.provider :libvirt do |libvirt|
|
|
||||||
libvirt.cpus = 1
|
|
||||||
libvirt.memory = 1536
|
|
||||||
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
|
end
|
||||||
|
|
||||||
|
common = '../../common'
|
||||||
|
load common if File.exist?(common)
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
unset IFS
|
|
||||||
set -euf
|
|
||||||
|
|
||||||
sudo pkg install python3
|
|
14
test/ansible/vagrant/experimental/openbsd-6/Vagrantfile
vendored
Normal file
14
test/ansible/vagrant/experimental/openbsd-6/Vagrantfile
vendored
Normal 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)
|
9
test/ansible/vagrant/experimental/openbsd-6/skip
Executable file
9
test/ansible/vagrant/experimental/openbsd-6/skip
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
die() {
|
||||||
|
echo "$@" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "${PACKAGE_TESTING}" = "true" ] && die "no package available for this distribution"
|
||||||
|
exit 0
|
|
@ -2,19 +2,13 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/openbsd7'
|
config.vm.box = 'generic/openbsd7'
|
||||||
config.vm.define 'crowdsec'
|
# config.vm.box_version = '4.2.16'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
config.vm.provision 'shell', path: 'bootstrap'
|
sudo pkg_add python-3.9.16 py3-pip gcc-11.2.0p3 openssl-3.0.8 gtar-1.34
|
||||||
|
# sudo pkg_add -u
|
||||||
config.vm.provider :libvirt do |libvirt|
|
# sudo pkg_add kitty
|
||||||
libvirt.cpus = 1
|
SHELL
|
||||||
libvirt.memory = 1536
|
|
||||||
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
|
end
|
||||||
|
|
||||||
|
common = '../../common'
|
||||||
|
load common if File.exist?(common)
|
||||||
|
|
|
@ -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
|
|
2
test/ansible/vagrant/fedora-33/Vagrantfile
vendored
2
test/ansible/vagrant/fedora-33/Vagrantfile
vendored
|
@ -3,6 +3,8 @@
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
# config.vm.box = "fedora/33-cloud-base"
|
# config.vm.box = "fedora/33-cloud-base"
|
||||||
config.vm.box = 'generic/fedora33'
|
config.vm.box = 'generic/fedora33'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
2
test/ansible/vagrant/fedora-34/Vagrantfile
vendored
2
test/ansible/vagrant/fedora-34/Vagrantfile
vendored
|
@ -3,6 +3,8 @@
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
# config.vm.box = "fedora/34-cloud-base"
|
# config.vm.box = "fedora/34-cloud-base"
|
||||||
config.vm.box = 'generic/fedora34'
|
config.vm.box = 'generic/fedora34'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
2
test/ansible/vagrant/fedora-35/Vagrantfile
vendored
2
test/ansible/vagrant/fedora-35/Vagrantfile
vendored
|
@ -3,6 +3,8 @@
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
# config.vm.box = 'fedora/35-cloud-base'
|
# config.vm.box = 'fedora/35-cloud-base'
|
||||||
config.vm.box = 'generic/fedora35'
|
config.vm.box = 'generic/fedora35'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
2
test/ansible/vagrant/fedora-36/Vagrantfile
vendored
2
test/ansible/vagrant/fedora-36/Vagrantfile
vendored
|
@ -3,6 +3,8 @@
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
# config.vm.box = "fedora/36-cloud-base"
|
# config.vm.box = "fedora/36-cloud-base"
|
||||||
config.vm.box = 'generic/fedora36'
|
config.vm.box = 'generic/fedora36'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
4
test/ansible/vagrant/fedora-37/Vagrantfile
vendored
4
test/ansible/vagrant/fedora-37/Vagrantfile
vendored
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/fedora37'
|
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
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
unset IFS
|
|
||||||
set -euf
|
|
||||||
|
|
||||||
sudo dnf -y install kitty-terminfo
|
|
2
test/ansible/vagrant/fedora-38/Vagrantfile
vendored
2
test/ansible/vagrant/fedora-38/Vagrantfile
vendored
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = "fedora/38-cloud-base"
|
config.vm.box = "fedora/38-cloud-base"
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
4
test/ansible/vagrant/freebsd-12/Vagrantfile
vendored
4
test/ansible/vagrant/freebsd-12/Vagrantfile
vendored
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/freebsd12'
|
config.vm.box = 'generic/freebsd12'
|
||||||
config.vm.provision 'shell', path: 'bootstrap'
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
pkg install -y gtar
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
pkg install -y gtar
|
|
||||||
|
|
4
test/ansible/vagrant/freebsd-13/Vagrantfile
vendored
4
test/ansible/vagrant/freebsd-13/Vagrantfile
vendored
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/freebsd13'
|
config.vm.box = 'generic/freebsd13'
|
||||||
config.vm.provision 'shell', path: 'bootstrap'
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
pkg install -y gtar
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
pkg install -y gtar
|
|
||||||
|
|
3
test/ansible/vagrant/oracle-7/Vagrantfile
vendored
3
test/ansible/vagrant/oracle-7/Vagrantfile
vendored
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/oracle7'
|
config.vm.box = 'generic/oracle7'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
sudo yum-config-manager --enable ol7_optional_latest
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
3
test/ansible/vagrant/oracle-8/Vagrantfile
vendored
3
test/ansible/vagrant/oracle-8/Vagrantfile
vendored
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/oracle8'
|
config.vm.box = 'generic/oracle8'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
sudo dnf config-manager --set-enabled ol8_codeready_builder
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
3
test/ansible/vagrant/oracle-9/Vagrantfile
vendored
3
test/ansible/vagrant/oracle-9/Vagrantfile
vendored
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/oracle9'
|
config.vm.box = 'generic/oracle9'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
sudo dnf config-manager --set-enabled ol9_codeready_builder
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
4
test/ansible/vagrant/rocky-8/Vagrantfile
vendored
4
test/ansible/vagrant/rocky-8/Vagrantfile
vendored
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/rocky8'
|
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
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
4
test/ansible/vagrant/rocky-9/Vagrantfile
vendored
4
test/ansible/vagrant/rocky-9/Vagrantfile
vendored
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/rocky9'
|
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
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/ubuntu1604'
|
config.vm.box = 'generic/ubuntu1604'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
# the official boxes only supports virtualbox
|
# the official boxes only supports virtualbox
|
||||||
config.vm.box = 'generic/ubuntu1804'
|
config.vm.box = 'generic/ubuntu1804'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/ubuntu2004'
|
config.vm.box = 'generic/ubuntu2004'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
sudo apt install -y kitty-terminfo
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
unset IFS
|
|
||||||
set -euf
|
|
||||||
|
|
||||||
sudo apt install -y kitty-terminfo
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/ubuntu2204'
|
config.vm.box = 'generic/ubuntu2204'
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
common = '../common'
|
common = '../common'
|
||||||
|
|
10
test/ansible/vagrant/ubuntu-22.10-kinetic/Vagrantfile
vendored
Normal file
10
test/ansible/vagrant/ubuntu-22.10-kinetic/Vagrantfile
vendored
Normal 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)
|
10
test/ansible/vagrant/ubuntu-23.04-lunar/Vagrantfile
vendored
Normal file
10
test/ansible/vagrant/ubuntu-23.04-lunar/Vagrantfile
vendored
Normal 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)
|
43
test/ansible/vagrant/wizard/centos-8/Vagrantfile
vendored
43
test/ansible/vagrant/wizard/centos-8/Vagrantfile
vendored
|
@ -1,38 +1,13 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'centos/stream8'
|
config.vm.box = 'generic/centos8s'
|
||||||
config.vm.define 'wizard'
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
sudo dnf -y install dnf-plugins-core kitty-terminfo
|
||||||
config.vm.provision 'shell', path: 'bootstrap'
|
dnf config-manager --set-enabled powertools
|
||||||
|
# sudo dnf -y update
|
||||||
config.vm.provider :libvirt do |libvirt|
|
SHELL
|
||||||
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 = '../../../run_wizard_tests.yml'
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
common = '../common'
|
||||||
|
load common if File.exists?(common)
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
unset IFS
|
|
||||||
set -euf
|
|
||||||
|
|
||||||
sudo dnf -y update
|
|
67
test/ansible/vagrant/wizard/common
Normal file
67
test/ansible/vagrant/wizard/common
Normal 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
|
12
test/ansible/vagrant/wizard/debian-10-buster/Vagrantfile
vendored
Normal file
12
test/ansible/vagrant/wizard/debian-10-buster/Vagrantfile
vendored
Normal 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)
|
12
test/ansible/vagrant/wizard/debian-11-bullseye/Vagrantfile
vendored
Normal file
12
test/ansible/vagrant/wizard/debian-11-bullseye/Vagrantfile
vendored
Normal 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)
|
12
test/ansible/vagrant/wizard/debian-12-bookworm/Vagrantfile
vendored
Normal file
12
test/ansible/vagrant/wizard/debian-12-bookworm/Vagrantfile
vendored
Normal 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)
|
|
@ -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
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
unset IFS
|
|
||||||
set -euf
|
|
||||||
|
|
||||||
sudo apt install -y aptitude
|
|
|
@ -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
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
unset IFS
|
|
||||||
set -euf
|
|
||||||
|
|
||||||
sudo apt install -y aptitude
|
|
|
@ -2,37 +2,10 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'fedora/36-cloud-base'
|
config.vm.box = 'fedora/36-cloud-base'
|
||||||
config.vm.define 'wizard'
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
# sudo dnf -y update
|
||||||
config.vm.provision 'shell', path: 'bootstrap'
|
SHELL
|
||||||
|
|
||||||
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 = '../../../run_wizard_tests.yml'
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
common = '../common'
|
||||||
|
load common if File.exists?(common)
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
unset IFS
|
|
||||||
set -euf
|
|
||||||
|
|
||||||
sudo dnf -y update
|
|
|
@ -2,42 +2,10 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/ubuntu2204'
|
config.vm.box = 'generic/ubuntu2204'
|
||||||
config.vm.define 'wizard'
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
sudo apt install -y aptitude kitty-terminfo
|
||||||
config.vm.provision 'shell', path: 'bootstrap'
|
SHELL
|
||||||
|
|
||||||
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
|
end
|
||||||
|
|
||||||
|
common = '../common'
|
||||||
|
load common if File.exists?(common)
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
unset IFS
|
|
||||||
set -euf
|
|
||||||
|
|
||||||
sudo apt install -y aptitude
|
|
|
@ -2,42 +2,10 @@
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
config.vm.box = 'generic/ubuntu2210'
|
config.vm.box = 'generic/ubuntu2210'
|
||||||
config.vm.define 'wizard'
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
sudo apt install -y aptitude kitty-terminfo
|
||||||
config.vm.provision 'shell', path: 'bootstrap'
|
SHELL
|
||||||
|
|
||||||
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
|
end
|
||||||
|
|
||||||
|
common = '../common'
|
||||||
|
load common if File.exists?(common)
|
||||||
|
|
|
@ -37,8 +37,13 @@ setup() {
|
||||||
run -0 sudo gpg --yes --dearmor -o /usr/share/keyrings/openresty.gpg < <(output)
|
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
|
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
|
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 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
|
fi
|
||||||
run -0 deb-update
|
run -0 deb-update
|
||||||
run -0 deb-install openresty
|
run -0 deb-install openresty
|
||||||
|
|
|
@ -34,10 +34,14 @@ setup() {
|
||||||
run -0 rpm-install redhat-lsb-core
|
run -0 rpm-install redhat-lsb-core
|
||||||
if [[ "$(lsb_release -is)" == "Fedora" ]]; then
|
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"
|
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"
|
run -0 sudo curl -1sSLf "https://openresty.org/package/centos/openresty.repo" -o "/etc/yum.repos.d/openresty.repo"
|
||||||
fi
|
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 rpm-install openresty
|
||||||
run -0 sudo systemctl enable openresty.service
|
run -0 sudo systemctl enable openresty.service
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ teardown() {
|
||||||
|
|
||||||
@test "cscli - empty LAPI credentials file" {
|
@test "cscli - empty LAPI credentials file" {
|
||||||
LOCAL_API_CREDENTIALS=$(config_get '.api.client.credentials_path')
|
LOCAL_API_CREDENTIALS=$(config_get '.api.client.credentials_path')
|
||||||
truncate -s 0 "${LOCAL_API_CREDENTIALS}"
|
: > "${LOCAL_API_CREDENTIALS}"
|
||||||
rune -1 cscli lapi status
|
rune -1 cscli lapi status
|
||||||
assert_stderr --partial "no credentials or URL found in api client configuration '${LOCAL_API_CREDENTIALS}'"
|
assert_stderr --partial "no credentials or URL found in api client configuration '${LOCAL_API_CREDENTIALS}'"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue