summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2016-12-19 10:41:47 +0100
committervarac <varacanero@zeromail.org>2016-12-19 10:41:47 +0100
commit38e8e7b31b1b9deb39019ef8a1607d494022fab3 (patch)
tree1e06ce77c19f6a8243c39c69e171628ef581c30c
parent16aafa5ba4b629ea65d53454fa5c9af1ca7c8250 (diff)
git subrepo pull files/puppet/modules/pixelated
subrepo: subdir: "files/puppet/modules/pixelated" merged: "21f0340" upstream: origin: "https://github.com/pixelated/puppet-pixelated.git" branch: "master" commit: "21f0340" git-subrepo: version: "0.3.0" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "841aa43"
-rw-r--r--files/puppet/modules/pixelated/.gitignore1
-rw-r--r--files/puppet/modules/pixelated/.gitrepo4
-rw-r--r--files/puppet/modules/pixelated/Gemfile2
-rw-r--r--files/puppet/modules/pixelated/Gemfile.lock79
-rw-r--r--files/puppet/modules/pixelated/README.md7
-rw-r--r--files/puppet/modules/pixelated/Rakefile3
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/environment.py28
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/page_objects/leap_login_page.py14
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/common.py2
-rw-r--r--files/puppet/modules/pixelated/manifests/agent.pp5
-rw-r--r--files/puppet/modules/pixelated/manifests/apt.pp2
-rw-r--r--files/puppet/modules/pixelated/manifests/tests.pp22
-rw-r--r--files/puppet/modules/pixelated/spec/classes/tests_spec.rb9
-rw-r--r--files/puppet/modules/pixelated/templates/05-pixelated.conf.erb2
-rwxr-xr-xfiles/puppet/modules/pixelated/vagrant_platform.sh1
15 files changed, 137 insertions, 44 deletions
diff --git a/files/puppet/modules/pixelated/.gitignore b/files/puppet/modules/pixelated/.gitignore
index f974e08..3937395 100644
--- a/files/puppet/modules/pixelated/.gitignore
+++ b/files/puppet/modules/pixelated/.gitignore
@@ -1,7 +1,6 @@
# ignore rake spec module checkouts
**/spec/fixtures/modules/
**/spec/fixtures/manifests/
-/Gemfile.lock
# deployed by vagrant_platform.sh
/leap_platform
# ignore files created by functional test
diff --git a/files/puppet/modules/pixelated/.gitrepo b/files/puppet/modules/pixelated/.gitrepo
index ac9a4c4..fccc325 100644
--- a/files/puppet/modules/pixelated/.gitrepo
+++ b/files/puppet/modules/pixelated/.gitrepo
@@ -6,6 +6,6 @@
[subrepo]
remote = https://github.com/pixelated/puppet-pixelated.git
branch = master
- commit = 6086b945165d075e911c6afc6cfc53c9932586c2
- parent = cb6740619fe003b4a1956a413844a1a2bfa4b9de
+ commit = 21f03408aea72a5dfd50d19944fbe1f8e9b209e9
+ parent = 16aafa5ba4b629ea65d53454fa5c9af1ca7c8250
cmdver = 0.3.0
diff --git a/files/puppet/modules/pixelated/Gemfile b/files/puppet/modules/pixelated/Gemfile
index 4d5e1c9..ab3bf5e 100644
--- a/files/puppet/modules/pixelated/Gemfile
+++ b/files/puppet/modules/pixelated/Gemfile
@@ -2,7 +2,7 @@ source "https://rubygems.org"
group :test do
gem "rake",'< 11'
- gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.7.0'
+ gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.8.0'
gem "rspec", '< 3.2.0'
gem "rspec-puppet"
gem "puppetlabs_spec_helper"
diff --git a/files/puppet/modules/pixelated/Gemfile.lock b/files/puppet/modules/pixelated/Gemfile.lock
new file mode 100644
index 0000000..98aa139
--- /dev/null
+++ b/files/puppet/modules/pixelated/Gemfile.lock
@@ -0,0 +1,79 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ CFPropertyList (2.2.8)
+ diff-lcs (1.2.5)
+ facter (2.4.6)
+ CFPropertyList (~> 2.2.6)
+ facterdb (0.3.7)
+ facter
+ jgrep
+ hiera (1.3.4)
+ json_pure
+ jgrep (1.4.1)
+ json
+ json (2.0.2)
+ json_pure (2.0.2)
+ mcollective-client (2.9.0)
+ json
+ stomp
+ systemu
+ metaclass (0.0.4)
+ metadata-json-lint (0.0.11)
+ json
+ spdx-licenses (~> 1.0)
+ mocha (1.2.0)
+ metaclass (~> 0.0.1)
+ puppet (3.8.7)
+ facter (> 1.6, < 3)
+ hiera (~> 1.0)
+ json_pure
+ puppet-lint (2.0.2)
+ puppet-syntax (2.1.0)
+ rake
+ puppetlabs_spec_helper (1.2.2)
+ mocha (~> 1.0)
+ puppet-lint (~> 2.0)
+ puppet-syntax (~> 2.0)
+ rspec-puppet (~> 2.0)
+ rake (10.5.0)
+ rspec (3.1.0)
+ rspec-core (~> 3.1.0)
+ rspec-expectations (~> 3.1.0)
+ rspec-mocks (~> 3.1.0)
+ rspec-core (3.1.7)
+ rspec-support (~> 3.1.0)
+ rspec-expectations (3.1.2)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.1.0)
+ rspec-mocks (3.1.3)
+ rspec-support (~> 3.1.0)
+ rspec-puppet (2.4.0)
+ rspec
+ rspec-puppet-facts (1.7.0)
+ facter
+ facterdb (>= 0.3.0)
+ json
+ mcollective-client
+ puppet
+ rspec-puppet-utils (2.2.1)
+ rspec-support (3.1.2)
+ spdx-licenses (1.1.0)
+ stomp (1.4.3)
+ systemu (2.6.5)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ metadata-json-lint
+ puppet (~> 3.8.0)
+ puppetlabs_spec_helper
+ rake (< 11)
+ rspec (< 3.2.0)
+ rspec-puppet
+ rspec-puppet-facts
+ rspec-puppet-utils
+
+BUNDLED WITH
+ 1.11.2
diff --git a/files/puppet/modules/pixelated/README.md b/files/puppet/modules/pixelated/README.md
index 7e319d2..6bf6f7a 100644
--- a/files/puppet/modules/pixelated/README.md
+++ b/files/puppet/modules/pixelated/README.md
@@ -112,3 +112,10 @@ To run a feature:
To run a set of tests:
```$behave -t @staging```
+
+## Development
+
+### Run tests
+
+ bundle install --path vendor/bundle
+ bundle exec rake test
diff --git a/files/puppet/modules/pixelated/Rakefile b/files/puppet/modules/pixelated/Rakefile
index 7fb499f..24277ce 100644
--- a/files/puppet/modules/pixelated/Rakefile
+++ b/files/puppet/modules/pixelated/Rakefile
@@ -2,7 +2,7 @@ require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_fileserver')
-PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
+PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp", "vendor/**/*"]
desc "Validate manifests, templates, and ruby files"
task :validate do
@@ -17,4 +17,5 @@ task :validate do
end
end
+
task :test => [:lint, :syntax , :validate, :spec]
diff --git a/files/puppet/modules/pixelated/files/functional-tests/environment.py b/files/puppet/modules/pixelated/files/functional-tests/environment.py
index 9eb6b68..91d911b 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/environment.py
+++ b/files/puppet/modules/pixelated/files/functional-tests/environment.py
@@ -13,12 +13,13 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+import os
from page_objects import SignUpPage, LeapLoginPage
from selenium import webdriver
from selenium.webdriver.common.by import By
from steps.common import get_invite_code, RandomUser
from steps import behave_testuser, behave_password, delete_soledad_server_db, delete_soledad_client_db, signup_url
-
+import subprocess
def before_all(context):
set_browser(context)
@@ -27,11 +28,12 @@ def before_all(context):
def after_step(context, step):
- screenshot_filename = '{step_name}.png'
+ screenshot_filename = 'test_{step_name}.png'
+ screenshot_path = os.path.join('/var/log/pixelated', screenshot_filename)
if step.status == 'failed':
take_screenshot(context,
- screenshot_filename.format(step_name=step.name))
+ screenshot_path.format(step_name=step.name))
log_browser_console(context, step)
save_page_source(context, step)
@@ -41,16 +43,19 @@ def after_scenario(context, scenario):
def after_all(context):
- _delete_user(context, behave_testuser(), behave_password())
- _delete_user(context, context.random_user.username, context.random_user.password)
+ _delete_user(context, behave_testuser())
+ _delete_user(context, context.random_user.username)
if hasattr(context, 'browser'):
context.browser.quit()
-def _delete_user(context, username, password):
- user_id = LeapLoginPage(context).destroy_account(username, password)
- delete_soledad_server_db(user_id, username)
- delete_soledad_client_db(user_id)
+def _delete_user(context, username):
+ try:
+ subprocess.check_call(
+ ['./destroy-user-db', '--destroy-identities',
+ '--username', username], cwd='/srv/leap/couchdb/scripts')
+ except Exception as e:
+ print(e.returncode, e.output)
def save_page_source(context, step):
@@ -71,8 +76,9 @@ def log_browser_console(context, step):
console_log_file.writelines(log_lines)
-def take_screenshot(context, filename):
- context.browser.save_screenshot(filename)
+def take_screenshot(context, path):
+ print('Screenshot saved to: {path}'.format(path=path))
+ context.browser.save_screenshot(path)
def set_browser(context):
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/leap_login_page.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/leap_login_page.py
index 70b38b3..74350fc 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/page_objects/leap_login_page.py
+++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/leap_login_page.py
@@ -37,17 +37,3 @@ class LeapLoginPage(LoginPage):
self._visit_page()
self.wait_until_element_is_visible_by_locator((By.CSS_SELECTOR, 'input#srp_username'))
self.enter_username(username).enter_password(password).login()
-
- def destroy_account(self, username, password):
- self._login(username, password)
- self.wait_until_element_is_visible_by_locator((By.CSS_SELECTOR, 'a[href="/logout"]'))
- return self._confirm_destroy_account()
-
- def _confirm_destroy_account(self):
- current_url = self.context.browser.current_url
- user_id = current_url.split("/")[-1]
- self.context.browser.get(current_url + '/edit')
- delete_button_selector = 'a[href="/users/' + user_id + '"][data-method="delete"]'
- self.wait_until_element_is_visible_by_locator((By.CSS_SELECTOR, delete_button_selector))
- self._find_elements_by_css_locator(delete_button_selector)[0].click()
- return user_id
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/common.py b/files/puppet/modules/pixelated/files/functional-tests/steps/common.py
index 2db1298..7a54236 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/steps/common.py
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/common.py
@@ -31,7 +31,7 @@ MAX_WAIT_IN_S = 120
class RandomUser(object):
- username = 'testuser_' + ''.join(random.choice(string.lowercase) for i in range(16))
+ username = 'test_user_' + ''.join(random.choice(string.lowercase) for i in range(16))
password = ''.join(random.choice(string.lowercase) for i in range(16))
diff --git a/files/puppet/modules/pixelated/manifests/agent.pp b/files/puppet/modules/pixelated/manifests/agent.pp
index c689799..cdcdfd9 100644
--- a/files/puppet/modules/pixelated/manifests/agent.pp
+++ b/files/puppet/modules/pixelated/manifests/agent.pp
@@ -17,7 +17,10 @@ class pixelated::agent {
service { 'pixelated-server':
ensure => running,
- require => Package['pixelated-server'],
+ require => [
+ Package['pixelated-server'],
+ Service['apache']
+ ]
}
file { $default_file:
diff --git a/files/puppet/modules/pixelated/manifests/apt.pp b/files/puppet/modules/pixelated/manifests/apt.pp
index 2de5112..b96afbf 100644
--- a/files/puppet/modules/pixelated/manifests/apt.pp
+++ b/files/puppet/modules/pixelated/manifests/apt.pp
@@ -4,7 +4,7 @@ class pixelated::apt {
include apt
apt::sources_list { 'pixelated.list':
- content => "deb [arch=amd64] http://packages.pixelated-project.org/debian ${::lsbdistcodename}-snapshots main\ndeb [arch=amd64] http://packages.pixelated-project.org/debian ${::lsbdistcodename} main\n",
+ content => "deb [arch=amd64] http://packages.pixelated-project.org/debian ${::lsbdistcodename} main\n",
require => Exec[add_pixelated_key],
notify => Exec[refresh_apt],
}
diff --git a/files/puppet/modules/pixelated/manifests/tests.pp b/files/puppet/modules/pixelated/manifests/tests.pp
index a0264ae..4c04a27 100644
--- a/files/puppet/modules/pixelated/manifests/tests.pp
+++ b/files/puppet/modules/pixelated/manifests/tests.pp
@@ -29,26 +29,40 @@ class pixelated::tests {
require => Package['python-pip'],
}
- file{'/usr/local/bin/phantomjs':
+ file{'/usr/local/bin/phantomjs':
source => 'puppet:///modules/pixelated/phantomjs',
owner => 'root',
group => 'root',
- mode => '0755',
+ mode => '0755'
}
-
+
file{'/srv/leap/tests_custom/functional-tests':
ensure => directory,
recurse => true,
purge => true,
+ ignore => '*.pyc',
source => 'puppet:///modules/pixelated/functional-tests',
}
+
cron {'run_functional_tests':
- command => "(date; INVITE_CODE_ENABLED=$invite /usr/bin/mk-job pixelated-functional-tests /usr/local/bin/behave --tags @staging --tags ~@wip --no-capture -k /srv/leap/tests_custom/functional-tests/) >> /var/log/check_mk_jobs.log 2>&1",
+ command => "(date; INVITE_CODE_ENABLED=${invite} /usr/bin/mk-job pixelated-functional-tests /usr/local/bin/behave --stop --tags @staging --tags ~@wip --no-capture -k /srv/leap/tests_custom/functional-tests/) >> /var/log/check_mk_jobs.log 2>&1",
environment => 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
user => 'root',
minute => 27,
notify => Exec['dummy_register_job'],
}
+
+ # You can remove this after january/2017
+ cron {'run_smoke_tests':
+ ensure => absent,
+ }
+
+ # You can remove this after january/2017
+ file {'remove_smoke_tests_on_checkmk_folder':
+ ensure => absent,
+ path => '/var/lib/check_mk_agent/job/root/pixelated-smoke-tests'
+ }
+
exec {'dummy_register_job':
command => '/usr/bin/mk-job pixelated-functional-tests /bin/true',
require => Class['::check_mk::agent::install'],
diff --git a/files/puppet/modules/pixelated/spec/classes/tests_spec.rb b/files/puppet/modules/pixelated/spec/classes/tests_spec.rb
index eaf347c..be69cf2 100644
--- a/files/puppet/modules/pixelated/spec/classes/tests_spec.rb
+++ b/files/puppet/modules/pixelated/spec/classes/tests_spec.rb
@@ -11,13 +11,12 @@ describe 'pixelated::tests' do
:testscenario => 'single_node',
}
end
-
+
let!(:ensure_packages) { MockFunction.new('ensure_packages',{:type => :statement}) }
let(:pre_condition) { [
"class stdlib {}",
] }
-
it do
should contain_file('/srv/leap/tests_custom').with(
'ensure' => 'directory',
@@ -31,11 +30,9 @@ describe 'pixelated::tests' do
)
end
-
-
it { should contain_file('/srv/leap/tests_custom/pixelated.rb')}
it { should contain_file('/usr/local/bin/phantomjs')}
-
+
it do
should contain_exec('dummy_register_job').with(
"require" => "Class[::Check_mk::Agent::Install]"
@@ -43,7 +40,7 @@ describe 'pixelated::tests' do
end
it do
should contain_cron('run_functional_tests').with(
- "command" => """(date; INVITE_CODE_ENABLED=true /usr/bin/mk-job pixelated-functional-tests /usr/local/bin/behave --tags @staging --tags ~@wip --no-capture -k /srv/leap/tests_custom/functional-tests/) >> /var/log/check_mk_jobs.log 2>&1"
+ "command" => """(date; INVITE_CODE_ENABLED=true /usr/bin/mk-job pixelated-functional-tests /usr/local/bin/behave --stop --tags @staging --tags ~@wip --no-capture -k /srv/leap/tests_custom/functional-tests/) >> /var/log/check_mk_jobs.log 2>&1"
)
end
end
diff --git a/files/puppet/modules/pixelated/templates/05-pixelated.conf.erb b/files/puppet/modules/pixelated/templates/05-pixelated.conf.erb
index 35f1353..edcf299 100644
--- a/files/puppet/modules/pixelated/templates/05-pixelated.conf.erb
+++ b/files/puppet/modules/pixelated/templates/05-pixelated.conf.erb
@@ -1,6 +1,6 @@
# This file is managed by Puppet, changes may be overwritten
if $syslogtag contains_i 'user-agent' then {
- action(type="omfile" file="/var/log/pixelated/user-agent.log")
+action(type="omfile" file="/var/log/pixelated/user-agent.log" template="RSYSLOG_TraditionalFileFormat")
stop
}
diff --git a/files/puppet/modules/pixelated/vagrant_platform.sh b/files/puppet/modules/pixelated/vagrant_platform.sh
index 67382b4..7f40363 100755
--- a/files/puppet/modules/pixelated/vagrant_platform.sh
+++ b/files/puppet/modules/pixelated/vagrant_platform.sh
@@ -15,5 +15,6 @@ else
cd leap_platform
fi
+cd tests/example-provider
vagrant up pixelated --no-provision || vagrant reload
vagrant provision