Enable kitchen tests
Change-Id: I8dfebeb3ae4d7428e026a826b381cc7d10d9a017
diff --git a/.kitchen.yml b/.kitchen.yml
index 333c426..2c7c727 100644
--- a/.kitchen.yml
+++ b/.kitchen.yml
@@ -4,8 +4,8 @@
hostname: debmirror.ci.local
#socket: tcp://127.0.0.1:2376
use_sudo: false
-
-
+ build_options:
+ build-arg: --ulimit nofile=4096:8192 # debmirror req
provisioner:
name: salt_solo
@@ -27,20 +27,20 @@
grains:
noservices: True
-
platforms:
- - name: ubuntu-16.04
-
+ - name: <%=ENV['PLATFORM'] || 'saltstack-ubuntu-xenial-salt-stable' %>
+ driver_config:
+ image: <%=ENV['PLATFORM'] || 'epcim/salt-formulas:saltstack-ubuntu-xenial-salt-stable'%>
+ platform: ubuntu
verifier:
name: inspec
sudo: true
-
suites:
- - name: default
- # provisioner:
- # pillars-from-files:
- # debmirror.sls: tests/pillar/default.sls
+ - name: debmirror-client
+ provisioner:
+ pillars-from-files:
+ debmirror.sls: tests/pillar/client.sls
# vim: ft=yaml sw=2 ts=2 sts=2 tw=125
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..c1c100f
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,47 @@
+sudo: required
+services:
+ - docker
+
+addons:
+ apt:
+ packages:
+ - apt-transport-https
+
+install:
+ - git fetch --unshallow --tags
+ - pip install PyYAML
+ - pip install virtualenv
+ - pip install reno
+ - |
+ test -e Gemfile || cat <<EOF > Gemfile
+ source 'https://rubygems.org'
+ gem 'rake'
+ gem 'test-kitchen'
+ gem 'kitchen-docker'
+ gem 'kitchen-inspec'
+ gem 'inspec'
+ gem 'kitchen-salt' #, :git => 'https://github.com/salt-formulas/kitchen-salt.git'
+ - bundle install
+
+env:
+ - PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2016.3 SUITE=debmirror-client
+ - PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2017.7 SUITE=debmirror-client
+
+before_script:
+ - set -o pipefail
+ - make test | tail
+
+script:
+ - test ! -e .kitchen.yml || bundle exec kitchen converge ${SUITE} || true
+ - test ! -e .kitchen.yml || bundle exec kitchen verify ${SUITE} -t tests/integration
+
+notifications:
+ webhooks:
+ urls:
+ - https://webhooks.gitter.im/e/6123573504759330786b
+ on_success: change # options: [always|never|change] default: always
+ on_failure: never # options: [always|never|change] default: always
+ on_start: never # options: [always|never|change] default: always
+ on_cancel: never # options: [always|never|change] default: always
+ on_error: never # options: [always|never|change] default: always
+ email: false
diff --git a/README.rst b/README.rst
index f33d150..b0b2164 100644
--- a/README.rst
+++ b/README.rst
@@ -12,6 +12,7 @@
Example for one debmirror mirror, ubuntu.
.. code-block:: yaml
+
parameters:
debmirror:
client:
diff --git a/_states/debmirror.py b/_states/debmirror.py
index 2e5533f..3819d7c 100644
--- a/_states/debmirror.py
+++ b/_states/debmirror.py
@@ -67,7 +67,7 @@
def _check_state(name, tgt):
lock_file = _get_target_path(name,tgt)['lock_file']
if os.path.isfile(lock_file) and not tgt.get('force', False) :
- return _no_change(name, '{} exist=>repo locked.'.format(lock_file))
+ return _no_change(name, '{} exist=>repo locked.'.format(lock_file))
return False
def _get_target_path(name,tgt):
diff --git a/debmirror/schemas/client.yaml b/debmirror/schemas/client.yaml
index da54b1d..6e0ac58 100644
--- a/debmirror/schemas/client.yaml
+++ b/debmirror/schemas/client.yaml
@@ -28,13 +28,23 @@
debmirror:mirror:
type: object
additionalProperties: false
+ required:
+ - mirror_host
+ - mirror_root
+ - target_dir
properties:
extra_flags:
- type: string
- example: '--verbose --progress --nosource --no-check-gpg --rsync-extra=none'
+ type: array
+ items:
+ type: string
+ example: [ "--verbose", "--progress", "--nosource" , "--no-check-gpg", "--rsync-extra=none"]
method:
type: string
eval: [ "rsync", "http" , "https"]
+ description: -|
+ Specify the method to download files. Currently, supported
+ methods are ftp, http, https, and rsync. The file method is
+ experimentally supported
arch:
type: array
items:
@@ -46,9 +56,13 @@
mirror_root:
type: string
example: ':mirror/nightly/ubuntu/'
+ description: -|
+ Specifies the directory on the remote host that is the root of the
+ Ubuntu archive. The root directory has a dists subdirectory.
target_dir:
type: string
example: "/var/www/mirror/ubuntu/"
+ description: "Destination folder for mirror"
log_file:
type: string
example: "/var/www/mirror/target01_log.log"
@@ -61,12 +75,16 @@
type: array
items:
type: string
- example: [ main multiverse, restricted, universe ]
+ example: [ main, multiverse, restricted, universe ]
+ description: Specify the section of Ubuntu to mirror.
exclude_deb_section:
type: array
items:
type: string
example: [ games, gnome, Xfce, sound, electronics, graphics, hamradio , doc, localization, kde, video ]
+ description: -|
+ Never download any files whose Debian Section (games, doc, oldlibs,
+ science, ...) match the regex.
filter:
type: object
items:
@@ -76,9 +94,18 @@
01: "--exclude='/android*'"
02: "--exclude='/firefox*'"
03: "--exclude='/chromium-browser*'"
+ description: |
+ Sorted list of any kind filtered options.
+ Possible marks are:
+ --ignore=regex
+ Never delete any files whose filenames match the regex.
+ --exclude=regex
+ Never download any files whose filenames match the regex.
+ --include=regex
+ Don't exclude any files whose filenames match the regex.
lock_target:
type: boolean
- description: "Create lockfile, to prevent future repo updates"
+ description: "Create lockfile inside target dic, to prevent future repo updates"
force:
type: boolean
description: "Ignore lockfile"
diff --git a/tests/pillar/client.sls b/tests/pillar/client.sls
index 2dcc74f..0c9ec9f 100644
--- a/tests/pillar/client.sls
+++ b/tests/pillar/client.sls
@@ -3,7 +3,7 @@
enabled: true
mirrors:
target01:
- extra_flags: '--verbose --progress --nosource --no-check-gpg --rsync-extra=none'
+ extra_flags: [ "--verbose", "--progress", "--nosource", "--no-check-gpg", "--rsync-extra=none" ]
method: "rsync" # string
arch: [ 'amd64' ]
mirror_host: "archive.ubuntu.com" # rsync
@@ -14,6 +14,7 @@
section: [ main ] #, multiverse, restricted, universe ]
exclude_deb_section: [ 'games', gnome, Xfce, sound, electronics, graphics, hamradio , doc, localization, kde, video ]
filter:
- 00: "--exclude='/*'" # exclude all for test
+ 00: "--exclude='/*'" # exclude all for test..
+ 01: "--include='/vim-tiny'" # and include something small.
lock_target: True
force: True