mirror of
https://github.com/saltstack/salt.git
synced 2025-04-07 04:51:38 +00:00
Remove all kitchen and jenkins related resources
The salt-project hasn't been using them for a very long time.
This commit is contained in:
parent
e0761e33c0
commit
c920ba443d
41 changed files with 15 additions and 1426 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -112,12 +112,6 @@ tests/integration/cloud/providers/pki/minions
|
|||
# Ignore pyenv files
|
||||
.python-version
|
||||
|
||||
# Kitchen tests files
|
||||
.kitchen.local.yml
|
||||
kitchen.local.yml
|
||||
.kitchen/
|
||||
.bundle/
|
||||
Gemfile.lock
|
||||
/artifacts/
|
||||
requirements/static/*/py*/*.log
|
||||
|
||||
|
|
108
.gitlab-ci.yml
108
.gitlab-ci.yml
|
@ -1,108 +0,0 @@
|
|||
---
|
||||
stages:
|
||||
- lint
|
||||
- test
|
||||
|
||||
include:
|
||||
- local: 'cicd/kitchen_template.yml'
|
||||
- local: 'cicd/kitchen_testruns.yml'
|
||||
|
||||
# pre-commit-run-all:
|
||||
# image:
|
||||
# name: registry.gitlab.com/saltstack/pop/cicd/containers/ubuntu1804:latest
|
||||
# entrypoint: [""]
|
||||
# stage: lint
|
||||
# variables:
|
||||
# PRE_COMMIT_HOME: "${CI_PROJECT_DIR}/pre-commit-cache"
|
||||
# only:
|
||||
# refs:
|
||||
# - merge_requests
|
||||
# cache:
|
||||
# key: pre-commit-cache
|
||||
# paths:
|
||||
# - pre-commit-cache/
|
||||
# script:
|
||||
# - pip3 install pre-commit
|
||||
# - pre-commit run -a -v --color always
|
||||
|
||||
lint-salt-full:
|
||||
image: registry.gitlab.com/saltstack/pop/cicd/containers/ubuntu1804:latest
|
||||
stage: lint
|
||||
tags:
|
||||
- saltstack-internal
|
||||
cache:
|
||||
key: nox-lint-cache
|
||||
paths:
|
||||
- .nox
|
||||
only:
|
||||
refs:
|
||||
- schedules
|
||||
script:
|
||||
- python --version
|
||||
- pip3 install -U nox-py2==2019.6.25
|
||||
- nox --version
|
||||
- nox --install-only -e lint-salt
|
||||
- EC=254
|
||||
- export PYLINT_REPORT=pylint-report-salt-full.log
|
||||
- nox -e lint-salt
|
||||
- EC=$?
|
||||
- exit $EC
|
||||
|
||||
lint-tests-full:
|
||||
image: registry.gitlab.com/saltstack/pop/cicd/containers/ubuntu1804:latest
|
||||
stage: lint
|
||||
tags:
|
||||
- saltstack-internal
|
||||
cache:
|
||||
key: nox-lint-cache
|
||||
paths:
|
||||
- .nox
|
||||
only:
|
||||
refs:
|
||||
- schedules
|
||||
script:
|
||||
- python --version
|
||||
- pip3 install -U nox-py2==2019.6.25
|
||||
- nox --version
|
||||
- nox --install-only -e lint-tests
|
||||
- EC=254
|
||||
- export PYLINT_REPORT=pylint-report-tests-full.log
|
||||
- nox -e lint-tests
|
||||
- EC=$?
|
||||
- exit $EC
|
||||
|
||||
docs-build-html:
|
||||
image: registry.gitlab.com/saltstack/pop/cicd/containers/ubuntu1804:latest
|
||||
stage: test
|
||||
tags:
|
||||
- saltstack-internal
|
||||
cache:
|
||||
key: nox-docs-cache
|
||||
paths:
|
||||
- .nox
|
||||
only:
|
||||
refs:
|
||||
- schedules
|
||||
script:
|
||||
- python --version
|
||||
- pip install -U nox-py2==2019.6.25
|
||||
- nox --version
|
||||
- nox -e 'docs-html(compress=True)'
|
||||
|
||||
docs-build-man-pages:
|
||||
image: registry.gitlab.com/saltstack/pop/cicd/containers/ubuntu1804:latest
|
||||
stage: test
|
||||
tags:
|
||||
- saltstack-internal
|
||||
cache:
|
||||
key: nox-docs-cache
|
||||
paths:
|
||||
- .nox
|
||||
only:
|
||||
refs:
|
||||
- schedules
|
||||
script:
|
||||
- python --version
|
||||
- pip install -U nox-py2==2019.6.25
|
||||
- nox --version
|
||||
- nox -e 'docs-man(compress=True, update=False)'
|
|
@ -1447,7 +1447,6 @@ repos:
|
|||
(?x)^(
|
||||
templates/.*|
|
||||
salt/ext/.*|
|
||||
tests/kitchen/.*
|
||||
)$
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
|
@ -1460,7 +1459,6 @@ repos:
|
|||
(?x)^(
|
||||
templates/.*|
|
||||
salt/ext/.*|
|
||||
tests/kitchen/.*
|
||||
)$
|
||||
|
||||
- repo: https://github.com/asottile/blacken-docs
|
||||
|
|
|
@ -516,7 +516,7 @@ min-similarity-lines=4
|
|||
fileperms-default=0644
|
||||
|
||||
# File paths to ignore file permission. Glob patterns allowed.
|
||||
fileperms-ignore-paths=setup.py,noxfile.py,tests/runtests.py,tests/jenkins*.py,tests/saltsh.py,tests/buildpackage.py,tests/unit/files/rosters/ansible/roster.py
|
||||
fileperms-ignore-paths=setup.py,noxfile.py,tests/runtests.py,tests/saltsh.py,tests/buildpackage.py,tests/unit/files/rosters/ansible/roster.py
|
||||
|
||||
|
||||
[MODERNIZE]
|
||||
|
|
27
Gemfile
27
Gemfile
|
@ -1,27 +0,0 @@
|
|||
# This file is only used for running the test suite with kitchen-salt.
|
||||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'test-kitchen', '>=2.11.1'
|
||||
gem 'kitchen-salt', :git => 'https://github.com/saltstack/kitchen-salt.git'
|
||||
gem 'kitchen-sync'
|
||||
gem 'git'
|
||||
|
||||
group :docker do
|
||||
gem 'kitchen-docker', :git => 'https://github.com/test-kitchen/kitchen-docker.git', :branch => 'main'
|
||||
end
|
||||
|
||||
group :windows do
|
||||
gem 'winrm', '~>2.0'
|
||||
# gem 'winrm-fs', '~>1.3.1'
|
||||
gem 'winrm-fs', :git => 'https://github.com/s0undt3ch/winrm-fs.git', :branch => 'hotfix/saltstack-ci'
|
||||
end
|
||||
|
||||
group :ec2 do
|
||||
gem 'kitchen-ec2', '>=3.8'
|
||||
end
|
||||
|
||||
group :vagrant do
|
||||
gem 'vagrant-wrapper'
|
||||
gem 'kitchen-vagrant'
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
@Library('salt@master-1.11') _
|
||||
|
||||
runTestSuite(
|
||||
concurrent_builds: 0, // Don't cancel builds still running. Wait until they end.
|
||||
distro_name: 'centosstream',
|
||||
distro_version: '9',
|
||||
distro_arch: 'x86-64',
|
||||
env: env,
|
||||
jenkins_slave_label: 'kitchen-slave',
|
||||
kitchen_platforms_file: '/var/jenkins/workspace/cloud-platforms.yml',
|
||||
nox_env_name: 'pytest-cloud',
|
||||
nox_passthrough_opts: '',
|
||||
python_version: 'py3',
|
||||
testrun_timeout: 6,
|
||||
force_run_full: true,
|
||||
use_spot_instances: true)
|
||||
|
||||
// vim: ft=groovy
|
|
@ -1,49 +0,0 @@
|
|||
|
||||
.run-kitchen:
|
||||
image: ruby:2.6.3
|
||||
stage: test
|
||||
tags:
|
||||
- saltstack-kitchen
|
||||
only:
|
||||
refs:
|
||||
- schedules
|
||||
variables:
|
||||
FORCE_FULL: 'true'
|
||||
GOLDEN_IMAGES_CI_BRANCH: master
|
||||
NOX_ENABLE_FROM_FILENAMES: 'true'
|
||||
NOX_ENV_NAME: runtests-zeromq
|
||||
NOX_PASSTHROUGH_OPTS: '--ssh-tests'
|
||||
SALT_KITCHEN_DRIVER: kitchen-conf/driver.yml
|
||||
SALT_KITCHEN_PLATFORMS: kitchen-conf/nox-platforms.yml
|
||||
SALT_KITCHEN_VERIFIER: kitchen-conf/nox-verifier.yml
|
||||
TEST_SUITE: py3
|
||||
USE_SPOT_INSTANCES: 'true'
|
||||
script:
|
||||
- apt update
|
||||
- apt -y install moreutils rsync dos2unix
|
||||
- mkdir -p ~/.ssh
|
||||
- echo "${KITCHEN_SSHKEY}" | tr -d '\r' > ~/.ssh/kitchen.pem
|
||||
- chmod 700 ~/.ssh/
|
||||
- chmod 600 ~/.ssh/kitchen.pem
|
||||
- git clone https://gitlab.com/saltstack/open/cicd/kitchen-conf.git
|
||||
- bundle install --with ec2 windows --without docker vagrant
|
||||
- t=$(shuf -i 30-150 -n 1); echo "Sleeping $t seconds"; sleep $t
|
||||
- if [ "${USE_SPOT_INSTANCES}" == "true" ]; then cp -f kitchen-conf/spot.yml .kitchen.local.yml; fi
|
||||
- 'bundle exec kitchen create $TEST_SUITE-$TEST_PLATFORM || (bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM; rm .kitchen.local.yml; bundle exec kitchen create $TEST_SUITE-$TEST_PLATFORM)'
|
||||
- bundle exec kitchen diagnose $TEST_SUITE-$TEST_PLATFORM > kitchen-diagnose-info.txt
|
||||
- grep 'image_id:' kitchen-diagnose-info.txt
|
||||
- grep 'instance_type:' -A5 kitchen-diagnose-info.txt
|
||||
- rm -f kitchen-diagnose-info.txt
|
||||
- rm -f .kitchen.local.yml
|
||||
- ssh-agent /bin/bash -xc 'ssh-add ~/.ssh/kitchen.pem; bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM'
|
||||
- TEST_EXIT_CODE=0
|
||||
- 'DONT_DOWNLOAD_ARTEFACTS=1 bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM|ts -s || TEST_EXIT_CODE=$?'
|
||||
- 'ONLY_DOWNLOAD_ARTEFACTS=1 bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM|ts -s || true'
|
||||
- bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM
|
||||
- exit $TEST_EXIT_CODE
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- artifacts/
|
||||
- .kitchen/
|
||||
expire_in: 6 months
|
|
@ -1,118 +0,0 @@
|
|||
|
||||
kitchen-amazon2-py3:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: amazon-2
|
||||
|
||||
kitchen-archlts-py3:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: arch-lts
|
||||
|
||||
kitchen-archlts-py3:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: arch-lts
|
||||
NOX_PASSTHROUGH_OPTS: '-n integration.modules.test_pkg'
|
||||
|
||||
kitchen-centos7-py3-m2crypto:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: centos-7
|
||||
NOX_ENV_NAME: runtests-zeromq-m2crypto
|
||||
|
||||
kitchen-centos7-py3-proxy:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: centos-7
|
||||
NOX_PASSTHROUGH_OPTS: '--proxy'
|
||||
|
||||
kitchen-centos7-py3-pycryptodomex:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: centos-7
|
||||
NOX_ENV_NAME: runtests-zeromq-pycryptodomex
|
||||
|
||||
kitchen-centos7-py3:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: centos-7
|
||||
|
||||
kitchen-centos7-py3-tcp:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: centos-7
|
||||
NOX_ENV_NAME: runtests-tcp
|
||||
|
||||
kitchen-debian9-py3:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: debian-9
|
||||
|
||||
kitchen-debian10-py3:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: debian-10
|
||||
|
||||
kitchen-fedora30-py3:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: fedora-30
|
||||
|
||||
kitchen-fedora31-py3:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: fedora-31
|
||||
|
||||
kitchen-opensuse15-py3:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: opensuse-15
|
||||
|
||||
kitchen-ubuntu1604-py3-m2crypto:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: ubuntu-1604
|
||||
NOX_ENV_NAME: runtests-zeromq-m2crypto
|
||||
|
||||
kitchen-ubuntu1604-py3-proxy:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: ubuntu-1604
|
||||
NOX_PASSTHROUGH_OPTS: '--proxy'
|
||||
|
||||
kitchen-ubuntu1604-py3-pycryptodomex:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: ubuntu-1604
|
||||
NOX_ENV_NAME: runtests-zeromq-pycryptodomex
|
||||
|
||||
kitchen-ubuntu1604-py3:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: ubuntu-1604
|
||||
|
||||
kitchen-ubuntu1604-py3-tcp:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: ubuntu-1604
|
||||
NOX_ENV_NAME: runtests-tcp
|
||||
|
||||
kitchen-ubuntu1804-py3:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: ubuntu-1804
|
||||
|
||||
kitchen-windows2016-py3:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: windows-2016
|
||||
NOX_PASSTHROUGH_OPTS: '--unit'
|
||||
USE_SPOT_INSTANCES: 'false'
|
||||
|
||||
kitchen-windows2019-py3:
|
||||
extends: .run-kitchen
|
||||
variables:
|
||||
TEST_PLATFORM: windows-2019
|
||||
NOX_PASSTHROUGH_OPTS: '--unit'
|
||||
USE_SPOT_INSTANCES: 'false'
|
|
@ -63,7 +63,6 @@ for a bugfix release.
|
|||
|
||||
#. Ensure all required bug fixes are merged.
|
||||
#. Create release branch with the version of the release. (ex. 3000.1)
|
||||
#. Create jenkins jobs that test the new release branch.
|
||||
#. Run through a manual test run based off of the head of the branch.
|
||||
#. Generate the new man pages for the release.
|
||||
#. Create internal tag for testing.(ex v3000.1)
|
||||
|
|
|
@ -6,13 +6,10 @@ Salt's Test Suite
|
|||
|
||||
Salt comes with a powerful integration and unit test suite allowing for
|
||||
the fully automated run of integration and/or unit tests from a single
|
||||
interface. It uses the combination of pytest, nox and `Kitchen Salt`_ to
|
||||
run these tests. Nox is used to manage all of the test python dependencies.
|
||||
interface. It uses the combination of pytest and nox to run these tests.
|
||||
Nox is used to manage all of the test python dependencies.
|
||||
When you run the test runner with nox, you will be installing the same
|
||||
python dependencies that we use to run our test suite on PRs and branch tests.
|
||||
`Kitchen Salt`_ is used to spin up our virtual machines based off of golden
|
||||
images. These virtual machines use the `salt-jenkins`_ sls states to configure
|
||||
any system dependencies.
|
||||
|
||||
To learn the basics of how Salt's test suite works, be sure to check
|
||||
out the :ref:`Salt's Test Suite: An Introduction <tutorial-salt-testing>`
|
||||
|
@ -64,28 +61,17 @@ You can view all available sessions by running:
|
|||
For the most part you will only need nox to run the test suite, as this tool
|
||||
will install the exact same python dependencies we use to run on our test runs.
|
||||
The exception to this is when a system dependency is required, for example ``mysql``.
|
||||
These system dependencies are installed with sls states managed in the `salt-jenkins`_
|
||||
These system dependencies are installed with sls states managed in the `salt-ci-images`_
|
||||
repo or you can manually install the dependency yourself.
|
||||
|
||||
System Dependencies
|
||||
===================
|
||||
The system dependencies are installed from the `salt-jenkins`_ repo. The
|
||||
The system dependencies are installed from the `salt-ci-images`_ repo. The
|
||||
``golden-images-provision`` state is what is run to determine what dependencies
|
||||
to install on which platform.
|
||||
We run this state only when we want to update our current VM images with new
|
||||
dependencies.
|
||||
|
||||
Kitchen Salt
|
||||
============
|
||||
We also use `Kitchen Salt`_ to spin up the VM's used for testing. You can view the
|
||||
kitchen-salt `getting started`_ for instructions on how to install and set it up.
|
||||
`Kitchen Salt`_ uses Test Kitchen to spin up the VM or container in the configured
|
||||
provider. Once the VM is spun up, `Kitchen Salt`_ can install salt and run a particular
|
||||
set of states. In the case of our branch and PR tests we create "Golden Images" which
|
||||
run the `salt-jenkins`_ states and install salt system dependencies beforehand. We only
|
||||
update these "Golden Images" when we need to upgrade or install a system dependency. You can
|
||||
view the `kitchen-salt jenkins setup`_ docs for instructions on how to set up `Kitchen Salt`_
|
||||
similar to the jenkins environment we use to run branch and PR tests.
|
||||
|
||||
Test Directory Structure
|
||||
========================
|
||||
|
@ -532,8 +518,5 @@ run:
|
|||
nox -e 'test-3(coverage=False)' -- --markers
|
||||
|
||||
|
||||
.. _kitchen-salt jenkins setup: https://kitchen.saltproject.io/docs/file/docs/jenkins.md
|
||||
.. _getting started: https://kitchen.saltproject.io/docs/file/docs/gettingstarted.md
|
||||
.. _salt-jenkins: https://github.com/saltstack/salt-jenkins
|
||||
.. _Kitchen Salt: https://kitchen.saltproject.io/
|
||||
.. _salt-ci-images: https://github.com/saltstack/salt-ci-images
|
||||
.. _pytest: https://docs.pytest.org/en/latest/usage.html#specifying-tests-selecting-tests
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
.. _test-pipeline:
|
||||
|
||||
=============
|
||||
Test Pipeline
|
||||
=============
|
||||
|
||||
Salt's test suite is run on `jenkins`_. We have added the ``@pytest.mark.slow_test``
|
||||
pytest decorator to help designate tests that take a significant amount of time to
|
||||
run. These tests are only run on our branch tests, unless your PR is editing code
|
||||
that requires running a specific slow test. When you submit a PR it will by default,
|
||||
only run the tests that do not include the ``@pytest.mark.slow_test`` pytest decorator.
|
||||
|
||||
|
||||
Process to Fix Test Failures on Branch Tests
|
||||
--------------------------------------------
|
||||
|
||||
If there is a failure on the branch tests on `jenkins`_, this is the process to follow
|
||||
to ensure it is fixed.
|
||||
|
||||
- Review the issues in Salt repo with the label ``Test-Failure`` to ensure there isn't
|
||||
an already open issue assigned to someone to fix.
|
||||
- If there is not an issue open for the failing test, create a new issue in Salt's repo
|
||||
- Select "Test Failure" and the issue will create the correct template you need.
|
||||
- Include the name of the test that is failing in the title
|
||||
- Include the jenkins URL to the test in the body and any additional information needed.
|
||||
- When you create the issue it will automatically add the label ``Test-Failure``.
|
||||
- If you are going to fix the test assign yourself to the issue.
|
||||
- If you are not going to fix the test, there is nothing else to do. The core team will
|
||||
review these open issues and ensure they are assinged out to be fixed.
|
||||
|
||||
|
||||
.. _jenkins: https://jenkins.saltproject.io
|
|
@ -415,7 +415,7 @@ Add a system dependency to the test run
|
|||
---------------------------------------
|
||||
|
||||
If you need to add a system dependency for the test run, this will need to be added in
|
||||
the `salt jenkins`_ repo. This repo uses salt states to install system dependencies.
|
||||
the `salt-ci-images`_ repo. This repo uses salt states to install system dependencies.
|
||||
You need to update the ``state-tree/golden-images-provision.sls`` file with
|
||||
your dependency to ensure it is installed. Once your PR is merged the core team
|
||||
will need to promote the new images with your new dependency installed.
|
||||
|
@ -516,16 +516,6 @@ All thought the fast, slow and core tests specified in the change file will alwa
|
|||
* test:flaky-jail
|
||||
|
||||
|
||||
Automated Test Runs
|
||||
===================
|
||||
|
||||
SaltStack maintains a Jenkins server which can be viewed at
|
||||
https://jenkins.saltproject.io. The tests executed from this Jenkins server
|
||||
create fresh virtual machines for each test run, then execute the destructive
|
||||
tests on the new, clean virtual machine. This allows for the execution of tests
|
||||
across supported platforms.
|
||||
|
||||
|
||||
Additional Testing Documentation
|
||||
================================
|
||||
|
||||
|
@ -545,4 +535,4 @@ Python testing documentation. Please see the follow references for more informat
|
|||
.. _MagicMock: https://docs.python.org/3/library/unittest.mock.html
|
||||
.. _Python Unittest: https://docs.python.org/3/library/unittest.html
|
||||
.. _Python's Assert Functions: https://docs.python.org/3/library/unittest.html#assert-methods
|
||||
.. _salt jenkins: https://github.com/saltstack/salt-jenkins
|
||||
.. _salt-ci-images: https://github.com/saltstack/salt-ci-images
|
||||
|
|
247
kitchen.yml
247
kitchen.yml
|
@ -1,247 +0,0 @@
|
|||
---
|
||||
<% vagrant = system('gem list -i kitchen-vagrant 2>/dev/null >/dev/null') %>
|
||||
<% version = '2018.3.3' %>
|
||||
<% platformsfile = ENV['SALT_KITCHEN_PLATFORMS'] || '.kitchen/platforms.yml' %>
|
||||
<% driverfile = ENV['SALT_KITCHEN_DRIVER'] || '.kitchen/driver.yml' %>
|
||||
<% verifierfile = ENV['SALT_KITCHEN_VERIFIER'] || '.kitchen/verifier.yml' %>
|
||||
|
||||
<% if File.exists?(driverfile) %>
|
||||
<%= ERB.new(File.read(driverfile)).result %>
|
||||
<% else %>
|
||||
driver:
|
||||
name: docker
|
||||
use_sudo: false
|
||||
hostname: salt
|
||||
privileged: true
|
||||
username: kitchen
|
||||
volume:
|
||||
- /var/run/docker.sock:/docker.sock
|
||||
cap_add:
|
||||
- sys_admin
|
||||
disable_upstart: false
|
||||
provision_command:
|
||||
- echo 'L /run/docker.sock - - - - /docker.sock' > /etc/tmpfiles.d/docker.conf
|
||||
transport:
|
||||
name: rsync
|
||||
<% end %>
|
||||
|
||||
provisioner:
|
||||
name: salt_solo
|
||||
salt_install: bootstrap
|
||||
salt_version: latest
|
||||
salt_bootstrap_url: https://bootstrap.saltstack.com
|
||||
salt_bootstrap_options: -X -p rsync git v<%= version %>
|
||||
log_level: info
|
||||
sudo: true
|
||||
require_chef: false
|
||||
retry_on_exit_code:
|
||||
- 139
|
||||
max_retries: 2
|
||||
remote_states:
|
||||
name: https://github.com/saltstack/salt-jenkins.git
|
||||
branch: master
|
||||
repo: git
|
||||
testingdir: /testing
|
||||
salt_copy_filter:
|
||||
- __pycache__
|
||||
- '*.pyc'
|
||||
- .bundle
|
||||
- .tox
|
||||
- .nox
|
||||
- .kitchen
|
||||
- artifacts
|
||||
- Gemfile.lock
|
||||
state_top:
|
||||
base:
|
||||
"os:Windows":
|
||||
- match: grain
|
||||
- windows
|
||||
"*":
|
||||
- <%= ENV['KITCHEN_STATE'] || 'git.salt' %>
|
||||
pillars:
|
||||
top.sls:
|
||||
base:
|
||||
"*":
|
||||
- jenkins
|
||||
"os:Windows":
|
||||
- match: grain
|
||||
- windows
|
||||
jenkins.sls:
|
||||
testing_dir: "{{salt.config.get('root_dir')|replace('\\', '\\\\')}}/testing"
|
||||
clone_repo: false
|
||||
salttesting_namespec: salttesting==2017.6.1
|
||||
windows.sls:
|
||||
virtualenv_path: 'c:\Python27\Scripts\pip.exe'
|
||||
<% if File.exists?(platformsfile) %>
|
||||
<%= ERB.new(File.read(platformsfile)).result %>
|
||||
<% else %>
|
||||
platforms:
|
||||
- name: fedora
|
||||
driver_config:
|
||||
image: fedora:latest
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
provisioner:
|
||||
salt_bootstrap_options: -X -p rsync git v<%= version %> >/dev/null
|
||||
- name: centos-7
|
||||
driver_config:
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
- name: centos-6
|
||||
driver_config:
|
||||
run_command: /sbin/init
|
||||
provision_command:
|
||||
- yum install -y upstart
|
||||
provisioner:
|
||||
salt_bootstrap_options: -P -p rsync -y -x python2.7 -X git v<%= version %> >/dev/null
|
||||
- name: ubuntu-18.04
|
||||
driver_config:
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: ubuntu-16.04
|
||||
driver_config:
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: ubuntu-14.04
|
||||
driver_config:
|
||||
run_command: /sbin/init
|
||||
provision_command:
|
||||
- rm -f /sbin/initctl
|
||||
- dpkg-divert --local --rename --remove /sbin/initctl
|
||||
- name: debian-8
|
||||
driver_config:
|
||||
run_command: /lib/systemd/systemd
|
||||
provision_command:
|
||||
- apt-get install -y dbus
|
||||
- echo 'L /run/docker.sock - - - - /docker.sock' > /etc/tmpfiles.d/docker.conf
|
||||
- name: debian-9
|
||||
driver_config:
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: arch
|
||||
driver_config:
|
||||
image: archlinux/base
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
provision_command:
|
||||
- pacman -Syu --noconfirm systemd
|
||||
- systemctl enable sshd
|
||||
- echo 'L /run/docker.sock - - - - /docker.sock' > /etc/tmpfiles.d/docker.conf
|
||||
provisioner:
|
||||
salt_bootstrap_options: -X -p rsync git v<%= version %> >/dev/null
|
||||
- name: opensuse-15
|
||||
driver_config:
|
||||
image: opensuse/leap:15.0
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
provision_command:
|
||||
- zypper --non-interactive install --auto-agree-with-licenses dbus-1
|
||||
- systemctl enable sshd.service
|
||||
- echo 'L /run/docker.sock - - - - /docker.sock' > /etc/tmpfiles.d/docker.conf
|
||||
provisioner:
|
||||
salt_bootstrap_options: -qXU -x python2 git v<%= @version %>
|
||||
- name: opensuse-42.3
|
||||
driver_config:
|
||||
image: opensuse/leap:42.3
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
provision_command:
|
||||
- zypper --non-interactive install --auto-agree-with-licenses dbus-1
|
||||
- systemctl enable sshd.service
|
||||
- echo 'L /run/docker.sock - - - - /docker.sock' > /etc/tmpfiles.d/docker.conf
|
||||
<% if vagrant != false %>
|
||||
- name: windows-2012r2
|
||||
driver:
|
||||
box: mwrock/Windows2012R2
|
||||
name: vagrant
|
||||
gui: true
|
||||
transport:
|
||||
name: winrm
|
||||
username: Administrator
|
||||
password: Pass@word1
|
||||
provisioner:
|
||||
init_environment: |
|
||||
Clear-Host
|
||||
$AddedLocation ="c:\salt;c:\salt\bin\Scripts"
|
||||
$Reg = "Registry::HKLM\System\CurrentControlSet\Control\Session Manager\Environment"
|
||||
$OldPath = (Get-ItemProperty -Path $Reg -Name PATH).Path
|
||||
$NewPath= $OldPath + ";" + $AddedLocation
|
||||
Set-ItemProperty -Path $Reg -Value $NewPath -Name PATH
|
||||
reg add "hklm\system\currentcontrolset\control\session manager\memory management" /v pagingfiles /t reg_multi_sz /d "d:\pagefile.sys 4096 8192" /f
|
||||
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="5000"}'
|
||||
salt_bootstrap_url: https://raw.githubusercontent.com/saltstack/salt-bootstrap/develop/bootstrap-salt.ps1
|
||||
salt_bootstrap_options: ''
|
||||
verifier:
|
||||
windows: true
|
||||
types:
|
||||
- unit
|
||||
coverage_xml: false
|
||||
save:
|
||||
$env:TEMP/salt-runtests.log: artifacts/logs/salt-runtests.log
|
||||
/salt/var/log/salt/minion: artifacts/logs/minion
|
||||
- name: windows-2016
|
||||
driver:
|
||||
box: mwrock/Windows2016
|
||||
name: vagrant
|
||||
gui: true
|
||||
customize:
|
||||
cpus: 4
|
||||
memory: 8192
|
||||
transport:
|
||||
name: winrm
|
||||
username: Vagrant
|
||||
password: vagrant
|
||||
provisioner:
|
||||
salt_bootstrap_url: https://raw.githubusercontent.com/saltstack/salt-bootstrap/develop/bootstrap-salt.ps1
|
||||
salt_bootstrap_options: -version <%= version %>
|
||||
init_environment: |
|
||||
Clear-Host
|
||||
$AddedLocation ="c:\salt;c:\salt\bin\Scripts"
|
||||
$Reg = "Registry::HKLM\System\CurrentControlSet\Control\Session Manager\Environment"
|
||||
$OldPath = (Get-ItemProperty -Path $Reg -Name PATH).Path
|
||||
$NewPath= $OldPath + ";" + $AddedLocation
|
||||
Set-ItemProperty -Path $Reg -Value $NewPath -Name PATH
|
||||
reg add "hklm\system\currentcontrolset\control\session manager\memory management" /v pagingfiles /t reg_multi_sz /d "d:\pagefile.sys 4096 8192" /f
|
||||
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="5000"}'
|
||||
salt_bootstrap_url: https://raw.githubusercontent.com/saltstack/salt-bootstrap/develop/bootstrap-salt.ps1
|
||||
salt_bootstrap_options: ''
|
||||
verifier:
|
||||
windows: true
|
||||
types:
|
||||
- unit
|
||||
coverage_xml: false
|
||||
xml: /tmp/xml-unittests-output/
|
||||
save:
|
||||
/tmp/xml-unittests-output/: artifacts/
|
||||
$env:TEMP/salt-runtests.log: artifacts/logs/salt-runtests.log
|
||||
/salt/var/log/salt/minion: artifacts/logs/minion
|
||||
<% end %>
|
||||
<% end %>
|
||||
suites:
|
||||
- name: py2
|
||||
verifier:
|
||||
python_bin: python2.7
|
||||
- name: py3
|
||||
excludes:
|
||||
- centos-6
|
||||
- ubuntu-14.04
|
||||
verifier:
|
||||
python_bin: python3
|
||||
provisioner:
|
||||
pillars:
|
||||
jenkins.sls:
|
||||
py3: true
|
||||
windows.sls:
|
||||
virtualenv_path: 'c:\Python35\Scripts\pip.exe'
|
||||
|
||||
<% if File.exists?(verifierfile) %>
|
||||
<%= ERB.new(File.read(verifierfile)).result %>
|
||||
<% else %>
|
||||
verifier:
|
||||
name: runtests
|
||||
sudo: true
|
||||
run_destructive: true
|
||||
transport: zeromq
|
||||
enable_filenames: true
|
||||
types:
|
||||
- ssh
|
||||
xml: /tmp/xml-unittests-output/
|
||||
coverage_xml: /tmp/coverage.xml
|
||||
save:
|
||||
/tmp/xml-unittests-output: artifacts/
|
||||
/tmp/coverage.xml: artifacts/coverage/coverage.xml
|
||||
/tmp/kitchen/var/log/salt/minion: artifacts/logs/minion
|
||||
/tmp/salt-runtests.log: artifacts/logs/salt-runtests.log
|
||||
<% end %>
|
|
@ -2,7 +2,6 @@
|
|||
exclude= """
|
||||
/(
|
||||
salt/ext
|
||||
| tests/kitchen
|
||||
| templates
|
||||
)/
|
||||
"""
|
||||
|
@ -14,7 +13,7 @@ force_grid_wrap = 0
|
|||
use_parentheses = true
|
||||
line_length = 88
|
||||
ensure_newline_before_comments=true
|
||||
skip="salt/ext,tests/kitchen,templates"
|
||||
skip="salt/ext,templates"
|
||||
known_third_party = [
|
||||
"pytest"
|
||||
]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
log_date_format=%H:%M:%S
|
||||
log_cli_format=%(asctime)s,%(msecs)03.0f [%(name)-5s:%(lineno)-4d][%(levelname)-8s][%(processName)s(%(process)s)] %(message)s
|
||||
log_file_format=%(asctime)s,%(msecs)03d [%(name)-17s:%(lineno)-4d][%(levelname)-8s][%(processName)s(%(process)d)] %(message)s
|
||||
norecursedirs=templates tests/kitchen tests/utils tests/support
|
||||
norecursedirs=templates tests/utils tests/support
|
||||
testpaths=tests
|
||||
python_files=test_*.py
|
||||
python_classes=Test*
|
||||
|
|
|
@ -3,7 +3,7 @@ What Is This All About
|
|||
|
||||
This directory will contain platform specific requirements(and the requirements
|
||||
of each requirements) locked to the versions used as if the testing environment
|
||||
was setup using the salt-jenkins states.
|
||||
was setup using the salt-ci-images states.
|
||||
|
||||
The purpose of this is to ease the transition to `nox` and golden images where
|
||||
only binary system packages are installed on the golden image and `nox`
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# This is a compilation of requirements installed on salt-jenkins git.salt state run
|
||||
|
||||
--constraint=../pkg/py{py_version}/{platform}.txt
|
||||
|
||||
pygit2>=1.10.1
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# This is a compilation of requirements installed on salt-jenkins git.salt state run
|
||||
--constraint=../pkg/py{py_version}/{platform}.txt
|
||||
|
||||
dmidecode
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
driver:
|
||||
name: docker
|
||||
use_sudo: false
|
||||
privileged: true
|
||||
<% if File.exists?('driver.yml') %>
|
||||
<% File.read('driver.yml').split(/\n/).each do |line| %>
|
||||
<%= line %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
provisioner:
|
||||
name: salt_solo
|
||||
salt_install: pip
|
||||
pip_pkg: <%= ENV['SALT_SDIST_PATH'] || 'salt' %>
|
||||
pip_index_url: <%= ENV['SALT_INDEX_URL'] || 'https://pypi.python.org/simple' %>
|
||||
require_chef: false
|
||||
formula: states
|
||||
<% if File.exists?('provisioner.yml') %>
|
||||
<% File.read('provisioner.yml').split(/\n/).each do |line| %>
|
||||
<%= line %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if File.exists?('state_top.yml') %>
|
||||
<% File.read('state_top.yml').split(/\n/).each do |line| %>
|
||||
<%= line %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
state_top:
|
||||
base:
|
||||
'*':
|
||||
- states
|
||||
<% end %>
|
||||
<% if File.exists?('pillars.yml') %>
|
||||
<% File.read('pillars.yml').split(/\n/).each do |line| %>
|
||||
<%= line %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if File.exists?('platforms.yml') %>
|
||||
<%= File.read('platforms.yml') %>
|
||||
<% else %>
|
||||
platforms:
|
||||
- name: centos
|
||||
driver_config:
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
provision_command:
|
||||
- yum install -y epel-release
|
||||
- yum install -y python-pip python-devel gcc git gcc-c++
|
||||
- name: opensuse
|
||||
driver_config:
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
provision_command:
|
||||
- systemctl enable sshd.service
|
||||
- zypper install -y python-pip python-devel gcc git gcc-c++
|
||||
- name: ubuntu
|
||||
driver_config:
|
||||
run_command: /lib/systemd/systemd
|
||||
provision_command:
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get install -y python-pip python-dev gcc git locales console-data
|
||||
- name: debian
|
||||
driver_config:
|
||||
run_command: /lib/systemd/systemd
|
||||
provision_command:
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get install -y python-pip python-dev gcc git locales console-data
|
||||
<% end %>
|
||||
|
||||
<% if File.exists?('suites.yml') %>
|
||||
<%= File.read('suites.yml') %>
|
||||
<% else %>
|
||||
suites:
|
||||
- name: salt
|
||||
<% end %>
|
||||
|
||||
<% if File.exists?('verifier.yml') %>
|
||||
<%= File.read('verifier.yml') %>
|
||||
<% else %>
|
||||
verifier:
|
||||
name: shell
|
||||
remote_exec: false
|
||||
<% if ENV['TESTS_JUNIT_XML_PATH'].nil? %>
|
||||
command: pytest -v tests/$KITCHEN_SUITE
|
||||
<% else %>
|
||||
command: pytest --junit-xml <%= ENV['TESTS_JUNIT_XML_PATH'] %> -v tests/$KITCHEN_SUITE
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -1,9 +0,0 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
gem 'test-kitchen'
|
||||
gem 'kitchen-salt', :git => 'https://github.com/saltstack/kitchen-salt.git'
|
||||
gem 'kitchen-docker', :git => 'https://github.com/test-kitchen/kitchen-docker.git'
|
||||
gem 'vagrant-wrapper'
|
||||
gem 'kitchen-vagrant'
|
||||
gem 'winrm', '~>2.0'
|
||||
gem 'winrm-fs', '~>1.0'
|
|
@ -1,89 +0,0 @@
|
|||
"""
|
||||
Test wrapper for running all KitchenSalt tests
|
||||
|
||||
All directories in 'tests/kitchen/' will be treated as a separate test under
|
||||
the KitchenTestCase.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import setup
|
||||
from salt.modules import cmdmod as cmd
|
||||
from tests.support.unit import TestCase
|
||||
import pytest
|
||||
|
||||
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
||||
@pytest.mark.skip_if_binaries_missing("bundle")
|
||||
class KitchenTestCase(TestCase):
|
||||
"""
|
||||
Test kitchen environments
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""
|
||||
setup kitchen tests
|
||||
"""
|
||||
cls.topdir = "/" + os.path.join(*CURRENT_DIR.split("/")[:-2])
|
||||
cls.use_vt = int(os.environ.get("TESTS_LOG_LEVEL")) >= 5
|
||||
cmd.run("python setup.py sdist", cwd=cls.topdir)
|
||||
# TBD cmd.run("python -m pip install --upgrade build") # add build when implement pyproject.toml
|
||||
# TBD cmd.run("python -m build --sdist {}".format(cls.topdir)) # replace with build when implement pyproject.toml
|
||||
cmd.run("bundle install", cwd=CURRENT_DIR)
|
||||
cls.env = {
|
||||
"KITCHEN_YAML": os.path.join(CURRENT_DIR, ".kitchen.yml"),
|
||||
"SALT_SDIST_PATH": os.path.join(
|
||||
cls.topdir, "dist", "salt-{}.tar.gz".format(setup.__version__)
|
||||
),
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
del cls.topdir
|
||||
del cls.env
|
||||
|
||||
def tearDown(self):
|
||||
cmd.run(
|
||||
"bundle exec kitchen destroy all",
|
||||
cwd=os.path.join(CURRENT_DIR, "tests", self.testdir),
|
||||
env=self.env,
|
||||
use_vt=self.use_vt,
|
||||
)
|
||||
del self.testdir
|
||||
|
||||
|
||||
def func_builder(testdir):
|
||||
def func(self):
|
||||
self.testdir = testdir
|
||||
if "TESTS_XML_OUTPUT_DIR" in os.environ:
|
||||
self.env[
|
||||
"TESTS_JUNIT_XML_PATH"
|
||||
] = "{}/kitchen.tests.{}.$KITCHEN_SUITE.$KITCHEN_PLATFORM.xml".format(
|
||||
os.environ.get("TESTS_XML_OUTPUT_DIR"), self.testdir,
|
||||
)
|
||||
self.assertEqual(
|
||||
cmd.retcode(
|
||||
"bundle exec kitchen converge -c 999 all",
|
||||
cwd=os.path.join(CURRENT_DIR, "tests", self.testdir),
|
||||
env=self.env,
|
||||
use_vt=self.use_vt,
|
||||
),
|
||||
0,
|
||||
)
|
||||
self.assertEqual(
|
||||
cmd.retcode(
|
||||
"bundle exec kitchen verify all",
|
||||
cwd=os.path.join(CURRENT_DIR, "tests", self.testdir),
|
||||
env=self.env,
|
||||
use_vt=self.use_vt,
|
||||
),
|
||||
0,
|
||||
)
|
||||
|
||||
return func
|
||||
|
||||
|
||||
for testdir in os.listdir(os.path.join(CURRENT_DIR, "tests")):
|
||||
setattr(KitchenTestCase, "test_kitchen_{}".format(testdir), func_builder(testdir))
|
|
@ -1,2 +0,0 @@
|
|||
forward:
|
||||
- 80
|
|
@ -1,23 +0,0 @@
|
|||
pillars:
|
||||
top.sls:
|
||||
base:
|
||||
"*":
|
||||
- wordpress
|
||||
wordpress.sls:
|
||||
mysql:
|
||||
database:
|
||||
- wordpress
|
||||
user:
|
||||
wordpress:
|
||||
password: quair9aiqueeShae4toh
|
||||
host: localhost
|
||||
databases:
|
||||
- database: wordpress
|
||||
grants:
|
||||
- all privileges
|
||||
wordpress:
|
||||
lookup:
|
||||
admin_user: gtmanfred
|
||||
admin_email: daniel@gtmanfred.com
|
||||
title: "GtManfred's Blog"
|
||||
url: http://blog.manfred.io
|
|
@ -1,13 +0,0 @@
|
|||
platforms:
|
||||
- name: centos
|
||||
driver_config:
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
provision_command:
|
||||
- yum install -y epel-release
|
||||
- yum install -y python-pip python-devel gcc git gcc-c++
|
||||
- name: opensuse
|
||||
driver_config:
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
provision_command:
|
||||
- systemctl enable sshd.service
|
||||
- zypper install -y python-pip python-devel gcc git gcc-c++
|
|
@ -1,10 +0,0 @@
|
|||
dependencies:
|
||||
- name: apache
|
||||
repo: git
|
||||
source: https://github.com/saltstack-formulas/apache-formula.git
|
||||
- name: mysql
|
||||
repo: git
|
||||
source: https://github.com/saltstack-formulas/mysql-formula.git
|
||||
- name: php
|
||||
repo: git
|
||||
source: https://github.com/saltstack-formulas/php-formula.git
|
|
@ -1,29 +0,0 @@
|
|||
{%- load_yaml as rawmap %}
|
||||
Debian:
|
||||
user: www-data
|
||||
group: www-data
|
||||
dir: /var/www/html/
|
||||
admin_user: wordpress
|
||||
admin_password: "{{salt.grains.get_or_set_hash('generated:wordpress:password')}}"
|
||||
admin_email: test@example.com
|
||||
title: Wordpress
|
||||
url: http://localhost/
|
||||
RedHat:
|
||||
user: apache
|
||||
group: apache
|
||||
dir: /var/www/html/
|
||||
admin_user: wordpress
|
||||
admin_password: "{{salt.grains.get_or_set_hash('generated:wordpress:password')}}"
|
||||
admin_email: test@example.com
|
||||
title: Wordpress
|
||||
url: http://localhost/
|
||||
Suse:
|
||||
user: wwwrun
|
||||
group: www
|
||||
dir: /srv/www/htdocs/
|
||||
admin_user: wordpress
|
||||
admin_password: "{{salt.grains.get_or_set_hash('generated:wordpress:password')}}"
|
||||
admin_email: test@example.com
|
||||
title: Wordpress
|
||||
url: http://localhost/
|
||||
{%- endload %}
|
|
@ -1,7 +0,0 @@
|
|||
include:
|
||||
- php.ng
|
||||
- php.ng.mysql
|
||||
- php.ng.apache2
|
||||
- apache
|
||||
- mysql
|
||||
- .setup
|
|
@ -1,78 +0,0 @@
|
|||
{% from "states/defaults.yaml" import rawmap with context %}
|
||||
{%- set config = salt['grains.filter_by'](rawmap, grain='os_family', merge=salt['config.get']('wordpress:lookup')) %}
|
||||
|
||||
download wordpress archive:
|
||||
pkg.latest:
|
||||
- name: tar
|
||||
|
||||
archive.extracted:
|
||||
- name: {{config.dir}}
|
||||
- source_hash: a99115b3b6d6d7a1eb6c5617d4e8e704ed50f450
|
||||
- source: https://wordpress.org/wordpress-4.8.2.tar.gz
|
||||
- options: --strip-components=1
|
||||
- enforce_toplevel: false
|
||||
grains.present:
|
||||
- name: wordpressdir
|
||||
- value: {{config.dir}}
|
||||
|
||||
configure wordpress:
|
||||
file.managed:
|
||||
- name: {{config.dir}}/wp-config.php
|
||||
- source: salt://states/wp-config.php.j2
|
||||
- user: {{config.user}}
|
||||
- group: {{config.group}}
|
||||
- template: jinja
|
||||
|
||||
{%- if grains.os_family in ('Suse',) %}
|
||||
suse setup:
|
||||
pkg.latest:
|
||||
- pkgs:
|
||||
- php5-phar
|
||||
- apache2-mod_php5
|
||||
- listen_in:
|
||||
- service: apache
|
||||
file.managed:
|
||||
- name: /etc/apache2/conf.d/mod_php.conf
|
||||
- contents: |
|
||||
LoadModule php5_module /usr/lib64/apache2/mod_php5.so
|
||||
- listen_in:
|
||||
- service: apache
|
||||
{%- elif grains.os_family in ('Debian',) %}
|
||||
remove default index.html:
|
||||
file.absent:
|
||||
- name: /var/www/html/index.html
|
||||
{%- endif %}
|
||||
|
||||
get wp manager script:
|
||||
|
||||
file.managed:
|
||||
- name: /usr/local/bin/wp
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 755
|
||||
- source: salt://states/wp-cli.phar
|
||||
- source_hash: a647367c1e6c34c7357e380515d59e15fbc86fa2
|
||||
- reload_modules: True
|
||||
|
||||
do install:
|
||||
wordpress.installed:
|
||||
- path: {{config.dir}}
|
||||
- user: {{config.user}}
|
||||
- admin_user: {{config.admin_user}}
|
||||
- admin_password: "{{config.admin_password}}"
|
||||
- admin_email: "{{config.admin_email}}"
|
||||
- title: "{{config.title}}"
|
||||
- url: "{{config.url}}"
|
||||
- retry:
|
||||
attempts: 5
|
||||
|
||||
file.directory:
|
||||
- name: {{config.dir}}
|
||||
- user: {{config.user}}
|
||||
- group: {{config.group}}
|
||||
- file_mode: 644
|
||||
- dir_mode: 2775
|
||||
- recurse:
|
||||
- user
|
||||
- group
|
||||
- mode
|
Binary file not shown.
|
@ -1,82 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* The base configuration for WordPress
|
||||
*
|
||||
* The wp-config.php creation script uses this file during the
|
||||
* installation. You don't have to use the web site, you can
|
||||
* copy this file to "wp-config.php" and fill in the values.
|
||||
*
|
||||
* This file contains the following configurations:
|
||||
*
|
||||
* * MySQL settings
|
||||
* * Secret keys
|
||||
* * Database table prefix
|
||||
* * ABSPATH
|
||||
*
|
||||
* @link https://codex.wordpress.org/Editing_wp-config.php
|
||||
*
|
||||
* @package WordPress
|
||||
*/
|
||||
|
||||
// ** MySQL settings - You can get this info from your web host ** //
|
||||
/** The name of the database for WordPress */
|
||||
define('DB_NAME', 'wordpress');
|
||||
|
||||
/** MySQL database username */
|
||||
define('DB_USER', 'wordpress');
|
||||
|
||||
/** MySQL database password */
|
||||
define('DB_PASSWORD', 'quair9aiqueeShae4toh');
|
||||
|
||||
/** MySQL hostname */
|
||||
define('DB_HOST', 'localhost');
|
||||
|
||||
/** Database Charset to use in creating database tables. */
|
||||
define('DB_CHARSET', 'utf8');
|
||||
|
||||
/** The Database Collate type. Don't change this if in doubt. */
|
||||
define('DB_COLLATE', '');
|
||||
|
||||
/**#@+
|
||||
* Authentication Unique Keys and Salts.
|
||||
*
|
||||
* Change these to different unique phrases!
|
||||
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
|
||||
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
{%- do salt['http.query']('https://api.wordpress.org/secret-key/1.1/salt/') %}
|
||||
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* WordPress Database Table prefix.
|
||||
*
|
||||
* You can have multiple installations in one database if you give each
|
||||
* a unique prefix. Only numbers, letters, and underscores please!
|
||||
*/
|
||||
$table_prefix = 'wp_';
|
||||
|
||||
/**
|
||||
* For developers: WordPress debugging mode.
|
||||
*
|
||||
* Change this to true to enable the display of notices during development.
|
||||
* It is strongly recommended that plugin and theme developers use WP_DEBUG
|
||||
* in their development environments.
|
||||
*
|
||||
* For information on other constants that can be used for debugging,
|
||||
* visit the Codex.
|
||||
*
|
||||
* @link https://codex.wordpress.org/Debugging_in_WordPress
|
||||
*/
|
||||
define('WP_DEBUG', false);
|
||||
|
||||
/* That's all, stop editing! Happy blogging. */
|
||||
|
||||
/** Absolute path to the WordPress directory. */
|
||||
if ( !defined('ABSPATH') )
|
||||
define('ABSPATH', dirname(__FILE__) . '/');
|
||||
|
||||
/** Sets up WordPress vars and included files. */
|
||||
require_once(ABSPATH . 'wp-settings.php');
|
|
@ -1,43 +0,0 @@
|
|||
import functools
|
||||
import os
|
||||
import pytest
|
||||
import subprocess
|
||||
import testinfra
|
||||
|
||||
if os.environ.get('KITCHEN_USERNAME') == 'vagrant':
|
||||
if 'windows' in os.environ.get('KITCHEN_INSTANCE'):
|
||||
test_host = testinfra.get_host('winrm://{KITCHEN_USERNAME}:{KITCHEN_PASSWORD}@{KITCHEN_HOSTNAME}:{KITCHEN_PORT}'.format(**os.environ), no_ssl=True)
|
||||
else:
|
||||
test_host = testinfra.get_host('paramiko://{KITCHEN_USERNAME}@{KITCHEN_HOSTNAME}:{KITCHEN_PORT}'.format(**os.environ),
|
||||
ssh_identity_file=os.environ.get('KITCHEN_SSH_KEY'))
|
||||
elif 'KITCHEN_USERNAME' in os.environ:
|
||||
test_host = testinfra.get_host('docker://{KITCHEN_USERNAME}@{KITCHEN_CONTAINER_ID}'.format(**os.environ))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def host():
|
||||
return test_host
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def salt():
|
||||
if 'windows' in os.environ.get('KITCHEN_INSTANCE'):
|
||||
tmpconf = r'c:\Users\vagrant\AppData\Local\Temp\kitchen\etc\salt'
|
||||
else:
|
||||
test_host.run('sudo chown -R {} /tmp/kitchen'.format(os.environ.get('KITCHEN_USERNAME')))
|
||||
tmpconf = '/tmp/kitchen/etc/salt'
|
||||
return functools.partial(test_host.salt, config=tmpconf)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def http_port():
|
||||
return subprocess.check_output(
|
||||
['docker', 'inspect',
|
||||
'-f', '{{(index (index .NetworkSettings.Ports "80/tcp") 0).HostPort}}',
|
||||
os.environ.get('KITCHEN_CONTAINER_ID')]
|
||||
).strip().decode()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def host_ip():
|
||||
return os.environ.get('KITCHEN_HOSTNAME')
|
|
@ -1,13 +0,0 @@
|
|||
def test_formula(salt):
|
||||
'''
|
||||
Test that the states are synced to minion
|
||||
'''
|
||||
dirs = salt('cp.list_master_dirs')
|
||||
assert 'states' in dirs
|
||||
|
||||
def test_wordpress_module(salt):
|
||||
'''
|
||||
Test that the wordpress dir grain was set on the minion
|
||||
'''
|
||||
wordpressdir = salt('grains.get', 'wordpressdir')
|
||||
assert salt('wordpress.is_installed', wordpressdir)
|
|
@ -1,9 +0,0 @@
|
|||
import requests
|
||||
|
||||
|
||||
def test_server(host_ip, http_port):
|
||||
'''
|
||||
Test that wordpress was setup on the minion correctly and returns a 200 after being installed
|
||||
'''
|
||||
resp = requests.get('http://{}:{}'.format(host_ip, http_port), headers={'Host': 'blog.manfred.io'})
|
||||
assert resp.status_code == 200
|
|
@ -467,7 +467,7 @@ def test_shell_properly_handled_on_macOS():
|
|||
)
|
||||
|
||||
assert re.search(
|
||||
"{} -l -c".format(user_default_shell), cmd_handler.cmd
|
||||
f"{user_default_shell} -l -c", cmd_handler.cmd
|
||||
), "cmd invokes right bash session on macOS"
|
||||
|
||||
# User default shell is '/bin/zsh'
|
||||
|
@ -559,10 +559,6 @@ def test_run_all_binary_replace():
|
|||
with salt.utils.files.fopen(rand_bytes_file, "rb") as fp_:
|
||||
stdout_bytes = fp_.read()
|
||||
|
||||
# kitchen-salt uses unix2dos on all the files before copying them over
|
||||
# to the vm that will be running the tests. It skips binary files though
|
||||
# The file specified in `rand_bytes_file` is detected as binary so the
|
||||
# Unix-style line ending remains. This should account for that.
|
||||
stdout_bytes = stdout_bytes.rstrip() + os.linesep.encode()
|
||||
|
||||
# stdout with the non-decodable bits replaced with the unicode
|
||||
|
@ -911,9 +907,7 @@ def test_runas_env_all_os(test_os, test_family, bundled):
|
|||
"-c",
|
||||
]
|
||||
if test_os == "FreeBSD":
|
||||
env_cmd.extend(
|
||||
["{} -c {}".format(shell, sys.executable)]
|
||||
)
|
||||
env_cmd.extend([f"{shell} -c {sys.executable}"])
|
||||
else:
|
||||
env_cmd.extend([sys.executable])
|
||||
assert popen_mock.call_args_list[0][0][0] == env_cmd
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
"""
|
||||
Script for copying back xml junit files from tests
|
||||
"""
|
||||
|
||||
import argparse # pylint: disable=minimum-python-version
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
import paramiko
|
||||
|
||||
import salt.utils.yaml
|
||||
|
||||
|
||||
class DownloadArtifacts:
|
||||
def __init__(self, instance, artifacts):
|
||||
self.instance = instance
|
||||
self.artifacts = artifacts
|
||||
self.transport = self.setup_transport()
|
||||
self.sftpclient = paramiko.SFTPClient.from_transport(self.transport)
|
||||
|
||||
def setup_transport(self):
|
||||
# pylint: disable=minimum-python-version
|
||||
config = salt.utils.yaml.safe_load(
|
||||
subprocess.check_output(
|
||||
["bundle", "exec", "kitchen", "diagnose", self.instance]
|
||||
)
|
||||
)
|
||||
# pylint: enable=minimum-python-version
|
||||
state = config["instances"][self.instance]["state_file"]
|
||||
tport = config["instances"][self.instance]["transport"]
|
||||
transport = paramiko.Transport(
|
||||
(state["hostname"], state.get("port", tport.get("port", 22)))
|
||||
)
|
||||
pkey = paramiko.rsakey.RSAKey(
|
||||
filename=state.get("ssh_key", tport.get("ssh_key", "~/.ssh/id_rsa"))
|
||||
)
|
||||
transport.connect(
|
||||
username=state.get("username", tport.get("username", "root")), pkey=pkey
|
||||
)
|
||||
return transport
|
||||
|
||||
def _set_permissions(self):
|
||||
"""
|
||||
Make sure all xml files are readable by the world so that anyone can grab them
|
||||
"""
|
||||
for remote, _ in self.artifacts:
|
||||
self.transport.open_session().exec_command(
|
||||
"sudo chmod -R +r {}".format(remote)
|
||||
)
|
||||
|
||||
def download(self):
|
||||
self._set_permissions()
|
||||
for remote, local in self.artifacts:
|
||||
if remote.endswith("/"):
|
||||
for fxml in self.sftpclient.listdir(remote):
|
||||
self._do_download(
|
||||
os.path.join(remote, fxml),
|
||||
os.path.join(local, os.path.basename(fxml)),
|
||||
)
|
||||
else:
|
||||
self._do_download(remote, os.path.join(local, os.path.basename(remote)))
|
||||
|
||||
def _do_download(self, remote, local):
|
||||
print("Copying from {} to {}".format(remote, local))
|
||||
try:
|
||||
self.sftpclient.get(remote, local)
|
||||
except OSError:
|
||||
print("Failed to copy: {}".format(remote))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Jenkins Artifact Download Helper")
|
||||
parser.add_argument(
|
||||
"--instance",
|
||||
required=True,
|
||||
action="store",
|
||||
help="Instance on Test Kitchen to pull from",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--download-artifacts",
|
||||
dest="artifacts",
|
||||
nargs=2,
|
||||
action="append",
|
||||
metavar=("REMOTE_PATH", "LOCAL_PATH"),
|
||||
help="Download remote artifacts",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
downloader = DownloadArtifacts(args.instance, args.artifacts)
|
||||
downloader.download()
|
|
@ -1,117 +0,0 @@
|
|||
"""
|
||||
getTerminalSize()
|
||||
- get width and height of console
|
||||
- works on linux,os x,windows,cygwin(windows)
|
||||
- taken from http://stackoverflow.com/questions/566746/how-to-get-console-window-width-in-python
|
||||
"""
|
||||
|
||||
|
||||
import ctypes
|
||||
import fcntl
|
||||
import os
|
||||
import platform
|
||||
import struct
|
||||
import subprocess
|
||||
import termios
|
||||
|
||||
__all__ = ["getTerminalSize"]
|
||||
|
||||
|
||||
def getTerminalSize():
|
||||
current_os = platform.system()
|
||||
tuple_xy = None
|
||||
if current_os == "Windows":
|
||||
tuple_xy = _getTerminalSize_windows()
|
||||
if tuple_xy is None:
|
||||
tuple_xy = _getTerminalSize_tput()
|
||||
# needed for window's python in cygwin's xterm!
|
||||
if (
|
||||
current_os == "Linux"
|
||||
or current_os == "Darwin"
|
||||
or current_os.startswith("CYGWIN")
|
||||
):
|
||||
tuple_xy = _getTerminalSize_linux()
|
||||
if tuple_xy is None:
|
||||
tuple_xy = (80, 25) # default value
|
||||
return tuple_xy
|
||||
|
||||
|
||||
def _getTerminalSize_windows():
|
||||
res = None
|
||||
try:
|
||||
# stdin handle is -10
|
||||
# stdout handle is -11
|
||||
# stderr handle is -12
|
||||
|
||||
h = ctypes.windll.kernel32.GetStdHandle(-12)
|
||||
csbi = ctypes.create_string_buffer(22)
|
||||
res = ctypes.windll.kernel32.GetConsoleScreenBufferInfo(h, csbi)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return None
|
||||
if res:
|
||||
(
|
||||
bufx,
|
||||
bufy,
|
||||
curx,
|
||||
cury,
|
||||
wattr,
|
||||
left,
|
||||
top,
|
||||
right,
|
||||
bottom,
|
||||
maxx,
|
||||
maxy,
|
||||
) = struct.unpack(b"hhhhHhhhhhh", csbi.raw)
|
||||
sizex = right - left + 1
|
||||
sizey = bottom - top + 1
|
||||
return sizex, sizey
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _getTerminalSize_tput():
|
||||
# get terminal width
|
||||
# src: http://stackoverflow.com/questions/263890/how-do-i-find-the-width-height-of-a-terminal-window
|
||||
try:
|
||||
proc = subprocess.Popen(
|
||||
["tput", "cols"], stdin=subprocess.PIPE, stdout=subprocess.PIPE
|
||||
)
|
||||
output = proc.communicate(input=None)
|
||||
cols = int(output[0])
|
||||
proc = subprocess.Popen(
|
||||
["tput", "lines"], stdin=subprocess.PIPE, stdout=subprocess.PIPE
|
||||
)
|
||||
output = proc.communicate(input=None)
|
||||
rows = int(output[0])
|
||||
return (cols, rows)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return None
|
||||
|
||||
|
||||
def _getTerminalSize_linux():
|
||||
def ioctl_GWINSZ(fd):
|
||||
try:
|
||||
cr = struct.unpack(b"hh", fcntl.ioctl(fd, termios.TIOCGWINSZ, "1234"))
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return None
|
||||
return cr
|
||||
|
||||
cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)
|
||||
if not cr:
|
||||
try:
|
||||
fd = os.open(os.ctermid(), os.O_RDONLY)
|
||||
cr = ioctl_GWINSZ(fd)
|
||||
os.close(fd)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
if not cr:
|
||||
try:
|
||||
cr = (os.environ["LINES"], os.environ["COLUMNS"])
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return None
|
||||
return int(cr[1]), int(cr[0])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sizex, sizey = getTerminalSize()
|
||||
print(f"width = {sizex} height = {sizey}")
|
|
@ -1,64 +0,0 @@
|
|||
"""
|
||||
tests.support.generate-from-names-from-failed-test-reports
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This script is meant as a stop-gap until we move to PyTest to provide a functionality similar to
|
||||
PyTest's --last-failed where PyTest only runs last failed tests.
|
||||
"""
|
||||
# pylint: disable=resource-leakage
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import xunitparser
|
||||
except ImportError:
|
||||
sys.stderr.write(
|
||||
"Please install the xunitparser python package to run this script\n"
|
||||
)
|
||||
sys.stderr.flush()
|
||||
sys.exit(1)
|
||||
|
||||
REPO_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--reports-dir",
|
||||
default=os.path.join(REPO_ROOT, "artifacts", "xml-unittests-output"),
|
||||
help="Path to the directory where the JUnit XML reports can be found",
|
||||
)
|
||||
parser.add_argument(
|
||||
"output_file",
|
||||
help=(
|
||||
"Path to the file containing the failed tests listing to be fed to"
|
||||
" --names-files"
|
||||
),
|
||||
)
|
||||
options = parser.parse_args()
|
||||
total_xml_reports = 0
|
||||
failures = set()
|
||||
for fname in sorted(glob.glob(os.path.join(options.reports_dir, "*.xml"))):
|
||||
total_xml_reports += 1
|
||||
with open(fname) as rfh:
|
||||
test_suite, test_result = xunitparser.parse(rfh)
|
||||
if not test_result.errors and not test_result.failures:
|
||||
continue
|
||||
for test in test_suite:
|
||||
if test.bad:
|
||||
failures.add("{classname}.{methodname}".format(**test.__dict__))
|
||||
|
||||
if not total_xml_reports:
|
||||
parser.exit(status=1, message="No JUnit XML files were parsed")
|
||||
|
||||
with open(options.output_file, "w") as wfh:
|
||||
wfh.write(os.linesep.join(sorted(failures)))
|
||||
|
||||
parser.exit(status=0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -15,7 +15,6 @@ from tests.support.unit import TestCase
|
|||
EXCLUDED_DIRS = [
|
||||
os.path.join("tests", "integration", "cloud", "helpers"),
|
||||
os.path.join("tests", "integration", "files"),
|
||||
os.path.join("tests", "kitchen", "tests"),
|
||||
os.path.join("tests", "perf"),
|
||||
os.path.join("tests", "pkg"),
|
||||
os.path.join("tests", "support"),
|
||||
|
@ -26,15 +25,12 @@ EXCLUDED_DIRS = [
|
|||
os.path.join("tests", "unit", "setup"),
|
||||
os.path.join("tests", "unit", "templates", "files"),
|
||||
]
|
||||
INCLUDED_DIRS = [
|
||||
os.path.join("tests", "kitchen", "tests", "*", "tests", "*"),
|
||||
]
|
||||
INCLUDED_DIRS = []
|
||||
EXCLUDED_FILES = [
|
||||
os.path.join("tests", "buildpackage.py"),
|
||||
os.path.join("tests", "committer_parser.py"),
|
||||
os.path.join("tests", "consist.py"),
|
||||
os.path.join("tests", "eventlisten.py"),
|
||||
os.path.join("tests", "jenkins.py"),
|
||||
os.path.join("tests", "minionswarm.py"),
|
||||
os.path.join("tests", "modparser.py"),
|
||||
os.path.join("tests", "packdump.py"),
|
||||
|
@ -244,6 +240,6 @@ class BadTestModuleNamesTestCase(TestCase):
|
|||
# Yep, it is. Carry on!
|
||||
continue
|
||||
|
||||
errors.append("{} (expected: {})\n".format(mod_name, relpath))
|
||||
errors.append(f"{mod_name} (expected: {relpath})\n")
|
||||
|
||||
assert not errors, _format_errors(errors)
|
||||
|
|
Loading…
Add table
Reference in a new issue