summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-08-29 21:13:42 -0700
committerelijah <elijah@riseup.net>2016-09-01 10:13:31 -0700
commit1d56c0a7795ef87e34bd06c93a6525f3068aa536 (patch)
tree129687fe524355f74d1a4264e3a4c313baff50f6
parente6544ecc5a51ad6502a64bd08df71aa7ff75a3ee (diff)
move platform ci tests to tests/platform-ci
-rw-r--r--.gitignore32
-rw-r--r--tests/README.md9
-rw-r--r--tests/example-provider/README.md2
-rw-r--r--tests/platform-ci/Gemfile (renamed from Gemfile)2
-rw-r--r--tests/platform-ci/README.md11
-rw-r--r--tests/platform-ci/Rakefile (renamed from Rakefile)67
-rw-r--r--tests/platform-ci/hiera.yaml (renamed from tests/puppet/hiera.yaml)3
-rw-r--r--tests/platform-ci/provider/.platform-test.conf (renamed from tests/puppet/provider/.platform-test.conf)0
-rw-r--r--tests/platform-ci/provider/Leapfile1
-rw-r--r--tests/platform-ci/provider/common.json (renamed from tests/puppet/provider/common.json)0
-rw-r--r--tests/platform-ci/provider/facts.json (renamed from tests/puppet/provider/facts.json)0
-rw-r--r--tests/platform-ci/provider/files/ca/ca.crt (renamed from tests/puppet/provider/files/ca/ca.crt)0
-rw-r--r--tests/platform-ci/provider/files/ca/ca.key (renamed from tests/puppet/provider/files/ca/ca.key)0
-rw-r--r--tests/platform-ci/provider/files/ca/client_ca.crt (renamed from tests/puppet/provider/files/ca/client_ca.crt)0
-rw-r--r--tests/platform-ci/provider/files/ca/client_ca.key (renamed from tests/puppet/provider/files/ca/client_ca.key)0
-rw-r--r--tests/platform-ci/provider/files/ca/dh.pem (renamed from tests/puppet/provider/files/ca/dh.pem)0
-rw-r--r--tests/platform-ci/provider/files/cert/commercial_ca.crt (renamed from tests/puppet/provider/files/cert/commercial_ca.crt)0
-rw-r--r--tests/platform-ci/provider/files/cert/example.org.crt (renamed from tests/puppet/provider/files/cert/example.org.crt)0
-rw-r--r--tests/platform-ci/provider/files/cert/example.org.csr (renamed from tests/puppet/provider/files/cert/example.org.csr)0
-rw-r--r--tests/platform-ci/provider/files/cert/example.org.key (renamed from tests/puppet/provider/files/cert/example.org.key)0
-rw-r--r--tests/platform-ci/provider/files/mx/dkim.key (renamed from tests/puppet/provider/files/mx/dkim.key)0
-rw-r--r--tests/platform-ci/provider/files/mx/dkim.pub (renamed from tests/puppet/provider/files/mx/dkim.pub)0
-rw-r--r--tests/platform-ci/provider/files/ssh/known_hosts (renamed from tests/puppet/provider/files/ssh/known_hosts)0
-rw-r--r--tests/platform-ci/provider/files/ssh/monitor_ssh (renamed from tests/puppet/provider/files/ssh/monitor_ssh)0
-rw-r--r--tests/platform-ci/provider/files/ssh/monitor_ssh.pub (renamed from tests/puppet/provider/files/ssh/monitor_ssh.pub)0
-rw-r--r--tests/platform-ci/provider/nodes/catalogtest.json (renamed from tests/puppet/provider/nodes/catalogtest.json)0
-rw-r--r--tests/platform-ci/provider/provider.json (renamed from tests/puppet/provider/provider.json)0
-rw-r--r--tests/platform-ci/provider/tags/catalogtest.json (renamed from tests/puppet/provider/tags/catalogtest.json)0
-rw-r--r--tests/platform-ci/provider/users/gitlab-runner/gitlab-runner_ssh.pub (renamed from tests/puppet/provider/users/gitlab-runner/gitlab-runner_ssh.pub)0
-rwxr-xr-xtests/platform-ci/setup.sh4
-rw-r--r--tests/puppet/provider/Leapfile2
31 files changed, 81 insertions, 52 deletions
diff --git a/.gitignore b/.gitignore
index 146bd8ce..0b3cf120 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,16 +1,22 @@
/tests/example-provider/.vagrant
+
/puppet/modules/site_custom
-/Gemfile.lock
-/tests/puppet/provider/hiera
-/tests/puppet/provider/secrets.json
-/tests/puppet/provider/files/ssh/authorized_keys
-/tests/puppet/provider/files/nodes/
-/tests/puppet/provider/nodes/*
-!/tests/puppet/provider/nodes/catalogtest.json
-/tests/puppet/provider/tags/*
-!/tests/puppet/provider/tags/catalogtest.json
-/tests/puppet/provider/users/*
-!/tests/puppet/provider/users/gitlab-runner
-!/tests/puppet/provider/users/gitlab-runner/*
-/tests/puppet/provider/test
+
+/tests/platform-ci/.bundle
+/tests/platform-ci/vendor
+/tests/platform-ci/bin
+/tests/platform-ci/Gemfile.lock
+/tests/platform-ci/provider/hiera
+/tests/platform-ci/provider/secrets.json
+/tests/platform-ci/provider/files/ssh/authorized_keys
+/tests/platform-ci/provider/files/nodes/
+/tests/platform-ci/provider/nodes/*
+!/tests/platform-ci/provider/nodes/catalogtest.json
+/tests/platform-ci/provider/tags/*
+!/tests/platform-ci/provider/tags/catalogtest.json
+/tests/platform-ci/provider/users/*
+!/tests/platform-ci/provider/users/gitlab-runner
+!/tests/platform-ci/provider/users/gitlab-runner/*
+/tests/platform-ci/provider/test
+
/builds
diff --git a/tests/README.md b/tests/README.md
index a3628495..ea6bcaa9 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -14,13 +14,8 @@ These tests are to confirm that a provider's infrasture is working and to troubl
**example-provider/**
-Files to support the command:
-
- cd leap_platform/tests/example-provider
- vagrant up
-
-For quick booting a pre-configured sample provider, running in a single virtual
-machine.
+Allows you to generate a pre-configured provider using Vagrant virtual
+machines.
**platform-ci/**
diff --git a/tests/example-provider/README.md b/tests/example-provider/README.md
index 62cdc01a..80cb3ae9 100644
--- a/tests/example-provider/README.md
+++ b/tests/example-provider/README.md
@@ -1,5 +1,5 @@
Here lies a script to generate a pre-configured provider using Vagrant virtual
-machines.
+machines. This virtual provider includes only a single node.
All you have to do is this:
diff --git a/Gemfile b/tests/platform-ci/Gemfile
index ca38b3ba..aea88237 100644
--- a/Gemfile
+++ b/tests/platform-ci/Gemfile
@@ -11,5 +11,5 @@ group :test do
gem "rspec-puppet-facts"
gem "mocha"
gem "puppet-catalog-test"
- gem "leap_cli", :git => 'https://leap.se/git/leap_cli.git', :ref => 'develop'
+ gem "leap_cli", :git => 'https://leap.se/git/leap_cli.git', :branch => 'develop'
end
diff --git a/tests/platform-ci/README.md b/tests/platform-ci/README.md
new file mode 100644
index 00000000..bc48b21f
--- /dev/null
+++ b/tests/platform-ci/README.md
@@ -0,0 +1,11 @@
+Continuous integration tests for the leap_platform code.
+
+Usage:
+
+ ./setup.sh
+ bin/rake test:syntax
+ bin/rake test:catalog
+
+For a list of all tasks:
+
+ bin/rake -T
diff --git a/Rakefile b/tests/platform-ci/Rakefile
index cbd3d07c..5443be36 100644
--- a/Rakefile
+++ b/tests/platform-ci/Rakefile
@@ -3,40 +3,49 @@ require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet-catalog-test'
-# return list of modules, either
-# "external" (submodules or subrepos), "custom" (no submodules nor subrepos)
-# or all modules
-# so we can check each array seperately
+CI_DIR = File.dirname(__FILE__)
+PLATFORM_DIR = File.expand_path('../..', CI_DIR)
+PROVIDER_DIR = File.join(CI_DIR, 'provider')
+
+#
+# return list of modules, either "external" (submodules or subrepos), "custom"
+# (no submodules nor subrepos) or all modules so we can check each array
+# seperately
+#
def modules_pattern (type)
external = Array.new
internal = Array.new
all = Array.new
- Dir['puppet/modules/*'].sort.each do |m|
-
- # submodule or subrepo ?
- system("grep -q #{m} .gitmodules 2>/dev/null || test -f #{m}/.gitrepo")
- if $?.exitstatus == 0
- external << m + '/**/*.pp'
- else
- internal << m + '/**/*.pp'
+ Dir.chdir(PLATFORM_DIR) do
+ Dir['puppet/modules/*'].sort.each do |m|
+
+ # submodule or subrepo ?
+ system("grep -q #{m} .gitmodules 2>/dev/null || test -f #{m}/.gitrepo")
+ if $?.exitstatus == 0
+ external << m + '/**/*.pp'
+ else
+ internal << m + '/**/*.pp'
+ end
+ all << m + '/**/*.pp'
end
- all << m + '/**/*.pp'
- end
- case type
- when 'external'
- external
- when 'internal'
- internal
- when 'all'
- all
+ case type
+ when 'external'
+ external
+ when 'internal'
+ internal
+ when 'all'
+ all
+ end
end
end
exclude_paths = ["**/vendor/**/*", "spec/fixtures/**/*", "pkg/**/*" ]
+#
# redefine lint task so we don't lint submoudules for now
+#
Rake::Task[:lint].clear
PuppetLint::RakeTask.new :lint do |config|
# only check for custom manifests, not submodules for now
@@ -52,22 +61,26 @@ PuppetSyntax.future_parser = true
desc "Validate erb templates"
task :templates do
- Dir['**/templates/**/*.erb'].each do |template|
- sh "erb -P -x -T '-' #{template} | ruby -c" unless template =~ /.*vendor.*/
+ Dir.chdir(PLATFORM_DIR) do
+ Dir['**/templates/**/*.erb'].each do |template|
+ sh "erb -P -x -T '-' #{template} | ruby -c" unless template =~ /.*vendor.*/
+ end
end
end
namespace :platform do
desc "Compile hiera config for test_provider"
task :provider_compile do
- sh "cd tests/puppet/provider; bundle exec leap compile"
+ Dir.chdir(PROVIDER_DIR) do
+ sh "bundle exec leap compile"
+ end
end
end
PuppetCatalogTest::RakeTask.new('catalog') do |t|
Rake::Task["platform:provider_compile"].invoke
- t.module_paths = ["puppet/modules"]
- t.manifest_path = File.join("puppet","manifests", "site.pp")
+ t.module_paths = [File.join(PLATFORM_DIR, "puppet", "modules")]
+ t.manifest_path = File.join(PLATFORM_DIR, "puppet","manifests", "site.pp")
t.facts = {
"operatingsystem" => "Debian",
"osfamily" => "Debian",
@@ -80,7 +93,7 @@ PuppetCatalogTest::RakeTask.new('catalog') do |t|
}
# crucial option for hiera integration
- t.config_dir = File.join("tests/puppet") # expects hiera.yaml to be included in directory
+ t.config_dir = CI_DIR # expects hiera.yaml to be included in directory
# t.parser = "future"
#t.verbose = true
diff --git a/tests/puppet/hiera.yaml b/tests/platform-ci/hiera.yaml
index d4d0f670..a23d8b92 100644
--- a/tests/puppet/hiera.yaml
+++ b/tests/platform-ci/hiera.yaml
@@ -6,10 +6,11 @@
:logger: console
:yaml:
- :datadir: tests/puppet/provider/hiera
+ :datadir: provider/hiera
:hierarchy:
- catalogtest
:puppet:
:datasource: data
+
diff --git a/tests/puppet/provider/.platform-test.conf b/tests/platform-ci/provider/.platform-test.conf
index 621fb7b7..621fb7b7 100644
--- a/tests/puppet/provider/.platform-test.conf
+++ b/tests/platform-ci/provider/.platform-test.conf
diff --git a/tests/platform-ci/provider/Leapfile b/tests/platform-ci/provider/Leapfile
new file mode 100644
index 00000000..f54c9293
--- /dev/null
+++ b/tests/platform-ci/provider/Leapfile
@@ -0,0 +1 @@
+@platform_directory_path = "../../.."
diff --git a/tests/puppet/provider/common.json b/tests/platform-ci/provider/common.json
index a13f8f75..a13f8f75 100644
--- a/tests/puppet/provider/common.json
+++ b/tests/platform-ci/provider/common.json
diff --git a/tests/puppet/provider/facts.json b/tests/platform-ci/provider/facts.json
index 0967ef42..0967ef42 100644
--- a/tests/puppet/provider/facts.json
+++ b/tests/platform-ci/provider/facts.json
diff --git a/tests/puppet/provider/files/ca/ca.crt b/tests/platform-ci/provider/files/ca/ca.crt
index 01df56a7..01df56a7 100644
--- a/tests/puppet/provider/files/ca/ca.crt
+++ b/tests/platform-ci/provider/files/ca/ca.crt
diff --git a/tests/puppet/provider/files/ca/ca.key b/tests/platform-ci/provider/files/ca/ca.key
index c022b19a..c022b19a 100644
--- a/tests/puppet/provider/files/ca/ca.key
+++ b/tests/platform-ci/provider/files/ca/ca.key
diff --git a/tests/puppet/provider/files/ca/client_ca.crt b/tests/platform-ci/provider/files/ca/client_ca.crt
index c1214476..c1214476 100644
--- a/tests/puppet/provider/files/ca/client_ca.crt
+++ b/tests/platform-ci/provider/files/ca/client_ca.crt
diff --git a/tests/puppet/provider/files/ca/client_ca.key b/tests/platform-ci/provider/files/ca/client_ca.key
index 160cad43..160cad43 100644
--- a/tests/puppet/provider/files/ca/client_ca.key
+++ b/tests/platform-ci/provider/files/ca/client_ca.key
diff --git a/tests/puppet/provider/files/ca/dh.pem b/tests/platform-ci/provider/files/ca/dh.pem
index 3c86bf39..3c86bf39 100644
--- a/tests/puppet/provider/files/ca/dh.pem
+++ b/tests/platform-ci/provider/files/ca/dh.pem
diff --git a/tests/puppet/provider/files/cert/commercial_ca.crt b/tests/platform-ci/provider/files/cert/commercial_ca.crt
index 01df56a7..01df56a7 100644
--- a/tests/puppet/provider/files/cert/commercial_ca.crt
+++ b/tests/platform-ci/provider/files/cert/commercial_ca.crt
diff --git a/tests/puppet/provider/files/cert/example.org.crt b/tests/platform-ci/provider/files/cert/example.org.crt
index 7de2982d..7de2982d 100644
--- a/tests/puppet/provider/files/cert/example.org.crt
+++ b/tests/platform-ci/provider/files/cert/example.org.crt
diff --git a/tests/puppet/provider/files/cert/example.org.csr b/tests/platform-ci/provider/files/cert/example.org.csr
index 95e8b65d..95e8b65d 100644
--- a/tests/puppet/provider/files/cert/example.org.csr
+++ b/tests/platform-ci/provider/files/cert/example.org.csr
diff --git a/tests/puppet/provider/files/cert/example.org.key b/tests/platform-ci/provider/files/cert/example.org.key
index 7ca1c512..7ca1c512 100644
--- a/tests/puppet/provider/files/cert/example.org.key
+++ b/tests/platform-ci/provider/files/cert/example.org.key
diff --git a/tests/puppet/provider/files/mx/dkim.key b/tests/platform-ci/provider/files/mx/dkim.key
index 0dc069c6..0dc069c6 100644
--- a/tests/puppet/provider/files/mx/dkim.key
+++ b/tests/platform-ci/provider/files/mx/dkim.key
diff --git a/tests/puppet/provider/files/mx/dkim.pub b/tests/platform-ci/provider/files/mx/dkim.pub
index bbd32086..bbd32086 100644
--- a/tests/puppet/provider/files/mx/dkim.pub
+++ b/tests/platform-ci/provider/files/mx/dkim.pub
diff --git a/tests/puppet/provider/files/ssh/known_hosts b/tests/platform-ci/provider/files/ssh/known_hosts
index 50bc01fd..50bc01fd 100644
--- a/tests/puppet/provider/files/ssh/known_hosts
+++ b/tests/platform-ci/provider/files/ssh/known_hosts
diff --git a/tests/puppet/provider/files/ssh/monitor_ssh b/tests/platform-ci/provider/files/ssh/monitor_ssh
index 81ff75e4..81ff75e4 100644
--- a/tests/puppet/provider/files/ssh/monitor_ssh
+++ b/tests/platform-ci/provider/files/ssh/monitor_ssh
diff --git a/tests/puppet/provider/files/ssh/monitor_ssh.pub b/tests/platform-ci/provider/files/ssh/monitor_ssh.pub
index 8be32927..8be32927 100644
--- a/tests/puppet/provider/files/ssh/monitor_ssh.pub
+++ b/tests/platform-ci/provider/files/ssh/monitor_ssh.pub
diff --git a/tests/puppet/provider/nodes/catalogtest.json b/tests/platform-ci/provider/nodes/catalogtest.json
index 05703666..05703666 100644
--- a/tests/puppet/provider/nodes/catalogtest.json
+++ b/tests/platform-ci/provider/nodes/catalogtest.json
diff --git a/tests/puppet/provider/provider.json b/tests/platform-ci/provider/provider.json
index 218ff529..218ff529 100644
--- a/tests/puppet/provider/provider.json
+++ b/tests/platform-ci/provider/provider.json
diff --git a/tests/puppet/provider/tags/catalogtest.json b/tests/platform-ci/provider/tags/catalogtest.json
index 0967ef42..0967ef42 100644
--- a/tests/puppet/provider/tags/catalogtest.json
+++ b/tests/platform-ci/provider/tags/catalogtest.json
diff --git a/tests/puppet/provider/users/gitlab-runner/gitlab-runner_ssh.pub b/tests/platform-ci/provider/users/gitlab-runner/gitlab-runner_ssh.pub
index 1a3c370d..1a3c370d 100644
--- a/tests/puppet/provider/users/gitlab-runner/gitlab-runner_ssh.pub
+++ b/tests/platform-ci/provider/users/gitlab-runner/gitlab-runner_ssh.pub
diff --git a/tests/platform-ci/setup.sh b/tests/platform-ci/setup.sh
new file mode 100755
index 00000000..69a348b8
--- /dev/null
+++ b/tests/platform-ci/setup.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+which bundle || apt install bundle
+bundle install --binstubs --path=vendor --with=test \ No newline at end of file
diff --git a/tests/puppet/provider/Leapfile b/tests/puppet/provider/Leapfile
deleted file mode 100644
index c4c25b4d..00000000
--- a/tests/puppet/provider/Leapfile
+++ /dev/null
@@ -1,2 +0,0 @@
-@platform_directory_path = "../../.."
-# see https://leap.se/en/docs/platform/config for more options \ No newline at end of file