diff --git a/.gitignore b/.gitignore index 154a3decc15..acf579f4f67 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 16eaf94f7e0..00000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -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)' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4c32ac1beb0..4f05fb991c6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/.pylintrc b/.pylintrc index 0c4cba5963e..1867165266b 100644 --- a/.pylintrc +++ b/.pylintrc @@ -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] diff --git a/Gemfile b/Gemfile deleted file mode 100644 index cfd12f8cf35..00000000000 --- a/Gemfile +++ /dev/null @@ -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 diff --git a/cicd/jenkins/pr-centosstream-9-x86_64-py3-cloud-pytest b/cicd/jenkins/pr-centosstream-9-x86_64-py3-cloud-pytest deleted file mode 100644 index b041f3b970c..00000000000 --- a/cicd/jenkins/pr-centosstream-9-x86_64-py3-cloud-pytest +++ /dev/null @@ -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 diff --git a/cicd/kitchen_template.yml b/cicd/kitchen_template.yml deleted file mode 100644 index 5f67437c3e0..00000000000 --- a/cicd/kitchen_template.yml +++ /dev/null @@ -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 diff --git a/cicd/kitchen_testruns.yml b/cicd/kitchen_testruns.yml deleted file mode 100644 index 210fd17d70b..00000000000 --- a/cicd/kitchen_testruns.yml +++ /dev/null @@ -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' diff --git a/doc/topics/development/conventions/release.rst b/doc/topics/development/conventions/release.rst index fc414fb0116..c08447e2007 100644 --- a/doc/topics/development/conventions/release.rst +++ b/doc/topics/development/conventions/release.rst @@ -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) diff --git a/doc/topics/development/tests/index.rst b/doc/topics/development/tests/index.rst index f750d5a2c92..55e8bb18f2a 100644 --- a/doc/topics/development/tests/index.rst +++ b/doc/topics/development/tests/index.rst @@ -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 ` @@ -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 diff --git a/doc/topics/development/tests/test-pipeline.rst b/doc/topics/development/tests/test-pipeline.rst deleted file mode 100644 index dcb3cf0e3cb..00000000000 --- a/doc/topics/development/tests/test-pipeline.rst +++ /dev/null @@ -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 diff --git a/doc/topics/tutorials/writing_tests.rst b/doc/topics/tutorials/writing_tests.rst index 244091c663e..7417e14ecf8 100644 --- a/doc/topics/tutorials/writing_tests.rst +++ b/doc/topics/tutorials/writing_tests.rst @@ -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 diff --git a/kitchen.yml b/kitchen.yml deleted file mode 100644 index fd849f683b6..00000000000 --- a/kitchen.yml +++ /dev/null @@ -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 %> diff --git a/pyproject.toml b/pyproject.toml index 8afba8f0f4c..a8eb5de0b39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" ] diff --git a/pytest.ini b/pytest.ini index 0796d4bcf3f..30b3ffcc754 100644 --- a/pytest.ini +++ b/pytest.ini @@ -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* diff --git a/requirements/static/README.rst b/requirements/static/README.rst index 3a68d1163b9..6e486617f25 100644 --- a/requirements/static/README.rst +++ b/requirements/static/README.rst @@ -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` diff --git a/requirements/static/ci/darwin.in b/requirements/static/ci/darwin.in index c33beaabd3a..8f0aea74021 100644 --- a/requirements/static/ci/darwin.in +++ b/requirements/static/ci/darwin.in @@ -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 diff --git a/requirements/static/ci/windows.in b/requirements/static/ci/windows.in index 52afea9a71e..893fda3ea56 100644 --- a/requirements/static/ci/windows.in +++ b/requirements/static/ci/windows.in @@ -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 diff --git a/tests/kitchen/.kitchen.yml b/tests/kitchen/.kitchen.yml deleted file mode 100644 index 30038607298..00000000000 --- a/tests/kitchen/.kitchen.yml +++ /dev/null @@ -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 %> diff --git a/tests/kitchen/Gemfile b/tests/kitchen/Gemfile deleted file mode 100644 index f5616da5eb0..00000000000 --- a/tests/kitchen/Gemfile +++ /dev/null @@ -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' diff --git a/tests/kitchen/__init__.py b/tests/kitchen/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/kitchen/pytest.ini b/tests/kitchen/pytest.ini deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/kitchen/test_kitchen.py b/tests/kitchen/test_kitchen.py deleted file mode 100644 index d4c285d7b42..00000000000 --- a/tests/kitchen/test_kitchen.py +++ /dev/null @@ -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)) diff --git a/tests/kitchen/tests/wordpress/driver.yml b/tests/kitchen/tests/wordpress/driver.yml deleted file mode 100644 index 208831b94d4..00000000000 --- a/tests/kitchen/tests/wordpress/driver.yml +++ /dev/null @@ -1,2 +0,0 @@ -forward: - - 80 diff --git a/tests/kitchen/tests/wordpress/pillars.yml b/tests/kitchen/tests/wordpress/pillars.yml deleted file mode 100644 index 48b6b5a2661..00000000000 --- a/tests/kitchen/tests/wordpress/pillars.yml +++ /dev/null @@ -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 diff --git a/tests/kitchen/tests/wordpress/platforms.yml b/tests/kitchen/tests/wordpress/platforms.yml deleted file mode 100644 index fbcd23cb1f1..00000000000 --- a/tests/kitchen/tests/wordpress/platforms.yml +++ /dev/null @@ -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++ diff --git a/tests/kitchen/tests/wordpress/provisioner.yml b/tests/kitchen/tests/wordpress/provisioner.yml deleted file mode 100644 index 76f46ce2f5d..00000000000 --- a/tests/kitchen/tests/wordpress/provisioner.yml +++ /dev/null @@ -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 diff --git a/tests/kitchen/tests/wordpress/states/defaults.yaml b/tests/kitchen/tests/wordpress/states/defaults.yaml deleted file mode 100644 index 39efc622999..00000000000 --- a/tests/kitchen/tests/wordpress/states/defaults.yaml +++ /dev/null @@ -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 %} diff --git a/tests/kitchen/tests/wordpress/states/init.sls b/tests/kitchen/tests/wordpress/states/init.sls deleted file mode 100644 index 70b7087efac..00000000000 --- a/tests/kitchen/tests/wordpress/states/init.sls +++ /dev/null @@ -1,7 +0,0 @@ -include: - - php.ng - - php.ng.mysql - - php.ng.apache2 - - apache - - mysql - - .setup diff --git a/tests/kitchen/tests/wordpress/states/setup.sls b/tests/kitchen/tests/wordpress/states/setup.sls deleted file mode 100644 index 2240bc2bd11..00000000000 --- a/tests/kitchen/tests/wordpress/states/setup.sls +++ /dev/null @@ -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 diff --git a/tests/kitchen/tests/wordpress/states/wp-cli.phar b/tests/kitchen/tests/wordpress/states/wp-cli.phar deleted file mode 100644 index ff8c7b6a39b..00000000000 Binary files a/tests/kitchen/tests/wordpress/states/wp-cli.phar and /dev/null differ diff --git a/tests/kitchen/tests/wordpress/states/wp-config.php.j2 b/tests/kitchen/tests/wordpress/states/wp-config.php.j2 deleted file mode 100644 index 928dbddc335..00000000000 --- a/tests/kitchen/tests/wordpress/states/wp-config.php.j2 +++ /dev/null @@ -1,82 +0,0 @@ -